From a2b83e1c90d5e4daf3076ac2c03b652d52544818 Mon Sep 17 00:00:00 2001 From: ltvill <40988464+ltvill@users.noreply.github.com> Date: Wed, 1 Aug 2018 22:19:57 +0300 Subject: [PATCH 01/58] Change default examine chat color to green For better visibility --- .../main/java/net/runelite/client/config/ChatColorConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/config/ChatColorConfig.java b/runelite-client/src/main/java/net/runelite/client/config/ChatColorConfig.java index 0bcf67341c..c9a3e40d3d 100644 --- a/runelite-client/src/main/java/net/runelite/client/config/ChatColorConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/config/ChatColorConfig.java @@ -451,7 +451,7 @@ public interface ChatColorConfig extends Config ) default Color transparentExamineHighlight() { - return Color.decode("#0000FF"); + return Color.GREEN; } @ConfigItem( From 973e624e4238a3b1d5751eb11fea4791aef60227 Mon Sep 17 00:00:00 2001 From: Sander de Groot Date: Fri, 14 Jun 2019 22:36:41 -0400 Subject: [PATCH 02/58] Adjust alignment of icons in fixed 2005 interface style and fix inventory icon --- .../plugins/interfacestyles/WidgetOffset.java | 24 +++++++++--------- .../plugins/interfacestyles/2005/900.png | Bin 924 -> 8357 bytes 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/WidgetOffset.java b/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/WidgetOffset.java index fe61af1af7..9edf17165e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/WidgetOffset.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/WidgetOffset.java @@ -118,33 +118,33 @@ enum WidgetOffset FIXED_2005_INTERFACE_CONTAINER(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_INTERFACE_CONTAINER, 7, null, null, null), FIXED_2005_BANK_CONTAINER(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_BANK_CONTAINER, 7, null, null, null), FIXED_2005_COMBAT_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_COMBAT_TAB, 19, 2, null, null), - FIXED_2005_COMBAT_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_COMBAT_ICON, 26, null, null, null), + FIXED_2005_COMBAT_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_COMBAT_ICON, 28, 1, null, null), FIXED_2005_STATS_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_STATS_TAB, 55, null, 30, null), - FIXED_2005_STATS_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_STATS_ICON, 53, null, null, null), + FIXED_2005_STATS_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_STATS_ICON, 51, null, null, null), FIXED_2005_QUESTS_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_QUESTS_TAB, 82, 1, 30, null), - FIXED_2005_QUESTS_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_QUESTS_ICON, 81, null, null, null), + FIXED_2005_QUESTS_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_QUESTS_ICON, 80, null, null, null), FIXED_2005_INVENTORY_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_INVENTORY_TAB, null, null, 45, null), - FIXED_2005_INVENTORY_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_INVENTORY_ICON, 115, null, null, null), + FIXED_2005_INVENTORY_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_INVENTORY_ICON, 113, 1, null, null), FIXED_2005_EQUIPMENT_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_EQUIPMENT_TAB, 153, 1, 30, null), - FIXED_2005_EQUIPMENT_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_EQUIPMENT_ICON, 152, 4, null, null), + FIXED_2005_EQUIPMENT_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_EQUIPMENT_ICON, 151, 4, null, null), FIXED_2005_PRAYER_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_PRAYER_TAB, 180, null, 32, null), - FIXED_2005_PRAYER_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_PRAYER_ICON, 180, null, null, null), + FIXED_2005_PRAYER_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_PRAYER_ICON, 178, null, null, null), FIXED_2005_MAGIC_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_MAGIC_TAB, 209, 1, 30, null), - FIXED_2005_MAGIC_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_MAGIC_ICON, 206, 3, null, null), + FIXED_2005_MAGIC_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_MAGIC_ICON, 206, 2, null, null), FIXED_2005_CLAN_CHAT_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_CLAN_CHAT_TAB, 15, null, null, null), FIXED_2005_CLAN_CHAT_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_CLAN_CHAT_ICON, 22, 0, null, null), FIXED_2005_FRIENDS_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_FRIENDS_TAB, 51, null, 30, null), - FIXED_2005_FRIENDS_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_FRIENDS_ICON, 50, null, null, null), + FIXED_2005_FRIENDS_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_FRIENDS_ICON, 49, -1, null, null), FIXED_2005_IGNORES_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_IGNORES_TAB, 79, null, 30, null), FIXED_2005_IGNORES_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_IGNORES_ICON, 78, null, null, null), FIXED_2005_LOGOUT_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_LOGOUT_TAB, 107, 1, 45, null), - FIXED_2005_LOGOUT_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_LOGOUT_ICON, 114, 1, null, null), + FIXED_2005_LOGOUT_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_LOGOUT_ICON, 112, null, null, null), FIXED_2005_OPTIONS_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_OPTIONS_TAB, 150, null, 30, null), - FIXED_2005_OPTIONS_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_OPTIONS_ICON, 149, null, null, null), + FIXED_2005_OPTIONS_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_OPTIONS_ICON, 148, -1, null, null), FIXED_2005_EMOTES_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_EMOTES_TAB, 178, null, 30, null), - FIXED_2005_EMOTES_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_EMOTES_ICON, 179, null, null, null), + FIXED_2005_EMOTES_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_EMOTES_ICON, 178, 1, null, null), FIXED_2005_MUSIC_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_MUSIC_TAB, 206, null, 30, null), - FIXED_2005_MUSIC_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_MUSIC_ICON, 202, 5, null, null); + FIXED_2005_MUSIC_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_MUSIC_ICON, 202, 2, null, null); private Skin skin; private WidgetInfo widgetInfo; diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/900.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/900.png index 407e476c549bcba6b12b4add6e3e356e33881326..80c3b83fc8bcc414459bcfe200b709d6ff07a72c 100644 GIT binary patch literal 8357 zcmV;WAX?vvP) zaB^>EX>4U6ba`-PAZ2)IW&i+q+O3=Cu^hRQh5y5fH32#Sb08zugEfD@gKly->cvyM zLtfQgg-UTm0^`pA{qJ@E!=Ku`cez-ry;jek+;fkEFPi`S`FsvOzklDK`27{%|L*55 zX8+?A!6!ba&$sn_UqASH`Rxt%eSMg}|GBgEy-xdH==+Nw7fiadmhpXE`(7x;&(Fj6 zd)L438~K;V`TkAzd6FM5{^R%A2*xh_Fhv(n3d!@Y-WU@rNIeZcSN;vD#LrLlb$mb1 ze;qq_(q9Mf=U0D-ogd$yr{9Od`TBi9{X>ktKM&=vWA`HT>x#l}cmCZkY=rKA{qsxg z?%nO)^Le_FE0L=1`%pg~<$c8qC!tL5ZIut>Z{cfuADxfJBQAoz$>!u^xzIx-+Bf8| z!w5H=_j!fI5_3G!_#ESk>HVxFi#@KFl&p_%qmiENQX?CStR;RNf379G`}TLg6&iQm zfmg=B#gxB4eYn5+;lK0o^FsHkbVKm%6DP`obww2*%TVU@FRvmY;eKOUUVPt&`=xID zFNsZLu)Hug9&q^ixx_5tx7tcC&xzL+pPm1dd$9ez03qVug~fzK27INwLk-?yv=E46 zBR_+c$CTqF1EG|-gS+G=rAl&I)V+C+h4`E!MSZSq~QB%#e)LN|yqlP8RR;-#?vu>lMmRo7HS!=Dg(PK|QSn0K!>#g@b1~(mC zdhqVSE5?{{rkQ7%b=qvR&#@?DVQuoc=pY!$?S=-|=N_q)W7b>PcU4V@joHk+`;-r83v-?jk@K0Z;pD^vF;%7aJ zoSk0kNjusiM#=hZ>(!tLIRP-NPEo_TinBp#BYhXI;oh zu-$$0Rv&C?ybn))OT9B61D}4bq@OzDjg%>mn|RRO$n7Y-yEQI%2WM|Cm3;0JmbbgW zwbA%|>#P@Oou^NIZhib%#P8PN^h+(H&RhZ|GZz2GkqySbEzFYo_A_!piGy~^=6YPM zoqT<*gn~j3qq(V;Y!VpybIxRyXG?t*P&D&gYb?@KZE^`ZDYSMfC0)aG z3&K(tCxlzQr8L-!n|ce^;N?a~6C1tit_>_x>tRkVS=Z^Egw58p2-k9f#yh{iF_?Z- z4vX@;owm;9ze?UZaL_^>`>Y<;Eu^cAop`cD_K&aT2E9KBbcS}@O{ah#dwnXh>hTF3 zkoEVU70^7E0{|oK9;n4$;G9h}^ZcvFy+)(YXN_a{z0Lp>LiDBVJR@!1JSpG_z>+zG zJ3UkiaM+^PHwt2z0@DT&@S`taDcuxQd}|k4J)CBxBr5c9qn3Ayp;pugFBJah+J4OB zd0pL+#+r+Zj_|HAdMHG5w!7990F~0IMqrizO-pCG!b(=o^hO#Zv;zFpwq8k0Yu)OY zYZ7+jO_Zq`i3UM57r%B3XViX;MY%@94e7#MjWV;dBk(j!r&muI6BLfC(x9MlgrZv` z6K3h|O&ChyKi{AOhX7A3n|7tI^plva@uTfuLvYz!3AtUk|1MS5=E|e(+^Y(7pcH1g zo66SJS5ueYgI-v7%)Myx8G8l;q%Q6aW5F)46Xo9z^ig9s)))C_QiRDxI7|1gx7(eg zUmz)+O$x7-#MLRRUdd1$wMD{P_J#;7fN*)|KqJ9BYa+DPo|!7;TS^1WAe5392KG$2 z4$+diaauf#GQ)GgYB0;FO8_u<6151t1)zW;KpV&h2CW~z{r-whi*43U)eW*6Rwlxb zm+qefXquzl?0D5U^U%a4Q9Fp%eT~QN#Eykc03{@}+3w+JF}(?z2YG|zs7ABA>AdFD zQ)j0Bw*NrSEy0juwH*iIemc;?5mqZWm(r$&sDO1pM0k6WUGU%$_ zr}NfNnwv@}4Xm_ta!EU(B33Q&6r@PK4?F2ZpgngS4ELQN*xqOyI6ol%9Pe!bBwq>s z8@xX!Gz~f5bEyQDrxc`LPUFHPo$&U~U%+b*N_7+}XU`9dTu+M}NF&c%MKBkp4&oV- z2eFK^0{>ALRZ7QFlCrzLD9j}B?(Ps#_onsGI-J*THRmJ|*cxpH9Ib{hrc)}Fjus9e zq6ZL=TmmLA<8Uiy5wxzNOwt1aldBaWez8d|4eI~UiI4ywoELCHyWMz5k|bQ6z3(n7 z+DC@o_XbHpC>FktRaIKqKoYXfR;Kb%0E5~?bv3p3zQe1#L)1--7$I8=8WUc>0{FbC zfLL+3yZJkIJ&3@XDa~#!B4g%7ee>P}7I_fnEH=g(eOaxRD@%k)ULl zmY9OX-iVbOX~}?gTJvr=jfbTpKwP3Q zTIJ%<6|Zlk#JZP@Nh$IboxSg z1_ud*vK9}+BSGb zaSQ(`6+$^662E}se9a`YJV+89uNw+6zyiyT&~x;($wOb1#zrYE#HnE!A8w+u#uJDS z*)w`8zW#QK7!ZycCJ+;B6*BORw?nUN;ue51Cw%l_VRdIPdW;K zs99j7JhkGusQ|Q!7L8me4%12H9sJl#Ytf2GEz}*>T#Sv?f~0@4_{3F%r&kaf04@O^ zJ&EA?c#-(J?BGl{=0{IW2cqmSTZkdL70~w&{P0=(o3+=Ap!-Fb0nBblLvR6Ll|t{} zC3YBnkCvkNp)K+PHQc4rVr`UK5uennU|==?8rr(Kyo7;xI=+Xf2Rx37#FHUMD?z37 z@I@A_i73llD~O&t)dAyeDQ4CO(^AA8!F4P+;Gn>%)Rd^_ zi6fY0n3N~-1a_bZ&#Y6{#`k+Rm7PwW`qG2Q&>rfHmN*Bq;;BU(I+p43zH`mgUj%*?1XbALc`Fd6a-=S~$DQVu)?Tq75Uy2aT*rZWT|{Niy{u}@7=#5mn(VvTG0p7s*} z><-(dmlzUN@tPYPgF&d`eXfh5Q877v9Deh{ucQCm&;$o1@|^7Z_u`zSrHeUgWhR9V z8wqP54`EWwjTJQqZV1VoY6kaf5{6}~r7q&2N|Tj``M~YrFc%10Q9t~r!JEYSMpR1% z5(LRz_&p0HZDBnqPMprVJ=#`hvK)M1a*vxciC93|b5aB2iGbo6Sf2PA%JVz282Vm` zpNj7U5djFV21hqFc?3d;YCt^QEl`=$RS> zflC|ir{>Y;{S5yr8@gak`{ z=L#E0!%*OXDgwQ)PXAed$a*&#LUP`8pPR~wWaw~l_sR_DH_f3igvTE(e;7EnqaopC zsoUf-JVwwaNTKUkQ{Mx+DW}2)^CH*}zAJ%45rbk+%U6QFho^fH__(|#YitdPP*LF& ztay*RA<5A6c{RVXLjrUJSdv0R>UrLAF}S&Bd~mQ}^MMS+2}K|@E+Py4b^O}ei^(QA zacgpO_IU7g1OZKpRa1l!D`XmlxGquP--_);)Ik8)feCFdMBjsbWb6D4q7<`T0(f`8 zX3dV#UKjh9E@H8*xrrFXQbGC~(Od`tAQPR*1EK~s=Ajgvp9y`J(OsuRS{;KirJ!Y7 zKnGZyDi8QQDnldnLmNXC0$8LtJm9hCP^iN6KXV9aAd`E{oWTnW|%V`MKdfkTZRneIP!qAu=m&#&RkG6UfOarh|!0cnN}Jx%i&iWecDcj;aQ-+&t$%E4!l8ZaM_8DdIc;v;-6 zd5UQPj5v(0DJG>pNAimnVu81HP<)EN-aLC!Ch18a;5`8tNZ-&rbq<(tF?1x@g5kkS z(6y7e!(TuRDiws6bs>Mzp~Derln^EZ?!9FX2p)s5Ni^??LO20rlPPAQ5WYdtFeBQq zSDXQeTc{)K6O04xkFvb>7Ls_%sF9Rs&@d8?+Q6_k1yKH+6`)50vY9S8s2S|8+ox$% z$}L3ZML=lr%F?I+NQFX@?gmvlYL2GqD710F^xfUac(W8SA7FB%t`Tk^8oG4PDJ|4N+ZtEQ z8tKp<5e4PRqY>nJ(~yn|v%86)E)t9whpBD%Cbty;>9wUm*Ziz^Dg+t3_$CfKBz6JS zrXeqlrjx=O#2o{fG0ykr7JOhM;)k8Zw<)rNaaI>9iTw+ z9g)EU;kAzk3IKkx*Tt{t85Cp<+_k7|rF&>YwO2iJY;@xRx z)>B!JAP$dFa15s{hq-=|`2!awShMf zBpsCnf8G$#_*P*ZNC}wRq0pmb%ZG#|5p)4z1mV(E#D7j#U#R`FPP_{iyCD``2gXDu z!1vhXa;S?v0Z4c4!p1sVl6?#dDB*s zCUI!14&d@FRYdkNlg%l-qn3tV4FKo@f|IaI=0FmNd%T$y0!Af1(17i$;l`UlZ6xzZ z$eN-Vs`jyb$N&Y;fDKJNLX9HfrulDDCuU$FtbmT^jTP8~E< zyp2^qdI(RVz%^($YDco=uHx={Vol^rI-c61YaxPI#)nf9oWzPz7QCM}FEZ`+T<8Ke ziFs`*X9uqF)<*l-iW>gSk1~1z{=hEeP;eFkMI?pSoa&UO{l&?p5qlYD<1!|xXm+v? zj7bBjrF{!~21B}D8;b4CV1wSPF<2nzTt$Q^pFsclC_0L>@&pku)L2FP%>q>oj`0o= z-!99$H3UHelFG`|Q%oui3VTavef-K+YB%i5;OP}gs4B;{~qX-4R< z`Q5DOmN&lKTPmJ=C$GBzgxcLi7`?D}2?F$rwrV={iDrgb&BypfbcfpCYEg;`m8LBz zZyMfA4FiGXiFO#QnM~J(!_06MZF;}fZj6p_L(8!@JWuDE}w!t5oVW??ZkQ83)nsVWHHd^RT zh)2GJ@CA(}G&8mNCUX@_K~xa4bWEuMVMbZ&Cv4cw*??R;-0&T%557Xb{YV%kVZHcTRsgnXX zz<@PUgtHBr)eQ1OBHBXE>l?qNYwDQOHfCwc&MggtvgyM$l%LqB_-&M<-XkcNpt z-^HtMzzgb{oLa;TPrg~K7`vmtULMS2h?<&_284KmV5~Gdq}S#`grFAT$c&&Kv0ykHnq~y4yS}cXeCjGs~(*|NRii3_oN=gqpJ*Y(KUIvQ{=t*Nh0^J&8+=@1H(4~HcbD=MbBg(C!%DIm0C^{??a>xDBO zbB>^a7-*{l7m?~W9ke4=Vq};!2+ojtF3IU>a-M+|4UP*2`G6h~WsEHwn3QT*uabQa zN3%sF!)Mc4==8QKKyq+>ZyywsE1K0y^A*yvuaZw-x7fThB(Qpj{BAVba*!Bb}c70>gOxwp%2O}sd*g~6)D8bAb8)A&ZPVJ5uJ{t(G0 zi|J2r2zO0o9atd3{ThBG&Ck(|WEE&`CXdzqXJb^rjIls@PRSa)2ziy?m#ts3dL4aC z*>y$t?@mr}+l6~AFAg>o+-qJ(E5O;O!zuH(9fB7*M}u_GS<{paG3y+jA#Q;BOpHNW zq~uPbzBY97d?_mEmHIszCYFp2bv9!dUbJHU=j4KnXeK3}QsvGd<4fzNj$}Z|1rNT! z3VfeO-?U2) zb~JmO3nh82MhRh_hmsL*5l<^LMr9gSTsWBec zq9)$cGDPKmeJwWv)cagh-3tV1KNn+>PD5sayOi!tI&b=Rle2J(Ks}gfxm>0(SU9?}uEq!g87Y~@> z2}d*`_@n;`0q8j5-2n^W6GDFHZ*?A0FJ99AIy9?%Yx}kT<9hh>XYeS#uUK_x+Il2F zM&&oJ!PIh!kQf=W22?uVLq^OxH4Rnl z_Z+KyzIaDu+;3-P{`|KWu+)$H#70nT_=nyy{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2jd1101N~u zh3cjN00ZqwL_t(o!|hj1YZE~jekSXJuFW+QIMb8@PT&M z#_O*fy)Yf~!tVquJ3#fK3QB{rZg*_}z(CG&?*O1u{9x$MZg6@xMb z0FRXb0G$a300g0$>$@{}tfb#pYCN}|?^M99N3!52^riu~Dw&4q1 zhVjtW^V&nq!E%%xU`06c^n1(}YJljDVs&p)@3B&0cBFxJ*G_>9LZQFwOgQ=@^}H7` zKuT7~KwmhxhFD)C0_t%LK%m)31ZQU39x8SYPdK6&nmOOK5QGA7lVm8dg(bLkMa}pW zIUo&;rt00>BjEGE%6u_P^s%P0rh8(8nAliVrR;yPar!+*DI0vV25G9CY8}N12s3~= zvicyQk^qb5{uWHmp}w;Ilwx zN2SJby8*1PS=fCB+`Pe2sd0>lHiA%S@U(8B1}GZ}7R8BhD0mPGc&n--Dgc0l;-@dS zzz+8C=#_sP7J^WfV||V0iNyd$Q{dw#8y!n%Eaks%1=ef>59{;b?d5Tt95&|R)(Vn0@ zL1-;4^noH1>W|b%CJ>^r=?OGFf#*+n&SZj6U?6AcOt=O+nkMC3=mV{?%;60ZFo8(-F-8K`7Al)V1n$psmOZR*>FeO9nN2j9vd4MrV29)&x6Nsr5+Vz4^XoE5B zwt7(k{uDV0{c`|$Cp6kGJJNuRQXt8&2yCwQ%bp2~HmB?sO-z-Yd{C1OP5m;*aypDI z10>s)X2yNtq!gdc{_Ot(#^j1~2}MAP0KEI==rcrN;DX@G{g^N&0bs?slscqjeWEbn vf}nr?XOsc+r$PVz*K7{tZvvl>^FiY$Co~SMPqcfG00000NkvXXu0mjf#ZHoP delta 902 zcmV;119|+VL7WGWBYyx1a7bBm000XU000XU0RWnu7ytkRPDw;TR9J=WmQQOFQ5400 z$rzA8(-5#^$Rh4a2)gQ`D_4S0-1!Mys7w6>f-cT;qR7<9}}id2-jwM!vGv)(0>- zXz}_my)wri5g2#KhCLW`JVw4^eW2G*0(+m3c=tW!ICAH@@v8|}+R(eHlM1Bj$w3Q% z)9iBTw{AaWIEUlN9s8#Qwr-P2QoqpzV1J$h5adAzolE>iv-rK+Ppue(j>ov8GM5TY z0^<&u`LF~wD}M|ZS`i>`gRb}_fQy+{WHKWsnzGUc94gd$V6#saCoolQhF-$32lv-0 z`dv+Snq6{qu80#5e*}>#{)Y>Q6PCQ-RAB42R^V&g=H9J@aG}>fp1`+Lud-XK;y0SG z20^5X?*XbHv9YREJU+DB({xpC8cmoB2{VC-YJ0>dW`8VmPb~rIE5Oi8h!c<#Ai)Jf zqK?$YYO6R6`}33_QkK7*1WXKj%WEdVD!ToY`|EIL&13ha{(doQ6&?Uxj0vX)q#{9_ z*vW%P;jcF7_EWk5lrq0~vqj@@kEd_Fe6McBoi*8G$95737x3k*!FZ)qD^AQH8ge2o zX3aeL1AiVq+RJ^TifT>OrlFn7YJs?49+)ayFHt6l6#Mg($w7;&FL9L zYUvmj1UCDnIrgS{&%IlTMI>C#ik79ereSiFx2-LyspJ~ED$IJh8h1&6Y_y{g$ zt$ZHnwb-r$a2!K(aDX;VoY+J}%8{=a`HEN1wfttK;u9enE|$lzlK^13-|WATtImS$ zoieFeh%E|sS@qTuxGt#bfVoQYDryyw0Chx6h{WR#&iB5n@LQW*WPUf{ cHU2sL0B!!8K&}`MeE Date: Mon, 24 Jun 2019 16:14:25 -0400 Subject: [PATCH 03/58] Add Barbarian Assault quick-start option to menu entry swapper --- .../plugins/menuentryswapper/MenuEntrySwapperPlugin.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java index 1498df1506..5ab6cb6aca 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java @@ -540,6 +540,10 @@ public class MenuEntrySwapperPlugin extends Plugin { swap("quick-open", option, target, true); } + else if (config.swapQuick() && option.equals("climb-down")) + { + swap("quick-start", option, target, true); + } else if (config.swapAdmire() && option.equals("admire")) { swap("teleport", option, target, true); From b58b683f49fac62763cedc6fae4491c787289926 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Evaldas=20Lavrinovi=C4=8Dius?= Date: Wed, 26 Jun 2019 11:02:01 +0300 Subject: [PATCH 04/58] Fix WC world map icons around Hosidius area (#9205) Fixes #9204 --- .../client/plugins/worldmap/RareTreeLocation.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/RareTreeLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/RareTreeLocation.java index d32dee4c32..843d6eb645 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/RareTreeLocation.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/RareTreeLocation.java @@ -67,6 +67,7 @@ enum RareTreeLocation new WorldPoint(1640, 3496, 0), new WorldPoint(1613, 3494, 0), new WorldPoint(1560, 3636, 0), + new WorldPoint(1646, 3590, 0), // Miscellania new WorldPoint(2550, 3869, 0), @@ -109,9 +110,8 @@ enum RareTreeLocation new WorldPoint(1353, 3731, 0), new WorldPoint(1529, 3452, 0), new WorldPoint(1591, 3421, 0), - new WorldPoint(1647, 3510, 0), - new WorldPoint(1632, 3509, 0), - new WorldPoint(1623, 3512, 0), + new WorldPoint(1647, 3508, 0), + new WorldPoint(1621, 3512, 0), new WorldPoint(1593, 3491, 0), new WorldPoint(1583, 3499, 0), new WorldPoint(1696, 3554, 0), @@ -119,6 +119,9 @@ enum RareTreeLocation new WorldPoint(1625, 3669, 0), new WorldPoint(1642, 3683, 0), new WorldPoint(1642, 3663, 0), + new WorldPoint(1642, 3533, 0), + new WorldPoint(1671, 3657, 0), + new WorldPoint(1680, 3657, 0), // Tirannwn new WorldPoint(2217, 3141, 0), @@ -187,8 +190,10 @@ enum RareTreeLocation new WorldPoint(1389, 3821, 0), new WorldPoint(1610, 3443, 0), new WorldPoint(1578, 3488, 0), - new WorldPoint(1772, 3510, 0), new WorldPoint(1685, 3740, 0), + new WorldPoint(1681, 3689, 0), + new WorldPoint(1751, 3564, 0), + new WorldPoint(1796, 3600, 0), // Misthalin new WorldPoint(3355, 3312, 0), From 473d447ec79dd8350643a574dfb173f97b866cb2 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 26 Jun 2019 16:05:04 -0400 Subject: [PATCH 05/58] Added Larran's chest to loot tracker (#9209) Closes #9177 --- .../client/plugins/loottracker/LootTrackerPlugin.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java index 5429ec5941..00f15a1616 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java @@ -105,9 +105,12 @@ public class LootTrackerPlugin extends Plugin // Chest loot handling private static final String CHEST_LOOTED_MESSAGE = "You find some treasure in the chest!"; + private static final Pattern LARRAN_LOOTED_PATTERN = Pattern.compile("You have opened Larran's (big|small) chest .*"); private static final Map CHEST_EVENT_TYPES = ImmutableMap.of( 5179, "Brimstone Chest", - 11573, "Crystal Chest" + 11573, "Crystal Chest", + 12093, "Larran's big chest", + 13113, "Larran's small chest" ); @Inject @@ -384,7 +387,7 @@ public class LootTrackerPlugin extends Plugin final String message = event.getMessage(); - if (message.equals(CHEST_LOOTED_MESSAGE)) + if (message.equals(CHEST_LOOTED_MESSAGE) || LARRAN_LOOTED_PATTERN.matcher(message).matches()) { final int regionID = client.getLocalPlayer().getWorldLocation().getRegionID(); if (!CHEST_EVENT_TYPES.containsKey(regionID)) From 8d4fff459c3e795d04685ccef11e105a50c0ae1e Mon Sep 17 00:00:00 2001 From: Lotto Date: Wed, 5 Jun 2019 02:49:46 +0200 Subject: [PATCH 06/58] interface styles: add RuneScape cross sprites option --- .../main/java/net/runelite/api/Client.java | 5 ++ .../InterfaceStylesConfig.java | 10 +++ .../InterfaceStylesPlugin.java | 78 ++++++++++++++++++ .../interfacestyles/rs3/cross_sprites/0.png | Bin 0 -> 15717 bytes .../interfacestyles/rs3/cross_sprites/1.png | Bin 0 -> 15729 bytes .../interfacestyles/rs3/cross_sprites/2.png | Bin 0 -> 15819 bytes .../interfacestyles/rs3/cross_sprites/3.png | Bin 0 -> 15896 bytes .../interfacestyles/rs3/cross_sprites/4.png | Bin 0 -> 15689 bytes .../interfacestyles/rs3/cross_sprites/5.png | Bin 0 -> 15691 bytes .../interfacestyles/rs3/cross_sprites/6.png | Bin 0 -> 15701 bytes .../interfacestyles/rs3/cross_sprites/7.png | Bin 0 -> 15684 bytes .../java/net/runelite/rs/api/RSClient.java | 4 + 12 files changed, 97 insertions(+) create mode 100644 runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/0.png create mode 100644 runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/1.png create mode 100644 runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/2.png create mode 100644 runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/3.png create mode 100644 runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/4.png create mode 100644 runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/5.png create mode 100644 runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/6.png create mode 100644 runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/7.png diff --git a/runelite-api/src/main/java/net/runelite/api/Client.java b/runelite-api/src/main/java/net/runelite/api/Client.java index 14f3ff5cb8..de8123b359 100644 --- a/runelite-api/src/main/java/net/runelite/api/Client.java +++ b/runelite-api/src/main/java/net/runelite/api/Client.java @@ -1632,6 +1632,11 @@ public interface Client extends GameEngine */ NodeCache getItemCompositionCache(); + /** + * Returns the array of cross sprites that appear and animate when left-clicking + */ + SpritePixels[] getCrossSprites(); + EnumComposition getEnum(int id); void draw2010Menu(); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesConfig.java index 540186558c..3f64778e52 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesConfig.java @@ -62,4 +62,14 @@ public interface InterfaceStylesConfig extends Config { return false; } + + @ConfigItem( + keyName = "rsCrossSprites", + name = "RuneScape cross sprites", + description = "Replaces left-click cross sprites with the ones in RuneScape" + ) + default boolean rsCrossSprites() + { + return false; + } } \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesPlugin.java index cdadf60320..c635eb9bd5 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesPlugin.java @@ -31,11 +31,13 @@ import java.awt.image.BufferedImage; import javax.inject.Inject; import lombok.extern.slf4j.Slf4j; import net.runelite.api.Client; +import net.runelite.api.GameState; import net.runelite.api.HealthBar; import net.runelite.api.SpriteID; import net.runelite.api.SpritePixels; import net.runelite.api.events.BeforeMenuRender; import net.runelite.api.events.ConfigChanged; +import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.PostHealthBar; import net.runelite.api.events.WidgetPositioned; import net.runelite.api.widgets.Widget; @@ -69,6 +71,8 @@ public class InterfaceStylesPlugin extends Plugin @Inject private SpriteManager spriteManager; + private SpritePixels[] defaultCrossSprites; + @Provides InterfaceStylesConfig provideConfig(ConfigManager configManager) { @@ -89,6 +93,7 @@ public class InterfaceStylesPlugin extends Plugin restoreWidgetDimensions(); removeGameframe(); restoreHealthBars(); + restoreCrossSprites(); }); } @@ -126,6 +131,22 @@ public class InterfaceStylesPlugin extends Plugin } } + @Subscribe + public void onGameStateChanged(GameStateChanged gameStateChanged) + { + if (gameStateChanged.getGameState() != GameState.LOGIN_SCREEN) + { + return; + } + + /* + * The cross sprites aren't loaded yet when the initial config change event is received. + * So run the overriding for cross sprites when we reach the login screen, + * at which point the cross sprites will have been loaded. + */ + overrideCrossSprites(); + } + private void updateAllOverrides() { removeGameframe(); @@ -134,6 +155,7 @@ public class InterfaceStylesPlugin extends Plugin restoreWidgetDimensions(); adjustWidgetDimensions(); overrideHealthBars(); + overrideCrossSprites(); } @Subscribe @@ -283,6 +305,62 @@ public class InterfaceStylesPlugin extends Plugin clientThread.invokeLater(client::resetHealthBarCaches); } + private void overrideCrossSprites() + { + if (config.rsCrossSprites()) + { + // If we've already replaced them, + // we don't need to replace them again + if (defaultCrossSprites != null) + { + return; + } + + SpritePixels[] crossSprites = client.getCrossSprites(); + + if (crossSprites == null) + { + return; + } + + defaultCrossSprites = new SpritePixels[crossSprites.length]; + System.arraycopy(crossSprites, 0, defaultCrossSprites, 0, defaultCrossSprites.length); + + for (int i = 0; i < crossSprites.length; i++) + { + SpritePixels newSprite = getFileSpritePixels("rs3/cross_sprites/" + i + ".png"); + + if (newSprite == null) + { + continue; + } + + crossSprites[i] = newSprite; + } + } + else + { + restoreCrossSprites(); + } + } + + private void restoreCrossSprites() + { + if (defaultCrossSprites == null) + { + return; + } + + SpritePixels[] crossSprites = client.getCrossSprites(); + + if (crossSprites != null && defaultCrossSprites.length == crossSprites.length) + { + System.arraycopy(defaultCrossSprites, 0, crossSprites, 0, defaultCrossSprites.length); + } + + defaultCrossSprites = null; + } + private void restoreWidgetDimensions() { for (WidgetOffset widgetOffset : WidgetOffset.values()) diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/0.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/0.png new file mode 100644 index 0000000000000000000000000000000000000000..b817c474c04ce529e239bb864c3c823625600dca GIT binary patch literal 15717 zcmeI3Ply{;7{Es>i`~-VpF&wC%)DfWCNtBS zNt0a=sy%2yPz1q)BB%(Wh!-z<&|)ii(TfN1B!UOMco0FotZ!zL%;atISlWUpFOWaq z``-6`@B4l4eKT{&_0@Av9-Mz@o?)1SE6cSt^!-5mzJCsVKJxnxKwta)<&BVG4&993 z_q=xU&{2jlpLH7R(R%%?VR_vmu)QWM4!S;?jdZ65KCmvqh;72Q<5mj4efD{Qb?i#v zf>Iai{vzCTmbU|Ve*0X*+P-AzcHvZY-W(XnK^I1V9dtWxXbdWa#IJ#V$HRPqO{PSb zDusnOAiG{)Wf#2wvPx0qEU{E(HN7Y*dRdYmXC*;Yc|qqznG-}q&<#Okhp$3)9{n-{ zyJf7^&J4pLsZ!XCBH!Toe!pMrmx^A{=0#oCc|qbOi9<8EaLbLrfOErRsgseP8Vs$# z@gv7`+1M{=dcCMpD8zxruVG$Ye;mjShwKnVegJ%4EDHQIBikC=_`RT$EX}rf*nwT> zMj^5jr`q|OUgU+F-i(lA^~}JiCiVI__SE%uyHi7l(b5%!V2E_8W!TvAA-@JguNPQw z=?Y5a*tF~;rgx}Xht-)){IubzRyEJ+#oKzpwP1*f5$1}7N|hYk)1W;$I#P6;YT7nz&vI-d3u?7Q z0Cl;og|*F zGv{nqpr--{wR6zP&53idQ7%A$s-|for>kYaK`3jSu9PKC)Krv+CIC?_k8+vfW>=_X zC$9SzR))AX=i%ka(X8%CY;7&6QkL( za5HCjIroMj^`A4J9izVqT~gObT_v+-I|;p3)CU1vXruGAmxh*loixMUPd_DyQF1an z&K(pY1Xu2?3?{5KHWLxDFL6$fmwVIp-T6(DjEd_}3sLZ!f2Gn>3LzE0@+<5=J zGQ_~s=+-81+t9A^qs&GF|E0?9tskZd-(KagOXmNea_LE&?1`g3ySs;)@!gVv`Y-AQ zAnALe$?qD=_Dni|J?^8OUNT=-1@z*@_;YBQSL3D|WYfGFH_a@ccAcmy4WnVhIji`V zF1_D4kDfkYRaKOdV)FPfZn5eNU}wGNp!NSS>3yodz$(yFE^E&Yu64GUk1#l_nw}+ zIC$=R|BDmfKJm%=krQ*PhhIFrbnMpt>p#7F_Hyg(`}WN-_B$WEaNzSdkDzGG%F?;o JN2f17{|_DZ1xWw^ literal 0 HcmV?d00001 diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/1.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/1.png new file mode 100644 index 0000000000000000000000000000000000000000..a6add2616dc8bf19a883048ea72f95258e1beedc GIT binary patch literal 15729 zcmeI3O^6&t6o6YJYqBIEO2FU`HnYSZVo(3iOgA%=Y<4#8f)kg`YIeOOHPzL#ZDzXL z?w+051xYj@21F#FD4r#^oIC_Pgh+Dprl5Eb!IM$&;6*R4)zkCSQ#(^Ei6BZf%yhqc z_1>%cUe)XFLtj}s{o;Y?$EP`tJFvJ=S;pr>@o(=G{(t)SZGcbv{DrlU;||`Ae-C_k z?BEj|SA5f1S&de!FPYG5W`X6^P`1W*8={PxAo4DVQ_%vrrE zRsA`%?ksEt=*-sX6}WW)8dm0bdAis!v4bXx0N-gg+|cZlGF`tWzK)y44Bzb%T_|N{ ztatoB(CDz~_yutQ!SIdx2LZIVVbnC~JZwo04HlGT%EgitTng+g7t)P#0yxFhofa6-B^3gmBZ1Ku2)HnZ!xoPX&cAaQw*e zTt4;-YF;ZUWioM~!O@#n(;ozK!yY?KQS1O;l(UjJ&d7oT8^0Aaxn~6-HW_%-J1|{pq>~Q=cHO4#2!1|W^-)lFq+@M2zp4zT81l|J`$Hv=(Pff<~Q(E zX2#7va_nJpMm)uuiDO3{XM$O*NzA%SA<0k?&()j@5Qw~B#q%2FWR)%T5%P0$@v6%6 z&z*H#%WH?v7e&%!nD3!CQ~?nxV@pGja)P9-D5@zJOkFxADW)W)oFqL7A63tC?9EXh z`U+mtvS#Y}w2xFz(g)r@7Kp&Eyrlc4{8-Smy`TxAveN{0B>HZ>C=MG_JqN4Gobwu9 zfQN<3YEc~5Jl3k>!B)JiXI+RwoQyD)B%G@5#ytt@qpf{K!zm|a!}6eGnZuyamH{#} zRVd_TU65sD2nMpC0CN!P(8>cvs};p~^I{jnam9YSt)mgs)1i$wUIx{wx#)%wz|&c* zlyO7W!6Vaw4WWjRP%GGZ!N_TfP{qsfo zYBGJ|$v9Kab_9AkaBw*XjZ~j_E*74PhUA(8bE=@p$QBG$s|f{320}r#Gzm%uuywt= z&hcEvxY-eE!HM&}Nu(jp%^CE@XzMWV-NNgGAVhIlDP{U~Wl*Vc*TGTjmM0UyxMY`M zyz7xw6h~Tz!y?U`o$1^ig2aEyd~%HTI&x`MBXQO3HQ7n%*-;w=Xts{`({2h{;&s%F zbU%KVU`E}Y*>LV75h2*Pzche?1#C^O394iPA#Z8A0JMT4KsBGYRof~k7VM|_9@2md zuVl)qsSb+wzn6v>coH411GkQ>ve=(lzu~`>x!u*nWWx8BIpUW2Kge9N6Gv-ezs~Ng zp~d)VDXzb`7JzQulZ)bxw&9vd`me@yw9)GJH*yj_L^=NNnWojG=^EWMttL%}man)@ zR91S?h~|`4{79EPZ=AtzAE=zubrs)p$Y#=F$?2fRYQ@3N8)1AWkaIm7QZd$WZIWS1 z(KAd^m3mL;-o}zv{1$>=fW*NY(2hIY;QsSZUJPgSPkJSMu^Ld$RwKTdbp=G!TAas%8qVplN3>N`} zE;3wnK7^LxB7o3EhKtUJ&@x;E5W2{4(fJTshKm3~7a1-(A41D;5kTl7!$s#qXc;a7 z2wh~j=zIt*!$kn0iwqZ?520na2q1Kk;iB^)vIv+yIa1lW0BEv=JLueT;0tj8C;+h_QQ;b~vA#odjF+6YH zJ&3u~UJ74_ZwzD_eI`Zgu z`)^&Fy7pkS$6vej^_3g@Pqd%<;m|Xu-hXT9^GCk?M!%F1mkz&scz)*2zALXUe)8*A d6=!2=KX>aUd={NMdICr07Uxe_uAe;r_TPdo2FU;b literal 0 HcmV?d00001 diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/2.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/2.png new file mode 100644 index 0000000000000000000000000000000000000000..015b85e5a0ea4be8083f5c65d9ed379a045694bb GIT binary patch literal 15819 zcmeI3&5zqe6u`}g+Oo7&)k;tmP_0x*t%_qiwv*UOvfABj*_B9HZ9}`|0G-&AthI@4 zY-f|*OM!|?tvFPb_!5_15aQAUCn^q5sqhCNAqpoXxImFW;sP94#&!}rlVn(E4+u@9 ze7t${-kbTo=Qs8tmzGXGy=Uss6vHrk78lCP=zCxA-n9dL9{zO;ps$CVg|i;R?7bDd z?|b9;-p3fGaNDe|_$!rXG~I5cfnnERy4!NlY^0m+IzV58K3jtg(<-KZ{`iv=YZ}GW z8KojroH@8^E^NB+)aJ>mzPYBWMryh=Rp@HSK@0kT?Y5ehr*(^|(65Gm2g7`d4X5~P z#nem?kX@-Pv2(TyStXt2bWzH)IW;XRYCa=B#byLC%L^(m%A6o-f~pB3+k2%-Q|MR0 zHR{@O`9v=ql8UKS-*+^g?{qrpj+D0D1~00r$_p7jli|<|&fBnj(B&-eNaUpNrwl#a zH67oyEjI8AYIfT%rcyzm!K=5gmNN)sc|CTBBHslLFQx^4oROgqY@D{+43}o;JZ!=i zw0sZQiDT`YRol0{ReM6nfqG(Kl#@zj5PR%;TdlF7J%4^3A?P6;Yw1-t9LO(2&u+Uq zoL@&< zoZYltv@BSX3jDa?u~ubUZwF;PW9iUC$?y_MLa7Qb+*!~V9_=fdW+`eLhOL{176;Yq zB7mwaarvC6aH0rRPKAcf=~-P@bR!2ca;?Az7cX)Vud7!Zz47s`>k7=|Yc=toyN&`5 zZzf5Kgd(W0N<~|=JRcxZi{%m;NSkQWVjT*o{mC2vvcbtUS>S3AN}MDMl9U5#R#fz` z?1s(bP4`^)qa)YjH?Asb#xM+(yzywA31=gLo^?%hQh;V+POujP?FHm(0@URk2c^8q zLNvh~P3QIyjF?Z3(OHESsUbzK!da7@ zcy`_I02j_Q(51SaUKx2EHpAWj-353TiSWSs-K9Z=*?LxyM9z>=0}%vSA|!bGRq=`|M~BEd)1W8tT8O7l5$ui3NUSEUuYo z{z}kCo9%GEnibHC7lY59X;O`wo+XVor!L$??281jUaZSa4SB4h)k8%h78Tr#2Z(T=!WM=h+Kl_NV@59%w-1+5? z15fA=AKo$h%KTC1gEeOUg={&ZRGY+I^7u{?O^2r$0Y@2?b^r M=TDZe&z^hrFCj}I8~^|S literal 0 HcmV?d00001 diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/3.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/3.png new file mode 100644 index 0000000000000000000000000000000000000000..e62c91b16c78c4fdc4d2c8218852925f6a6b35b4 GIT binary patch literal 15896 zcmeI3Ply{;7{Es=wXSUOP_$amA*Euellec%3`xrFrgaxgUAB>Kq0qj}d&!PXW~MW< zO?DBiRjYy*g+h+$=( z%ZGOFje!_HceBM6j4zGJVOXK+z508H{72%>H8_8&<-3w zay*xh{eqge9u+g0IMCqL+gHmU1aiY3J4{jR0AG}|k~ql-+5;PZJ!p2925k{FQ46_I zi0$NwcK(_ddEuHjCFDRoH89Rer80;;alNh9#L!`MGJjI%+YeyYtidn2l%(|tJWT=4mYApl^L|#z!yk;q>vgJNPeqkZ5 zsvQ6H3CD$AJ3LqrNt0o|hu%;bM5u%iHFZ;g z5Sl_hC+mVNBU3ODv<2I+ZQX`BplG#%82@;&i{ZL@wb2`&?Aor&0GXQlFSxGjNXge~ z^51uz>}8ZwItet&aq(6v){+}W04HIoT*3oc2lG@gH@%LaVA`f3Xqtwv|yT8w>P&;NU|DG*ffpy+FJd&8R76 z&Q=6NRZYRb%NOz*)C7oB4L}v<>In4rGQrJQs6{8P){W8P=~nA;bZ&HXSgqaT!UsW! z;$~RP^t<8Ud`SwhSBBlDY5_YwXi9e6s}L-RBcsD*4J-@E1ZO;*+e0vBK0QWz4Y{;l zm$>TAn(id@>QNg6Xs&^~z;@bj;&s%FbpKbs?Yl@s2+rSK8Vm^m3FQnySCE4154RFi zlk0*}134Q?xw@fh{WPbtNNzE%subYCk%Ny5$&xiomios@BKU)&2ox9`aX zacpc@Gs*nbxQ{m1yYo#$!Y@&dKYONWHEDX1Zkkq;rbEjYTqi0iy=cU6$}0XNn*2*T zj_;XJ$N`}E;3wnK7^LxB7o3EhKtUJ z&@x;E5W2{4(fJTshKm3~7a1-(A41D;5kTl7!$s#qXc;a72wh~j=zIt*!$kn0iwqZ? z520na2q1Kk;iB^)v zIv+yIa1lW0BEv=JLueT;0tj7XxafQcEyG0sp^FR`oe!a9xCkJ0k>R5AA+!t^0fa6x zTy#E!mf<3R&_#xe&WF%4Tm%rhNX0cXd=eVD`0?j9e$M&!jo+`~XQX+1aizj>n+G`V z!mAv2XA6J-#Bu8q$NhYU|#Z|J^S8Q5AAs%bMyUoetE5YZsm!OzuUE!`|QS>w?4SO?`s^2TRL*A{L%cGi+=*y CQ#i%| literal 0 HcmV?d00001 diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/4.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/4.png new file mode 100644 index 0000000000000000000000000000000000000000..695cc03088eeab56a7bee600787fed85b0640821 GIT binary patch literal 15689 zcmeI3&5zqe6u{kXSzy&xy;0f&Zc0T_>)4L-Wh+U$-E6xnk+R(`>Xr)~+mpoI#5T6K z$*wrGaN>#pRpr1R0OEjLlS16sy*KAe|iw6v8FXuQfMZ{EE3 zW`1wxjeYRjD;F;um^(7ZaomCBrRpmAJ`{eQnkE0A`+WzIuczImt3Jma{3iVDdGFN0 zqa0U4*4lcoUVBM1oOT+Sj*ipawo7^w-I=b7j13&{I&N5YIrZz8U!{1$Mer!SOJkOXmecR*HNV1kywBx9k9Q1=~L!JL&tWV&CvAH?SO= z5B(zD*$m35R2XP*_2$)f2Z3zA$Bs}GyT}#gv?NY4GL3o*3E>7H<#)J){#Y{k1I@i>ugoHa!C`-XK#s zK56!WRUam2#8ar5I(FQ(rkI7A*eqHKafV7{uG)f!QQ&xMj?=2dt8Ar@kY88`S5<*O zdBw6#r{lj^5~0a3-$QS>iUM3AmZ~7-1u3@{u17^v3a6xuCP@h=aZli*=9pG}Ys`nD zNd>a3lRgqXp%1cuOcbD9c}ez7_%RKw?s#n!RID~?V9~W3C2`o8=s8$b+Je(^JTfd? zQA*;Z=80BS$Jh*)^}KChpCrRiB#ERd+PLRXW3;ueXjv7Kl(cD?nyIT;sTXuXmsLej za5gWXtZoX$dOa%@idjR!g_0Oc0y`VIf3%fg|}_-J;i16gn=vhTu#ZAMA!^1R;(^=tye8_PvM6rft>HzK*dDE ztJ4eHKEbd1HVu3>Tdb&@x;A2wh~j=zM^d;Q~PDBEv=J1GEem z074fTE;=8eWw-zky2xR5A0a}I& z0HKQv7o88#GF$)%U1YfEe1MkW0zl{@!$s!Iv=2AxBw8k$Z*m504>7> zfY3#Ti_QmV87=^XE;3wnK0wQG0U&gd;iB^aT80Y%p^H>pbHn$Bu}xkU?vS^FKmS%1 z$Q#AHv9wy_xa|`hck?Zd`*VkU|IBfl636{=jpMZ29QTa#&TIG2lfL?Lb$+e;z5d6} z&Y77Lw{KmaUBB+i1$n_Q$(l>_01; z_hyzqZoPqSes`#K=fShTeW=fze6aWat)(BD&%bc&();f|dAhK7mOJ{{k?q4zTzHj4 P zJ56@g11&w!QxW3pz#o8wgb)%Z4zv;+IB@F)BqYQI0S6>FfrQG~&WAHeMoU`>fyPok z-n@D5&HUcX8~fnvtEZovpF1?iFwFeQa%~O$J{EuWJdD1d{QV9e>tK<^D8u}kM^Eo!@5?!d| z7UF>HMtzlC^a98#`66eEQkgBOc~Mcz1^F0T5X2%csJtk1f~X0qCWvhR%2nskKRvK) zZLM~)9}Y>C+-4N{8qasT-F#QddqI;IRaNDM0$(U_s0SBrxe@4bZg@C#GVoJ_p&2-S z%%P3n30ld}ER%;V*oJNt zB0F)aoxkZtUbyMa2su>G42*J8uMcBS9dElmHFOv)T|x-@NT*tcjV&MYYcTXWfeDu` zp{X36Hv7o2N68uU6l-RV9rm0VX0awUOO`^KAsx+CTMQtGyrAKEt!lc;RtE^##l?74 zmDnR^9M|%?;WIjqn~d^3@&;=lf>mUxazc?4lt#QBB~6x(3I$CNGEUN-n2)+=Iri3s z4@nbBnlR=g(-ZfB_KyW3up=+oz8OE3so7r822s^%gC^vCx2f}^#!S!Qs?rv{mKUI5 z!K$S5)0(GR)jYEkFY5)@gds{sm`M^!RkCqUfaZAXK+$rlC@Fc%u{6t2p=6f~&Jb0J zlb~GWfNWS?*|ue&RF+K%mUKSeuE=OKlGszyIvyiC0n!NL#MkTEiW^1%O<<*#jK@La zfj|_BWm`eZKu|at$bd7-io_|B1Xa<5iXs)0)i7>88d=}&3Em&ovjOJF7 zxe}TtrwTyeM9EOgielTQZ46vz%qLvG5ICr0gI1=`faX65F~!Y9sAVV4?G^?;&c-^t zINmzSZBkr)5QH!;9hKamb_}aA>N>piqy%ZejLUM>jCVG)bbhRLG%VcAnM~l$5TyPy z=CfmTH=#?a45_Q6*K8-DXGdKSz=bB-Gdn3-sn>Bc-2L=@ffyybujSlBB0_NK-qN5N zA}H9F$O&rMY@-O;82}`rk`K3_Oi)ZUVOnttvm5 z*`VRSl)0T%z;wcQmpSZM{2yd4-HGEhaZt)9Yp5RI5oxIYqFMlwx+m)VMB8Z1r2RMI zI@;auC#s@7n+z0d&RE5_ZRtJ5I(ou@)gn4E z6`jYMaf?-_2U{C82i;SI@kt<}Q#P@|6;ln*&N9p>`i5z$GS33ZF_yNXCk^zF!w;Ww zCQi8F`Ex)2jAnE{y<)y-5DW-eq`1g@FfGM}0U?VN7nu*HrMNI4WRc<`^TD(f7Y2kZ zQe0#{n3m$gfRIIsi_8bpQd}4ivPf}}`CwX#3j;zHDK0V}OiOWLK*%D+MdpKPDJ~2M zS){ngd@wD=g#jUp6c?Efrlq(rAY_r^BJ;tt6c+}BEK*!#KA4u`!hn!Pii^w#(^6a* z5VA;dk@;X+iVFim7AY<=A52SeVL-?t#YN_WX(=uY2w9}K$b2v@#f1SOixd}`52mHK zFd$@+;v)0Gv=kQxge($q&5hn0hAw(pxQpHj{tgt2=#665Twbd)%=Xg^^Xh91^T!?Z z`xC=-1cv$fJi}=3G0fxMo3DI%67{uKY733tx5me}zmGqE-ne#f&-wkIKJw0?b9a99 zKe;9DS`=;@dwvjif2i%hKL6-b7Y|-tpI>t7Q~P1_CL_H3Y(vt)4HS=ASvp<&=*0P}e*pO!hE;wquxk&wCe-w9E?~Kt~qWw_s5stIC9rQ5lqmFZH~Kn~h40&KV4azmqA&Lw^gbR9SIIX3AMoh#>N z z*N*qXA*q~eMv-sue5cdNcci=*tns3*>%36l3k44K;KEHe0$t7x52sH0erhnZ0>_UW z&t+r3!1UImaxNDK8XUcOwf#XLH|()P6!|Xjc`+~WAn#lseCLpKVM zojBIcZ+ejzHoXZU2kMD|QBLahLF}>PZMVmU4x_mZgrJ9XtYx^e=|g@QhTeK$!MP1I zmBZs^A32R-az;GGnu%kFU1x$>tVzw1rI2Q*gyw2g0|+87Sn<48C0%7peS~ba8n3D% z`@|{7wY^UGWQoU3hWQ?PgEbJr3bNEWLFEKxC0>uRA*e@$f*}YQCuvX2N8PiX#^yF3 z5^`WDde%p#C+-979~(qqM_#ghGk$E#Xm~*zL=~qE)*$b@YbAcznCUrKRYuioc>x+0 ztVkt(T=Q6~nrE%Y%X-$eV2F|tW|D+bm2BK&U~ROuuV^_Hl$5;f*oJNDP-+xS&J=Zt zlc20}KsIeoYcyn`sL7TDizPnZuE=OOlGszyIvOK80n!NL#MkS_f*VEvO<kf24N$Z-wICGiWHpSM4@cH>-H+aL9Zyx(G*gvTjgvH` zz(GmY(4-}WlSIK%HAw|U*yy{?m~V6aT;QOR4O*E#eVYFy#27c*Ld`pIZZ|RTaW+oE zmquHMxlM|z4}uWJrK6nd*N#CoMqLL-DJek)u;Q{@vErQ#5#W*5;jnNsXG{WjL^<`J zF`pcx(}XUmGNi7OUXz`KUL)#&0M4$VJ+qUdm3kdD!`+YH7l=`^`&!OzBq9VGx0eRV zv@H_=le28S$SJ05a=HpsPEr~o)CAjBbhV%6TTVmKD2V;y`tPM72A)Q@n!sIyc7^ZH ztl#io%G}N>U^?Mj%N%xF{2yd4-HD?$v0uu!*U(b@L}Z})i)sN#>YiBQx3vw|Oxk}n zuA{B>q`$5T=-|cpzh|0NwCIHNo174t=dU_i(s#YN_WX(=uY2w9}K$b2v@#f1SOixd}`52mHKFd$@+ z;v)0Gv=kQxge+2AWImXd;=+KCMT(2e2h&nq7!a~Zagq68T8aw;LKZ15G9OG!abZBn zBE?1KgJ~%)3Vor!L$??281k9Tx33&mg2&I zkVT4%%m>p_To@3tNO6(*U|Na`140%lE;1iXOL1X9$Rfo>=7VV|E({1+q`1g@FfGM} z0U?VN7nu*HrMNI4WRZw#didQibkWDc9rRW3%=LpGp)ZPAYks-TFk6o^%*(GZ%wIRr z`5MEl3k>u7S%xv*XPEoFcV4`59QAbni>g<8fXWlz>=H_qy zXWxpus>0Rpb{9);KW0yzdHCb|t}xNX#?+#s-MhcQ=rjI}OAqK@J$kYF(A-<+UvGZ@ z<|i)m^<8s6-E&}fZtmy#7mi)neC@`<2Os`eJF&56hB@)YzNZgg`|~`C%q+|;);>LU G_QKysfA?ts literal 0 HcmV?d00001 diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/7.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/7.png new file mode 100644 index 0000000000000000000000000000000000000000..c17114ae828d3f89b6b216099a54c12ce1abad53 GIT binary patch literal 15684 zcmeI3O^n+_6o9>gqOxi$Zis@wN+~KTj>qv&Vk=3t-E7%KWC`1?x|Kk5Y>yMu#16K% z$?l1^5)wCr09AquTq|+p!T~Da!ig)KsF0B0!T}+{DU9v>IFn?ww3QHOEG71vH}Acf z@69~h2fy9eeE#V2@nw$Vj&7{iw($9p_;>gr{QuPN1Bg!#ch@h49Cz&N__y@_>0^&` zTp7CCJJC-4MZ@wtd1(74%J(~6+#Bo8^t;fyf+F5TP1mdBe*6539Piqd+(oqx>fKe; za@Y3*bbfzx+uFZk>2~f+b-CO(u!9bYAm8t_z0l}aa*1C9U&qa2j!(KoS1P%cI3T}M zZ}6*rfOs{p36><6_@bVdRJ~MCp5qHZ(nO$(k|F@f0J;Gret6`n%lN7s*p9JPJ2wo6 zrAn?9MO{M_d%a%1C+Gd3DN4Goi=ZGD3IgsSgnM2D`+^sqNS%!Q)KF*zZZ~p$kB|LA z)8CCMxm+A*d<^H+>5c<=;gB7sDE47jl=48FXJlJro9=GVPKIV%B5I=!@}dyiNptPG zEkE+ZmcJn6SiLYX&PlyKjy-q0ozC3QVYGG?BN!r`YZ-3ub&b~tddow;{189aS zXMJRPl0NYMv0(%cb9rssH78LNKV5Ad*1RW6J3 zn&(>8d}}ve)+?TcLY#~+lO&v~WaFNN&FR*WqU~03Qu4NI8@8z<*(sWWDe1BxBSjOS zV%kEf2xPB>camj}5OrH_We-dJjo0(ASZk*da0(_i}^XQG~)=6%Y z;@X8lh~m;w$&G5qxEkZGHLssD`m;uyUa z@@SPIb(Qp5>?HJ^s0RbI(!_h_AVn+nI&DU}pT93Kqh$BB-Frwx2(R8-8dL~%$CP!! zv2{~`mSPJ!k`UhEvIbOHl7VWD(tOux&(xTz^ zQG2K6;%AC5z7t5=(1ujZHN3RQFrye6rm4!j3naI(v=zT;;Flb6{FXCwha2C2?&rm1 zM)%Vz;fnLd$RwKTdbp=G!TAas%8qVplN3>N`}E;3wnK7^LxB7o3EhKtUJ&@x;E z5W2{4(fJTshKm3~7a1-(A41D;5kTl7!$s#qXc;a72wh~j=zIt*!$kn0iwqZ?520na z2q1Kk;iB^)vIv+yI za1lW0A{E#2Yj zGj4L+qyD?EeRB@?eRZR@vfcl|{Btlk^T5fQcLsyOkq?f)68{Dt-@L}Xb!%1oaqz_E zXM?cx{o%*1e{$^BQvb;9#*I6N%%flae8~K2Y3<1mm!7@@U+31Yt-q{nee}+$&2QgB d&%6LGb3e5j5B_nXf#Y!8#@c4>)3cYa{|(ic^*I0l literal 0 HcmV?d00001 diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java b/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java index a620f4d539..e4833e1830 100644 --- a/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java +++ b/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java @@ -1009,4 +1009,8 @@ public interface RSClient extends RSGameEngine, Client @Import("viewportWalking") void setViewportWalking(boolean viewportWalking); + + @Import("crossSprites") + @Override + RSSpritePixels[] getCrossSprites(); } From 5025b6d5afad6f5ca7b0f2b9c8cd837ef21f6b38 Mon Sep 17 00:00:00 2001 From: William Collishaw Date: Thu, 27 Jun 2019 01:27:56 -0600 Subject: [PATCH 07/58] Replace use of deprecated Guava Files write method --- cache/src/test/java/net/runelite/cache/AreaDumper.java | 2 +- cache/src/test/java/net/runelite/cache/EnumDumperTest.java | 2 +- cache/src/test/java/net/runelite/cache/FrameDumper.java | 2 +- cache/src/test/java/net/runelite/cache/FramemapDumper.java | 2 +- cache/src/test/java/net/runelite/cache/InventoryDumper.java | 2 +- cache/src/test/java/net/runelite/cache/KitDumperTest.java | 2 +- cache/src/test/java/net/runelite/cache/OverlayDumper.java | 2 +- cache/src/test/java/net/runelite/cache/SequenceDumper.java | 2 +- .../test/java/net/runelite/cache/SoundEffectsDumperTest.java | 2 +- cache/src/test/java/net/runelite/cache/StructManagerTest.java | 2 +- cache/src/test/java/net/runelite/cache/TextureDumper.java | 2 +- cache/src/test/java/net/runelite/cache/UnderlayDumper.java | 2 +- cache/src/test/java/net/runelite/cache/VarbitDumper.java | 2 +- cache/src/test/java/net/runelite/cache/WorldMapDumperTest.java | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) diff --git a/cache/src/test/java/net/runelite/cache/AreaDumper.java b/cache/src/test/java/net/runelite/cache/AreaDumper.java index b789d78a0d..2aab1db48b 100644 --- a/cache/src/test/java/net/runelite/cache/AreaDumper.java +++ b/cache/src/test/java/net/runelite/cache/AreaDumper.java @@ -64,7 +64,7 @@ public class AreaDumper for (AreaDefinition area : areaManager.getAreas()) { - Files.write(gson.toJson(area), new File(outDir, area.id + ".json"), Charset.defaultCharset()); + Files.asCharSink(new File(outDir, area.id + ".json"), Charset.defaultCharset()).write(gson.toJson(area)); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/EnumDumperTest.java b/cache/src/test/java/net/runelite/cache/EnumDumperTest.java index a094b9fc24..705356b0b5 100644 --- a/cache/src/test/java/net/runelite/cache/EnumDumperTest.java +++ b/cache/src/test/java/net/runelite/cache/EnumDumperTest.java @@ -80,7 +80,7 @@ public class EnumDumperTest if (def != null) { - Files.write(gson.toJson(def), new File(dumpDir, file.getFileId() + ".json"), Charset.defaultCharset()); + Files.asCharSink(new File(dumpDir, file.getFileId() + ".json"), Charset.defaultCharset()).write(gson.toJson(def)); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/FrameDumper.java b/cache/src/test/java/net/runelite/cache/FrameDumper.java index 2bd7e2ca17..8e856cd2f8 100644 --- a/cache/src/test/java/net/runelite/cache/FrameDumper.java +++ b/cache/src/test/java/net/runelite/cache/FrameDumper.java @@ -101,7 +101,7 @@ public class FrameDumper frames.add(frame); } - Files.write(gson.toJson(frames), new File(outDir, archive.getArchiveId() + ".json"), Charset.defaultCharset()); + Files.asCharSink(new File(outDir, archive.getArchiveId() + ".json"), Charset.defaultCharset()).write(gson.toJson(frames)); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/FramemapDumper.java b/cache/src/test/java/net/runelite/cache/FramemapDumper.java index 4513bf3dfb..f95e92c9fa 100644 --- a/cache/src/test/java/net/runelite/cache/FramemapDumper.java +++ b/cache/src/test/java/net/runelite/cache/FramemapDumper.java @@ -74,7 +74,7 @@ public class FramemapDumper FramemapLoader loader = new FramemapLoader(); FramemapDefinition framemap = loader.load(0, contents); - Files.write(gson.toJson(framemap), new File(outDir, archive.getArchiveId() + ".json"), Charset.defaultCharset()); + Files.asCharSink(new File(outDir, archive.getArchiveId() + ".json"), Charset.defaultCharset()).write(gson.toJson(framemap)); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/InventoryDumper.java b/cache/src/test/java/net/runelite/cache/InventoryDumper.java index 4caf464141..f74c4ce188 100644 --- a/cache/src/test/java/net/runelite/cache/InventoryDumper.java +++ b/cache/src/test/java/net/runelite/cache/InventoryDumper.java @@ -77,7 +77,7 @@ public class InventoryDumper InventoryLoader loader = new InventoryLoader(); InventoryDefinition inv = loader.load(file.getFileId(), file.getContents()); - Files.write(gson.toJson(inv), new File(outDir, inv.id + ".json"), Charset.defaultCharset()); + Files.asCharSink(new File(outDir, inv.id + ".json"), Charset.defaultCharset()).write(gson.toJson(inv)); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/KitDumperTest.java b/cache/src/test/java/net/runelite/cache/KitDumperTest.java index 286ca6ea8e..4db1267506 100644 --- a/cache/src/test/java/net/runelite/cache/KitDumperTest.java +++ b/cache/src/test/java/net/runelite/cache/KitDumperTest.java @@ -78,7 +78,7 @@ public class KitDumperTest KitDefinition def = loader.load(file.getFileId(), b); - Files.write(gson.toJson(def), new File(dumpDir, file.getFileId() + ".json"), Charset.defaultCharset()); + Files.asCharSink(new File(dumpDir, file.getFileId() + ".json"), Charset.defaultCharset()).write(gson.toJson(def)); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/OverlayDumper.java b/cache/src/test/java/net/runelite/cache/OverlayDumper.java index 4ac4b53a7c..51457192b7 100644 --- a/cache/src/test/java/net/runelite/cache/OverlayDumper.java +++ b/cache/src/test/java/net/runelite/cache/OverlayDumper.java @@ -77,7 +77,7 @@ public class OverlayDumper OverlayLoader loader = new OverlayLoader(); OverlayDefinition overlay = loader.load(file.getFileId(), file.getContents()); - Files.write(gson.toJson(overlay), new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()); + Files.asCharSink(new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()).write(gson.toJson(overlay)); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/SequenceDumper.java b/cache/src/test/java/net/runelite/cache/SequenceDumper.java index 94dd175bbb..485bd3d84f 100644 --- a/cache/src/test/java/net/runelite/cache/SequenceDumper.java +++ b/cache/src/test/java/net/runelite/cache/SequenceDumper.java @@ -77,7 +77,7 @@ public class SequenceDumper SequenceLoader loader = new SequenceLoader(); SequenceDefinition seq = loader.load(file.getFileId(), file.getContents()); - Files.write(gson.toJson(seq), new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()); + Files.asCharSink(new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()).write(gson.toJson(seq)); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/SoundEffectsDumperTest.java b/cache/src/test/java/net/runelite/cache/SoundEffectsDumperTest.java index c2a420c0de..5ac0c9e1c5 100644 --- a/cache/src/test/java/net/runelite/cache/SoundEffectsDumperTest.java +++ b/cache/src/test/java/net/runelite/cache/SoundEffectsDumperTest.java @@ -71,7 +71,7 @@ public class SoundEffectsDumperTest SoundEffectLoader soundEffectLoader = new SoundEffectLoader(); SoundEffectDefinition soundEffect = soundEffectLoader.load(contents); - Files.write(gson.toJson(soundEffect), new File(dumpDir, archive.getArchiveId() + ".json"), Charset.defaultCharset()); + Files.asCharSink(new File(dumpDir, archive.getArchiveId() + ".json"), Charset.defaultCharset()).write(gson.toJson(soundEffect)); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/StructManagerTest.java b/cache/src/test/java/net/runelite/cache/StructManagerTest.java index 470df61bc0..f1a1fb22ca 100644 --- a/cache/src/test/java/net/runelite/cache/StructManagerTest.java +++ b/cache/src/test/java/net/runelite/cache/StructManagerTest.java @@ -64,7 +64,7 @@ public class StructManagerTest { StructDefinition def = struct.getValue(); - Files.write(gson.toJson(def), new File(dumpDir, struct.getKey() + ".json"), Charset.defaultCharset()); + Files.asCharSink(new File(dumpDir, struct.getKey() + ".json"), Charset.defaultCharset()).write(gson.toJson(def)); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/TextureDumper.java b/cache/src/test/java/net/runelite/cache/TextureDumper.java index cdcdbd9f6a..0aba683504 100644 --- a/cache/src/test/java/net/runelite/cache/TextureDumper.java +++ b/cache/src/test/java/net/runelite/cache/TextureDumper.java @@ -64,7 +64,7 @@ public class TextureDumper for (TextureDefinition texture : tm.getTextures()) { - Files.write(gson.toJson(texture), new File(outDir, texture.getId() + ".json"), Charset.defaultCharset()); + Files.asCharSink(new File(outDir, texture.getId() + ".json"), Charset.defaultCharset()).write(gson.toJson(texture)); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/UnderlayDumper.java b/cache/src/test/java/net/runelite/cache/UnderlayDumper.java index db735d40cf..04f2997530 100644 --- a/cache/src/test/java/net/runelite/cache/UnderlayDumper.java +++ b/cache/src/test/java/net/runelite/cache/UnderlayDumper.java @@ -77,7 +77,7 @@ public class UnderlayDumper UnderlayLoader loader = new UnderlayLoader(); UnderlayDefinition underlay = loader.load(file.getFileId(), file.getContents()); - Files.write(gson.toJson(underlay), new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()); + Files.asCharSink(new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()).write(gson.toJson(underlay)); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/VarbitDumper.java b/cache/src/test/java/net/runelite/cache/VarbitDumper.java index 5f75c7a157..9bcdcf9237 100644 --- a/cache/src/test/java/net/runelite/cache/VarbitDumper.java +++ b/cache/src/test/java/net/runelite/cache/VarbitDumper.java @@ -77,7 +77,7 @@ public class VarbitDumper VarbitLoader loader = new VarbitLoader(); VarbitDefinition varbit = loader.load(file.getFileId(), file.getContents()); - Files.write(gson.toJson(varbit), new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()); + Files.asCharSink(new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()).write(gson.toJson(varbit)); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/WorldMapDumperTest.java b/cache/src/test/java/net/runelite/cache/WorldMapDumperTest.java index 8d8dd956c4..92b2582a91 100644 --- a/cache/src/test/java/net/runelite/cache/WorldMapDumperTest.java +++ b/cache/src/test/java/net/runelite/cache/WorldMapDumperTest.java @@ -77,7 +77,7 @@ public class WorldMapDumperTest WorldMapLoader loader = new WorldMapLoader(); WorldMapDefinition def = loader.load(file.getContents(), file.getFileId()); - Files.write(gson.toJson(def), new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()); + Files.asCharSink(new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()).write(gson.toJson(def)); ++count; } } From 6e1a7d74cc0c1da4bb19d5f918de83481f19d76c Mon Sep 17 00:00:00 2001 From: winterdaze <35933468+winterdaze-rs@users.noreply.github.com> Date: Thu, 27 Jun 2019 08:43:48 -0500 Subject: [PATCH 08/58] Add tooltips to DevTools buttons (#9224) --- .../net/runelite/client/plugins/devtools/DevToolsButton.java | 1 + 1 file changed, 1 insertion(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsButton.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsButton.java index 52de0309a9..e21af75f5a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsButton.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsButton.java @@ -37,6 +37,7 @@ class DevToolsButton extends JButton { super(title); addActionListener((ev) -> setActive(!active)); + this.setToolTipText(title); } void setActive(boolean active) From 8757d25bd3f3d88e634542396e557ca5199b3de5 Mon Sep 17 00:00:00 2001 From: Jacob McElroy Date: Thu, 27 Jun 2019 08:50:32 -0400 Subject: [PATCH 09/58] chat commands: add ba high gamble command --- .../runelite/http/api/chat/ChatClient.java | 42 +++++++++++ .../http/service/chat/ChatController.java | 22 ++++++ .../http/service/chat/ChatService.java | 18 +++++ .../main/java/net/runelite/api/Varbits.java | 1 + .../chatcommands/ChatCommandsConfig.java | 11 +++ .../chatcommands/ChatCommandsPlugin.java | 72 +++++++++++++++++++ 6 files changed, 166 insertions(+) diff --git a/http-api/src/main/java/net/runelite/http/api/chat/ChatClient.java b/http-api/src/main/java/net/runelite/http/api/chat/ChatClient.java index 1de7d524f1..2ab1d0c8ed 100644 --- a/http-api/src/main/java/net/runelite/http/api/chat/ChatClient.java +++ b/http-api/src/main/java/net/runelite/http/api/chat/ChatClient.java @@ -216,4 +216,46 @@ public class ChatClient return Integer.parseInt(response.body().string()); } } + + public boolean submitGc(String username, int gc) throws IOException + { + HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() + .addPathSegment("chat") + .addPathSegment("gc") + .addQueryParameter("name", username) + .addQueryParameter("gc", Integer.toString(gc)) + .build(); + + Request request = new Request.Builder() + .post(RequestBody.create(null, new byte[0])) + .url(url) + .build(); + + try (Response response = RuneLiteAPI.CLIENT.newCall(request).execute()) + { + return response.isSuccessful(); + } + } + + public int getGc(String username) throws IOException + { + HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() + .addPathSegment("chat") + .addPathSegment("gc") + .addQueryParameter("name", username) + .build(); + + Request request = new Request.Builder() + .url(url) + .build(); + + try (Response response = RuneLiteAPI.CLIENT.newCall(request).execute()) + { + if (!response.isSuccessful()) + { + throw new IOException("Unable to look up gamble count!"); + } + return Integer.parseInt(response.body().string()); + } + } } diff --git a/http-service/src/main/java/net/runelite/http/service/chat/ChatController.java b/http-service/src/main/java/net/runelite/http/service/chat/ChatController.java index 2f7a6b8740..f0a9fba213 100644 --- a/http-service/src/main/java/net/runelite/http/service/chat/ChatController.java +++ b/http-service/src/main/java/net/runelite/http/service/chat/ChatController.java @@ -107,6 +107,28 @@ public class ChatController return kc; } + @PostMapping("/gc") + public void submitGc(@RequestParam String name, @RequestParam int gc) + { + if (gc < 0) + { + return; + } + + chatService.setGc(name, gc); + } + + @GetMapping("/gc") + public int getKc(@RequestParam String name) + { + Integer gc = chatService.getGc(name); + if (gc == null) + { + throw new NotFoundException(); + } + return gc; + } + @PostMapping("/task") public void submitTask(@RequestParam String name, @RequestParam("task") String taskName, @RequestParam int amount, @RequestParam int initialAmount, @RequestParam String location) diff --git a/http-service/src/main/java/net/runelite/http/service/chat/ChatService.java b/http-service/src/main/java/net/runelite/http/service/chat/ChatService.java index 07f68b95cf..70830889bc 100644 --- a/http-service/src/main/java/net/runelite/http/service/chat/ChatService.java +++ b/http-service/src/main/java/net/runelite/http/service/chat/ChatService.java @@ -139,4 +139,22 @@ public class ChatService jedis.setex("pb." + boss + "." + name, (int) EXPIRE.getSeconds(), Integer.toString(pb)); } } + + public Integer getGc(String name) + { + String value; + try (Jedis jedis = jedisPool.getResource()) + { + value = jedis.get("gc." + name); + } + return value == null ? null : Integer.parseInt(value); + } + + public void setGc(String name, int gc) + { + try (Jedis jedis = jedisPool.getResource()) + { + jedis.setex("gc." + name, (int) EXPIRE.getSeconds(), Integer.toString(gc)); + } + } } diff --git a/runelite-api/src/main/java/net/runelite/api/Varbits.java b/runelite-api/src/main/java/net/runelite/api/Varbits.java index 58cdc80380..b55956dd20 100644 --- a/runelite-api/src/main/java/net/runelite/api/Varbits.java +++ b/runelite-api/src/main/java/net/runelite/api/Varbits.java @@ -217,6 +217,7 @@ public enum Varbits * Barbarian Assault */ IN_GAME_BA(3923), + BA_GC(4768), /** * 0 = Outside wilderness diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsConfig.java index 16c40d54b7..92987467d0 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsConfig.java @@ -99,6 +99,17 @@ public interface ChatCommandsConfig extends Config @ConfigItem( position = 6, + keyName = "gc", + name = "GC Command", + description = "Configures whether the Barbarian Assault High gamble count command is enabled
!gc" + ) + default boolean gc() + { + return true; + } + + @ConfigItem( + position = 7, keyName = "clearShortcuts", name = "Clear shortcuts", description = "Enable shortcuts (ctrl+w and backspace) for clearing the chatbox" diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java index 141d72ab65..ffc54bbad7 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java @@ -42,6 +42,7 @@ import net.runelite.api.IconID; import net.runelite.api.ItemComposition; import net.runelite.api.MessageNode; import net.runelite.api.VarPlayer; +import net.runelite.api.Varbits; import net.runelite.api.events.ChatMessage; import net.runelite.api.events.GameTick; import net.runelite.api.events.VarbitChanged; @@ -95,6 +96,7 @@ public class ChatCommandsPlugin extends Plugin private static final String CMB_COMMAND_STRING = "!cmb"; private static final String QP_COMMAND_STRING = "!qp"; private static final String PB_COMMAND = "!pb"; + private static final String GC_COMMAND_STRING = "!gc"; private final HiscoreClient hiscoreClient = new HiscoreClient(); private final ChatClient chatClient = new ChatClient(); @@ -143,6 +145,7 @@ public class ChatCommandsPlugin extends Plugin chatCommandManager.registerCommandAsync(KILLCOUNT_COMMAND_STRING, this::killCountLookup, this::killCountSubmit); chatCommandManager.registerCommandAsync(QP_COMMAND_STRING, this::questPointsLookup, this::questPointsSubmit); chatCommandManager.registerCommandAsync(PB_COMMAND, this::personalBestLookup, this::personalBestSubmit); + chatCommandManager.registerCommandAsync(GC_COMMAND_STRING, this::gambleCountLookup, this::gambleCountSubmit); } @Override @@ -160,6 +163,7 @@ public class ChatCommandsPlugin extends Plugin chatCommandManager.unregisterCommand(KILLCOUNT_COMMAND_STRING); chatCommandManager.unregisterCommand(QP_COMMAND_STRING); chatCommandManager.unregisterCommand(PB_COMMAND); + chatCommandManager.unregisterCommand(GC_COMMAND_STRING); } @Provides @@ -570,6 +574,74 @@ public class ChatCommandsPlugin extends Plugin return true; } + private void gambleCountLookup(ChatMessage chatMessage, String message) + { + if (!config.gc()) + { + return; + } + + ChatMessageType type = chatMessage.getType(); + + final String player; + if (type == ChatMessageType.PRIVATECHATOUT) + { + player = client.getLocalPlayer().getName(); + } + else + { + player = sanitize(chatMessage.getName()); + } + + int gc; + try + { + gc = chatClient.getGc(player); + } + catch (IOException ex) + { + log.debug("unable to lookup gamble count", ex); + return; + } + + String response = new ChatMessageBuilder() + .append(ChatColorType.NORMAL) + .append("Barbarian Assault High-level gambles: ") + .append(ChatColorType.HIGHLIGHT) + .append(Integer.toString(gc)) + .build(); + + log.debug("Setting response {}", response); + final MessageNode messageNode = chatMessage.getMessageNode(); + messageNode.setRuneLiteFormatMessage(response); + chatMessageManager.update(messageNode); + client.refreshChat(); + } + + private boolean gambleCountSubmit(ChatInput chatInput, String value) + { + final int gc = client.getVar(Varbits.BA_GC); + final String playerName = client.getLocalPlayer().getName(); + + executor.execute(() -> + { + try + { + chatClient.submitGc(playerName, gc); + } + catch (Exception ex) + { + log.warn("unable to submit gamble count", ex); + } + finally + { + chatInput.resume(); + } + }); + + return true; + } + /** * Looks up the item price and changes the original message to the * response. From 8ee3e483f4112fbb51b5e9ad63256fd8dc502d9b Mon Sep 17 00:00:00 2001 From: Robert Alexander Date: Fri, 24 May 2019 21:45:27 +0200 Subject: [PATCH 10/58] chat commands: add duel arena chat command --- .../runelite/http/api/chat/ChatClient.java | 51 +++++++ .../net/runelite/http/api/chat/Duels.java | 36 +++++ .../http/service/chat/ChatController.java | 31 ++++ .../http/service/chat/ChatService.java | 41 ++++++ .../chatcommands/ChatCommandsConfig.java | 11 ++ .../chatcommands/ChatCommandsPlugin.java | 138 +++++++++++++++++- .../chatcommands/ChatCommandsPluginTest.java | 37 ++++- 7 files changed, 343 insertions(+), 2 deletions(-) create mode 100644 http-api/src/main/java/net/runelite/http/api/chat/Duels.java diff --git a/http-api/src/main/java/net/runelite/http/api/chat/ChatClient.java b/http-api/src/main/java/net/runelite/http/api/chat/ChatClient.java index 2ab1d0c8ed..79c4a889ed 100644 --- a/http-api/src/main/java/net/runelite/http/api/chat/ChatClient.java +++ b/http-api/src/main/java/net/runelite/http/api/chat/ChatClient.java @@ -258,4 +258,55 @@ public class ChatClient return Integer.parseInt(response.body().string()); } } + + public boolean submitDuels(String username, int wins, int losses, int winningStreak, int losingStreak) throws IOException + { + HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() + .addPathSegment("chat") + .addPathSegment("duels") + .addQueryParameter("name", username) + .addQueryParameter("wins", Integer.toString(wins)) + .addQueryParameter("losses", Integer.toString(losses)) + .addQueryParameter("winningStreak", Integer.toString(winningStreak)) + .addQueryParameter("losingStreak", Integer.toString(losingStreak)) + .build(); + + Request request = new Request.Builder() + .post(RequestBody.create(null, new byte[0])) + .url(url) + .build(); + + try (Response response = RuneLiteAPI.CLIENT.newCall(request).execute()) + { + return response.isSuccessful(); + } + } + + public Duels getDuels(String username) throws IOException + { + HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() + .addPathSegment("chat") + .addPathSegment("duels") + .addQueryParameter("name", username) + .build(); + + Request request = new Request.Builder() + .url(url) + .build(); + + try (Response response = RuneLiteAPI.CLIENT.newCall(request).execute()) + { + if (!response.isSuccessful()) + { + throw new IOException("Unable to look up duels!"); + } + + InputStream in = response.body().byteStream(); + return RuneLiteAPI.GSON.fromJson(new InputStreamReader(in), Duels.class); + } + catch (JsonParseException ex) + { + throw new IOException(ex); + } + } } diff --git a/http-api/src/main/java/net/runelite/http/api/chat/Duels.java b/http-api/src/main/java/net/runelite/http/api/chat/Duels.java new file mode 100644 index 0000000000..ba117a526a --- /dev/null +++ b/http-api/src/main/java/net/runelite/http/api/chat/Duels.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2019, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.http.api.chat; + +import lombok.Data; + +@Data +public class Duels +{ + private int wins; + private int losses; + private int winningStreak; + private int losingStreak; +} diff --git a/http-service/src/main/java/net/runelite/http/service/chat/ChatController.java b/http-service/src/main/java/net/runelite/http/service/chat/ChatController.java index f0a9fba213..7b5132e47a 100644 --- a/http-service/src/main/java/net/runelite/http/service/chat/ChatController.java +++ b/http-service/src/main/java/net/runelite/http/service/chat/ChatController.java @@ -29,6 +29,7 @@ import com.google.common.cache.CacheBuilder; import java.util.concurrent.TimeUnit; import java.util.regex.Matcher; import java.util.regex.Pattern; +import net.runelite.http.api.chat.Duels; import net.runelite.http.api.chat.Task; import net.runelite.http.service.util.exception.NotFoundException; import org.springframework.beans.factory.annotation.Autowired; @@ -177,4 +178,34 @@ public class ChatController } return pb; } + + @PostMapping("/duels") + public void submitDuels(@RequestParam String name, @RequestParam int wins, + @RequestParam int losses, + @RequestParam int winningStreak, @RequestParam int losingStreak) + { + if (wins < 0 || losses < 0 || winningStreak < 0 || losingStreak < 0) + { + return; + } + + Duels duels = new Duels(); + duels.setWins(wins); + duels.setLosses(losses); + duels.setWinningStreak(winningStreak); + duels.setLosingStreak(losingStreak); + + chatService.setDuels(name, duels); + } + + @GetMapping("/duels") + public Duels getDuels(@RequestParam String name) + { + Duels duels = chatService.getDuels(name); + if (duels == null) + { + throw new NotFoundException(); + } + return duels; + } } diff --git a/http-service/src/main/java/net/runelite/http/service/chat/ChatService.java b/http-service/src/main/java/net/runelite/http/service/chat/ChatService.java index 70830889bc..0b0762d3ea 100644 --- a/http-service/src/main/java/net/runelite/http/service/chat/ChatService.java +++ b/http-service/src/main/java/net/runelite/http/service/chat/ChatService.java @@ -28,6 +28,7 @@ import com.google.common.collect.ImmutableMap; import java.time.Duration; import java.util.Map; import net.runelite.http.api.chat.Task; +import net.runelite.http.api.chat.Duels; import net.runelite.http.service.util.redis.RedisPool; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -157,4 +158,44 @@ public class ChatService jedis.setex("gc." + name, (int) EXPIRE.getSeconds(), Integer.toString(gc)); } } + + public Duels getDuels(String name) + { + Map map; + + try (Jedis jedis = jedisPool.getResource()) + { + map = jedis.hgetAll("duels." + name); + } + + if (map.isEmpty()) + { + return null; + } + + Duels duels = new Duels(); + duels.setWins(Integer.parseInt(map.get("wins"))); + duels.setLosses(Integer.parseInt(map.get("losses"))); + duels.setWinningStreak(Integer.parseInt(map.get("winningStreak"))); + duels.setLosingStreak(Integer.parseInt(map.get("losingStreak"))); + return duels; + } + + public void setDuels(String name, Duels duels) + { + Map duelsMap = ImmutableMap.builderWithExpectedSize(4) + .put("wins", Integer.toString(duels.getWins())) + .put("losses", Integer.toString(duels.getLosses())) + .put("winningStreak", Integer.toString(duels.getWinningStreak())) + .put("losingStreak", Integer.toString(duels.getLosingStreak())) + .build(); + + String key = "duels." + name; + + try (Jedis jedis = jedisPool.getResource()) + { + jedis.hmset(key, duelsMap); + jedis.expire(key, (int) EXPIRE.getSeconds()); + } + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsConfig.java index 92987467d0..5a08937345 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsConfig.java @@ -110,6 +110,17 @@ public interface ChatCommandsConfig extends Config @ConfigItem( position = 7, + keyName = "duels", + name = "Duels Command", + description = "Configures whether the duel arena command is enabled
!duels" + ) + default boolean duels() + { + return true; + } + + @ConfigItem( + position = 8, keyName = "clearShortcuts", name = "Clear shortcuts", description = "Enable shortcuts (ctrl+w and backspace) for clearing the chatbox" diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java index ffc54bbad7..694542636f 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java @@ -65,6 +65,7 @@ import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.util.StackFormatter; import static net.runelite.client.util.Text.sanitize; import net.runelite.http.api.chat.ChatClient; +import net.runelite.http.api.chat.Duels; import net.runelite.http.api.hiscore.HiscoreClient; import net.runelite.http.api.hiscore.HiscoreEndpoint; import net.runelite.http.api.hiscore.HiscoreResult; @@ -88,6 +89,9 @@ public class ChatCommandsPlugin extends Plugin private static final Pattern BARROWS_PATTERN = Pattern.compile("Your Barrows chest count is: (\\d+)"); private static final Pattern KILL_DURATION_PATTERN = Pattern.compile("Fight duration: [0-9:]+. Personal best: ([0-9:]+)"); private static final Pattern NEW_PB_PATTERN = Pattern.compile("Fight duration: ([0-9:]+) \\(new personal best\\)"); + private static final Pattern DUEL_ARENA_WINS_PATTERN = Pattern.compile("You (were defeated|won)! You have(?: now)? won (\\d+) duels?"); + private static final Pattern DUEL_ARENA_LOSSES_PATTERN = Pattern.compile("You have(?: now)? lost (\\d+) duels?"); + private static final String TOTAL_LEVEL_COMMAND_STRING = "!total"; private static final String PRICE_COMMAND_STRING = "!price"; private static final String LEVEL_COMMAND_STRING = "!lvl"; @@ -97,6 +101,7 @@ public class ChatCommandsPlugin extends Plugin private static final String QP_COMMAND_STRING = "!qp"; private static final String PB_COMMAND = "!pb"; private static final String GC_COMMAND_STRING = "!gc"; + private static final String DUEL_ARENA_COMMAND = "!duels"; private final HiscoreClient hiscoreClient = new HiscoreClient(); private final ChatClient chatClient = new ChatClient(); @@ -146,6 +151,7 @@ public class ChatCommandsPlugin extends Plugin chatCommandManager.registerCommandAsync(QP_COMMAND_STRING, this::questPointsLookup, this::questPointsSubmit); chatCommandManager.registerCommandAsync(PB_COMMAND, this::personalBestLookup, this::personalBestSubmit); chatCommandManager.registerCommandAsync(GC_COMMAND_STRING, this::gambleCountLookup, this::gambleCountSubmit); + chatCommandManager.registerCommandAsync(DUEL_ARENA_COMMAND, this::duelArenaLookup, this::duelArenaSubmit); } @Override @@ -164,6 +170,7 @@ public class ChatCommandsPlugin extends Plugin chatCommandManager.unregisterCommand(QP_COMMAND_STRING); chatCommandManager.unregisterCommand(PB_COMMAND); chatCommandManager.unregisterCommand(GC_COMMAND_STRING); + chatCommandManager.unregisterCommand(DUEL_ARENA_COMMAND); } @Provides @@ -201,7 +208,9 @@ public class ChatCommandsPlugin extends Plugin @Subscribe public void onChatMessage(ChatMessage chatMessage) { - if (chatMessage.getType() != ChatMessageType.GAMEMESSAGE && chatMessage.getType() != ChatMessageType.SPAM) + if (chatMessage.getType() != ChatMessageType.TRADE + && chatMessage.getType() != ChatMessageType.GAMEMESSAGE + && chatMessage.getType() != ChatMessageType.SPAM) { return; } @@ -237,6 +246,43 @@ public class ChatCommandsPlugin extends Plugin return; } + matcher = DUEL_ARENA_WINS_PATTERN.matcher(message); + if (matcher.find()) + { + final int oldWins = getKc("Duel Arena Wins"); + final int wins = Integer.parseInt(matcher.group(2)); + final String result = matcher.group(1); + int winningStreak = getKc("Duel Arena Win Streak"); + int losingStreak = getKc("Duel Arena Lose Streak"); + + if (result.equals("won") && wins > oldWins) + { + losingStreak = 0; + winningStreak += 1; + } + else if (result.equals("were defeated")) + { + losingStreak += 1; + winningStreak = 0; + } + else + { + log.warn("unrecognized duel streak chat message: {}", message); + } + + setKc("Duel Arena Wins", wins); + setKc("Duel Arena Win Streak", winningStreak); + setKc("Duel Arena Lose Streak", losingStreak); + } + + matcher = DUEL_ARENA_LOSSES_PATTERN.matcher(message); + if (matcher.find()) + { + int losses = Integer.parseInt(matcher.group(1)); + + setKc("Duel Arena Losses", losses); + } + matcher = BARROWS_PATTERN.matcher(message); if (matcher.find()) { @@ -417,6 +463,96 @@ public class ChatCommandsPlugin extends Plugin client.refreshChat(); } + private boolean duelArenaSubmit(ChatInput chatInput, String value) + { + final int wins = getKc("Duel Arena Wins"); + final int losses = getKc("Duel Arena Losses"); + final int winningStreak = getKc("Duel Arena Win Streak"); + final int losingStreak = getKc("Duel Arena Lose Streak"); + + if (wins <= 0 && losses <= 0 && winningStreak <= 0 && losingStreak <= 0) + { + return false; + } + + final String playerName = client.getLocalPlayer().getName(); + + executor.execute(() -> + { + try + { + chatClient.submitDuels(playerName, wins, losses, winningStreak, losingStreak); + } + catch (Exception ex) + { + log.warn("unable to submit duels", ex); + } + finally + { + chatInput.resume(); + } + }); + + return true; + } + + private void duelArenaLookup(ChatMessage chatMessage, String message) + { + if (!config.duels()) + { + return; + } + + ChatMessageType type = chatMessage.getType(); + + final String player; + if (type == ChatMessageType.PRIVATECHATOUT) + { + player = client.getLocalPlayer().getName(); + } + else + { + player = sanitize(chatMessage.getName()); + } + + Duels duels; + try + { + duels = chatClient.getDuels(player); + } + catch (IOException ex) + { + log.debug("unable to lookup duels", ex); + return; + } + + final int wins = duels.getWins(); + final int losses = duels.getLosses(); + final int winningStreak = duels.getWinningStreak(); + final int losingStreak = duels.getLosingStreak(); + + String response = new ChatMessageBuilder() + .append(ChatColorType.NORMAL) + .append("Duel Arena wins: ") + .append(ChatColorType.HIGHLIGHT) + .append(Integer.toString(wins)) + .append(ChatColorType.NORMAL) + .append(" losses: ") + .append(ChatColorType.HIGHLIGHT) + .append(Integer.toString(losses)) + .append(ChatColorType.NORMAL) + .append(" streak: ") + .append(ChatColorType.HIGHLIGHT) + .append(Integer.toString((winningStreak != 0 ? winningStreak : -losingStreak))) + .build(); + + log.debug("Setting response {}", response); + final MessageNode messageNode = chatMessage.getMessageNode(); + messageNode.setRuneLiteFormatMessage(response); + chatMessageManager.update(messageNode); + client.refreshChat(); + } + private void questPointsLookup(ChatMessage chatMessage, String message) { if (!config.qp()) diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java index 922b8fed25..ea96a7caec 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java @@ -30,6 +30,7 @@ import com.google.inject.testing.fieldbinder.BoundFieldModule; import java.util.concurrent.ScheduledExecutorService; import javax.inject.Inject; import static net.runelite.api.ChatMessageType.GAMEMESSAGE; +import static net.runelite.api.ChatMessageType.TRADE; import net.runelite.api.Client; import net.runelite.api.events.ChatMessage; import net.runelite.client.config.ChatColorConfig; @@ -191,4 +192,38 @@ public class ChatCommandsPluginTest verify(configManager).setConfiguration(eq("personalbest.adam"), eq("kree'arra"), eq(181)); } -} \ No newline at end of file + + @Test + public void testDuelArenaWin() + { + when(client.getUsername()).thenReturn("Adam"); + + ChatMessage chatMessageEvent = new ChatMessage(null, TRADE, "", "You won! You have now won 27 duels.", null, 0); + chatCommandsPlugin.onChatMessage(chatMessageEvent); + + verify(configManager).setConfiguration("killcount.adam", "duel arena wins", 27); + verify(configManager).setConfiguration("killcount.adam", "duel arena win streak", 1); + } + + @Test + public void testDuelArenaWin2() + { + when(client.getUsername()).thenReturn("Adam"); + + ChatMessage chatMessageEvent = new ChatMessage(null, TRADE, "", "You were defeated! You have won 22 duels.", null, 0); + chatCommandsPlugin.onChatMessage(chatMessageEvent); + + verify(configManager).setConfiguration("killcount.adam", "duel arena wins", 22); + } + + @Test + public void testDuelArenaLose() + { + when(client.getUsername()).thenReturn("Adam"); + + ChatMessage chatMessageEvent = new ChatMessage(null, TRADE, "", "You have now lost 999 duels.", null, 0); + chatCommandsPlugin.onChatMessage(chatMessageEvent); + + verify(configManager).setConfiguration("killcount.adam", "duel arena losses", 999); + } +} From 64cdc9e696145a16cdb51cec214fcc7e59b3b227 Mon Sep 17 00:00:00 2001 From: sdburns1998 <49877861+sdburns1998@users.noreply.github.com> Date: Fri, 28 Jun 2019 08:35:49 +0200 Subject: [PATCH 11/58] Add Tears of Guthix Experience Overlay (#790) --- .../TearsOfGuthixExperienceOverlay.java | 77 +++++++++++++++++++ .../tearsofguthix/TearsOfGuthixPlugin.java | 54 ++++++++++++- 2 files changed, 130 insertions(+), 1 deletion(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/tearsofguthix/TearsOfGuthixExperienceOverlay.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/tearsofguthix/TearsOfGuthixExperienceOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/tearsofguthix/TearsOfGuthixExperienceOverlay.java new file mode 100644 index 0000000000..b702556f5f --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/tearsofguthix/TearsOfGuthixExperienceOverlay.java @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2018, Aquivers + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.runelite.client.plugins.tearsofguthix; + +import net.runelite.api.Client; +import net.runelite.client.ui.overlay.Overlay; +import net.runelite.client.ui.overlay.OverlayPosition; +import net.runelite.client.ui.overlay.OverlayPriority; +import net.runelite.client.ui.overlay.components.PanelComponent; +import javax.inject.Inject; +import java.awt.Dimension; +import java.awt.Graphics2D; +import net.runelite.client.ui.overlay.components.table.TableAlignment; +import net.runelite.client.ui.overlay.components.table.TableComponent; + +class TearsOfGuthixExperienceOverlay extends Overlay +{ + private final TearsOfGuthixPlugin plugin; + private final PanelComponent panelComponent = new PanelComponent(); + + @Inject + private Client client; + + @Inject + private TearsOfGuthixExperienceOverlay(final TearsOfGuthixPlugin plugin) + { + setPosition(OverlayPosition.ABOVE_CHATBOX_RIGHT); + setPriority(OverlayPriority.LOW); + this.plugin = plugin; + } + + @Override + public Dimension render(Graphics2D graphics) + { + if (plugin.getPlayerLowestSkill() == null) + { + return null; + } + + panelComponent.getChildren().clear(); + + TableComponent tableComponent = new TableComponent(); + tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT); + + tableComponent.addRow(plugin.getPlayerLowestSkill().getName(), "Lvl - " + client.getRealSkillLevel(plugin.getPlayerLowestSkill()) + ""); + + if (!tableComponent.isEmpty()) + { + panelComponent.getChildren().add(tableComponent); + } + + return panelComponent.render(graphics); + } +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/tearsofguthix/TearsOfGuthixPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/tearsofguthix/TearsOfGuthixPlugin.java index 6567c15e24..9d2f1100aa 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/tearsofguthix/TearsOfGuthixPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/tearsofguthix/TearsOfGuthixPlugin.java @@ -28,10 +28,13 @@ import java.time.Instant; import java.util.HashMap; import java.util.Map; import javax.inject.Inject; +import lombok.AccessLevel; import lombok.Getter; import net.runelite.api.Client; import net.runelite.api.DecorativeObject; +import net.runelite.api.GameState; import net.runelite.api.ObjectID; +import net.runelite.api.Skill; import net.runelite.api.events.DecorativeObjectDespawned; import net.runelite.api.events.DecorativeObjectSpawned; import net.runelite.api.events.GameStateChanged; @@ -58,20 +61,29 @@ public class TearsOfGuthixPlugin extends Plugin @Inject private TearsOfGuthixOverlay overlay; - @Getter + @Inject + private TearsOfGuthixExperienceOverlay experienceOverlay; + + @Getter(AccessLevel.PACKAGE) private final Map streams = new HashMap<>(); + @Getter(AccessLevel.PACKAGE) + private Skill playerLowestSkill = null; + @Override protected void startUp() { overlayManager.add(overlay); + overlayManager.add(experienceOverlay); } @Override protected void shutDown() { overlayManager.remove(overlay); + overlayManager.remove(experienceOverlay); streams.clear(); + playerLowestSkill = null; } @Subscribe @@ -84,6 +96,26 @@ public class TearsOfGuthixPlugin extends Plugin case HOPPING: streams.clear(); } + + if (event.getGameState() == GameState.LOGGED_IN) + { + if (client.getLocalPlayer().getWorldLocation().getRegionID() == TOG_REGION) + { + if (playerLowestSkill != null) + { + return; + } + + if (client.getSkillExperience(Skill.HITPOINTS) > 0) + { + playerLowestSkill = getLowestPlayerSkill(); + } + } + else + { + playerLowestSkill = null; + } + } } @Subscribe @@ -112,4 +144,24 @@ public class TearsOfGuthixPlugin extends Plugin DecorativeObject object = event.getDecorativeObject(); streams.remove(object); } + + private Skill getLowestPlayerSkill() + { + final Skill[] playerSkills = Skill.values(); + Skill lowestExperienceSkill = null; + int lowestExperienceAmount = Integer.MAX_VALUE; + + for (Skill skill : playerSkills) + { + int currentSkillExp = client.getSkillExperience(skill); + + if (currentSkillExp < lowestExperienceAmount) + { + lowestExperienceAmount = currentSkillExp; + lowestExperienceSkill = skill; + } + } + + return lowestExperienceSkill; + } } From 2f36af4bf10f3f7a672aaae3c606ed95601fe80e Mon Sep 17 00:00:00 2001 From: sdburns1998 <49877861+sdburns1998@users.noreply.github.com> Date: Fri, 28 Jun 2019 08:36:06 +0200 Subject: [PATCH 12/58] Simple xp tracker mode toggle (#789) --- .../client/plugins/xptracker/XpInfoBox.java | 85 +++++++++++++++---- 1 file changed, 70 insertions(+), 15 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpInfoBox.java b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpInfoBox.java index d6fff3c47b..c2e2284797 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpInfoBox.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpInfoBox.java @@ -28,6 +28,9 @@ package net.runelite.client.plugins.xptracker; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Collections; @@ -79,12 +82,13 @@ class XpInfoBox extends JPanel /* The tracker's wrapping container */ private final JPanel container = new JPanel(); - /* Contains the skill icon and the stats panel */ - private final JPanel headerPanel = new JPanel(); + /* Contains the skill icon */ + private final JPanel skillWrapper = new JPanel(); /* Contains all the skill information (exp gained, per hour, etc) */ private final JPanel statsPanel = new JPanel(); + private final JPanel progressWrapper = new JPanel(); private final ProgressBar progressBar = new ProgressBar(); private final JLabel expGained = new JLabel(); @@ -98,6 +102,14 @@ class XpInfoBox extends JPanel private boolean paused = false; + private Style style = Style.FULL; + + private enum Style + { + FULL, + SIMPLE + } + XpInfoBox(XpTrackerPlugin xpTrackerPlugin, XpTrackerConfig xpTrackerConfig, Client client, JPanel panel, Skill skill, SkillIconManager iconManager) { this.xpTrackerConfig = xpTrackerConfig; @@ -134,6 +146,10 @@ class XpInfoBox extends JPanel popupMenu.add(pauseSkill); popupMenu.add(canvasItem); + skillWrapper.setBackground(ColorScheme.DARKER_GRAY_COLOR); + skillWrapper.setLayout(new BorderLayout()); + skillWrapper.setBorder(new EmptyBorder(0, 5, 0, 0)); + canvasItem.addActionListener(e -> { if (canvasItem.getText().equals(REMOVE_STATE)) @@ -151,14 +167,13 @@ class XpInfoBox extends JPanel JLabel skillIcon = new JLabel(new ImageIcon(iconManager.getSkillImage(skill))); skillIcon.setHorizontalAlignment(SwingConstants.CENTER); skillIcon.setVerticalAlignment(SwingConstants.CENTER); - skillIcon.setPreferredSize(new Dimension(35, 35)); + skillIcon.setPreferredSize(new Dimension(30, 30)); - headerPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR); - headerPanel.setLayout(new BorderLayout()); + skillWrapper.add(skillIcon, BorderLayout.NORTH); statsPanel.setLayout(new DynamicGridLayout(2, 2)); statsPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR); - statsPanel.setBorder(new EmptyBorder(9, 2, 9, 2)); + statsPanel.setBorder(new EmptyBorder(6, 5, 0, 2)); expGained.setFont(FontManager.getRunescapeSmallFont()); expHour.setFont(FontManager.getRunescapeSmallFont()); @@ -170,13 +185,8 @@ class XpInfoBox extends JPanel statsPanel.add(expHour); statsPanel.add(actionsLeft); - headerPanel.add(skillIcon, BorderLayout.WEST); - headerPanel.add(statsPanel, BorderLayout.CENTER); - - JPanel progressWrapper = new JPanel(); progressWrapper.setBackground(ColorScheme.DARKER_GRAY_COLOR); progressWrapper.setLayout(new BorderLayout()); - progressWrapper.setBorder(new EmptyBorder(0, 7, 7, 7)); progressBar.setMaximumValue(100); progressBar.setBackground(new Color(61, 56, 49)); @@ -185,15 +195,48 @@ class XpInfoBox extends JPanel progressWrapper.add(progressBar, BorderLayout.NORTH); - container.add(headerPanel, BorderLayout.NORTH); - container.add(progressWrapper, BorderLayout.SOUTH); - container.setComponentPopupMenu(popupMenu); progressBar.setComponentPopupMenu(popupMenu); + MouseListener mouseListener = new MouseAdapter() + { + @Override + public void mouseClicked(MouseEvent e) + { + if (SwingUtilities.isLeftMouseButton(e)) + { + toggleStyle(); + } + } + }; + container.addMouseListener(mouseListener); + progressBar.addMouseListener(mouseListener); + add(container, BorderLayout.NORTH); } + void setStyle(Style style) + { + container.removeAll(); + + if (style == Style.SIMPLE) + { + progressWrapper.setBorder(new EmptyBorder(7, 7, 7, 7)); + container.add(skillWrapper, BorderLayout.WEST); + container.add(progressWrapper, BorderLayout.CENTER); + } + else + { + progressWrapper.setBorder(new EmptyBorder(4, 7, 7, 7)); + container.add(skillWrapper, BorderLayout.WEST); + container.add(statsPanel, BorderLayout.CENTER); + container.add(progressWrapper, BorderLayout.SOUTH); + } + + panel.revalidate(); + this.style = style; + } + void reset() { canvasItem.setText(ADD_STATE); @@ -214,7 +257,7 @@ class XpInfoBox extends JPanel if (getParent() != panel) { panel.add(this); - panel.revalidate(); + setStyle(style); } paused = skillPaused; @@ -284,6 +327,18 @@ class XpInfoBox extends JPanel expHour.setText(htmlLabel("XP/Hour: ", xpSnapshotSingle.getXpPerHour())); } + private void toggleStyle() + { + if (style == Style.FULL) + { + setStyle(Style.SIMPLE); + } + else + { + setStyle(Style.FULL); + } + } + static String htmlLabel(String key, int value) { String valueStr = StackFormatter.quantityToRSDecimalStack(value, true); From 5d47520071250c3f4a4e6a9198233b1c002854ef Mon Sep 17 00:00:00 2001 From: sdburns1998 <49877861+sdburns1998@users.noreply.github.com> Date: Fri, 28 Jun 2019 09:36:55 +0200 Subject: [PATCH 13/58] Add caching to config invocation handler (#788) --- .../config/ConfigInvocationHandler.java | 108 +++++++++++------- .../runelite/client/config/ConfigManager.java | 23 +++- 2 files changed, 91 insertions(+), 40 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/config/ConfigInvocationHandler.java b/runelite-client/src/main/java/net/runelite/client/config/ConfigInvocationHandler.java index 62cd38a8d1..330551c37f 100644 --- a/runelite-client/src/main/java/net/runelite/client/config/ConfigInvocationHandler.java +++ b/runelite-client/src/main/java/net/runelite/client/config/ConfigInvocationHandler.java @@ -28,6 +28,8 @@ import java.lang.invoke.MethodHandles; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; +import java.util.HashMap; +import java.util.Map; import java.util.Objects; import lombok.extern.slf4j.Slf4j; @@ -36,26 +38,49 @@ class ConfigInvocationHandler implements InvocationHandler { private final ConfigManager manager; + // Caches for annotation values + private static final Map, String> groupValueCache = new HashMap<>(); + private static final Map methodKeyNameCache = new HashMap<>(); + public ConfigInvocationHandler(ConfigManager manager) { this.manager = manager; } + private static String groupValueFromProxy(Class proxyClass) + { + Class iface = proxyClass.getInterfaces()[0]; + ConfigGroup group = iface.getAnnotation(ConfigGroup.class); + + return group == null ? null : group.value(); + } + + private static String keyNameFromMethod(Method method) + { + ConfigItem item = method.getAnnotation(ConfigItem.class); + + return item == null ? null : item.keyName(); + } + @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { - Class iface = proxy.getClass().getInterfaces()[0]; - - ConfigGroup group = iface.getAnnotation(ConfigGroup.class); - ConfigItem item = method.getAnnotation(ConfigItem.class); - - if (group == null) + String itemKeyName, groupValue; + try + { + groupValue = groupValueCache.computeIfAbsent(proxy.getClass(), ConfigInvocationHandler::groupValueFromProxy); + } + catch (NullPointerException e) { log.warn("Configuration proxy class {} has no @ConfigGroup!", proxy.getClass()); return null; } - if (item == null) + try + { + itemKeyName = methodKeyNameCache.computeIfAbsent(method, ConfigInvocationHandler::keyNameFromMethod); + } + catch (NullPointerException e) { log.warn("Configuration method {} has no @ConfigItem!", method); return null; @@ -64,38 +89,43 @@ class ConfigInvocationHandler implements InvocationHandler if (args == null) { // Getting configuration item - String value = manager.getConfiguration(group.value(), item.keyName()); - - if (value == null) + return manager.getConfigObjectFromCacheOrElse(groupValue, itemKeyName, (value) -> { - if (method.isDefault()) + try { - return callDefaultMethod(proxy, method, null); + value = manager.getConfiguration(value); + if (value == null) + { + if (method.isDefault()) + { + return callDefaultMethod(proxy, method, null); + } + return null; + } + + // Convert value to return type + Class returnType = method.getReturnType(); + + try + { + return ConfigManager.stringToObject(value, returnType); + } + catch (Exception e) + { + log.warn("Unable to unmarshal {}.{} ", groupValue, itemKeyName, e); + if (method.isDefault()) + { + return callDefaultMethod(proxy, method, null); + } + return null; + } } - - return null; - } - - // Convert value to return type - Class returnType = method.getReturnType(); - - try - { - return ConfigManager.stringToObject(value, returnType); - } - catch (Exception e) - { - log.warn("Unable to unmarshal {}.{} ", group.value(), item.keyName(), e); - if (method.isDefault()) + catch (Throwable throwable) { - Object defaultValue = callDefaultMethod(proxy, method, null); - - manager.setConfiguration(group.value(), item.keyName(), defaultValue); - - return defaultValue; + log.error("Unable to resolve configuration value {}.{}", groupValue, itemKeyName, throwable); + return null; } - return null; - } + }); } else { @@ -103,13 +133,13 @@ class ConfigInvocationHandler implements InvocationHandler if (args.length != 1) { - throw new RuntimeException("Invalid number of arguents to configuration method"); + throw new RuntimeException("Invalid number of arguments to configuration method"); } Object newValue = args[0]; Class type = method.getParameterTypes()[0]; - Object oldValue = manager.getConfiguration(group.value(), item.keyName(), type); + Object oldValue = manager.getConfiguration(groupValue, itemKeyName, type); if (Objects.equals(oldValue, newValue)) { @@ -124,19 +154,19 @@ class ConfigInvocationHandler implements InvocationHandler if (Objects.equals(newValue, defaultValue)) { // Just unset if it goes back to the default - manager.unsetConfiguration(group.value(), item.keyName()); + manager.unsetConfiguration(groupValue, itemKeyName); return null; } } if (newValue == null) { - manager.unsetConfiguration(group.value(), item.keyName()); + manager.unsetConfiguration(groupValue, itemKeyName); } else { String newValueStr = ConfigManager.objectToString(newValue); - manager.setConfiguration(group.value(), item.keyName(), newValueStr); + manager.setConfiguration(groupValue, itemKeyName, newValueStr); } return null; } diff --git a/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java b/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java index 8bb63b5a4f..c81c25bd0e 100644 --- a/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java +++ b/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java @@ -55,6 +55,7 @@ import java.util.Objects; import java.util.Properties; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; +import java.util.function.Function; import java.util.stream.Collectors; import javax.inject.Inject; import javax.inject.Singleton; @@ -81,6 +82,7 @@ public class ConfigManager private final ScheduledExecutorService executor; private final ConfigInvocationHandler handler = new ConfigInvocationHandler(this); private final Properties properties = new Properties(); + private final Map configObjectCache = new HashMap<>(); private final Map pendingChanges = new HashMap<>(); @Inject @@ -220,6 +222,20 @@ public class ConfigManager } } + // Attempts to fetch the config value from the cache if present. Otherwise it calls the get value function and caches the result + Object getConfigObjectFromCacheOrElse(String groupName, String key, Function getValue) + { + String configItemKey = groupName + "." + key; + return configObjectCache.computeIfAbsent(configItemKey, getValue); + } + + // Posts the configchanged event to the event bus and remove the changed key from the cache + private void postConfigChanged(ConfigChanged configChanged) + { + configObjectCache.remove(configChanged.getGroup() + "." + configChanged.getKey()); + eventBus.post(configChanged); + } + public T getConfig(Class clazz) { if (!Modifier.isPublic(clazz.getModifiers())) @@ -245,6 +261,11 @@ public class ConfigManager return properties.getProperty(groupName + "." + key); } + public String getConfiguration(String propertyKey) + { + return properties.getProperty(propertyKey); + } + public T getConfiguration(String groupName, String key, Class clazz) { String value = getConfiguration(groupName, key); @@ -284,7 +305,7 @@ public class ConfigManager configChanged.setOldValue(oldValue); configChanged.setNewValue(value); - eventBus.post(configChanged); + postConfigChanged(configChanged); } public void setConfiguration(String groupName, String key, Object value) From e7af9222fb1620781543775b75f09b16ee93d422 Mon Sep 17 00:00:00 2001 From: pklite <46624825+pklite@users.noreply.github.com> Date: Fri, 28 Jun 2019 13:18:04 -0400 Subject: [PATCH 14/58] Adds a configuration option to make the inventory anti-drag enabled by default (#795) Signed-off-by: PKLite --- .../plugins/antidrag/AntiDragConfig.java | 11 +++ .../plugins/antidrag/AntiDragPlugin.java | 91 +++++++++++++------ 2 files changed, 73 insertions(+), 29 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/antidrag/AntiDragConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/antidrag/AntiDragConfig.java index 3512baacfe..91286be5fc 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/antidrag/AntiDragConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/antidrag/AntiDragConfig.java @@ -118,4 +118,15 @@ public interface AntiDragConfig extends Config { return CustomCursor.DRAGON_SCIMITAR; } + + @ConfigItem( + keyName = "alwaysOn", + name = "Always On", + description = "Makes the anti-drag always active and disables the hotkey toggle", + position = 8 + ) + default boolean alwaysOn() + { + return false; + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/antidrag/AntiDragPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/antidrag/AntiDragPlugin.java index 76db48c55e..0167cbc648 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/antidrag/AntiDragPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/antidrag/AntiDragPlugin.java @@ -28,6 +28,7 @@ package net.runelite.client.plugins.antidrag; import com.google.inject.Provides; import javax.inject.Inject; import net.runelite.api.Client; +import net.runelite.api.events.ConfigChanged; import net.runelite.api.events.FocusChanged; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; @@ -51,6 +52,7 @@ import net.runelite.client.util.HotkeyListener; public class AntiDragPlugin extends Plugin { private static final int DEFAULT_DELAY = 5; + private static final String CONFIG_GROUP_NAME = "antiDrag"; private boolean toggleDrag; @Inject @@ -84,7 +86,8 @@ public class AntiDragPlugin extends Plugin protected void startUp() throws Exception { keyManager.registerKeyListener(hotkeyListener); - toggleDrag = false; + toggleDrag = config.alwaysOn(); + enableAntiDrag(); } @@ -97,46 +100,76 @@ public class AntiDragPlugin extends Plugin overlayManager.remove(overlay); } + @Subscribe + public void onConfigChanged(ConfigChanged event) + { + if (event.getGroup().equals(CONFIG_GROUP_NAME)) + { + toggleDrag = config.alwaysOn(); + enableAntiDrag(); + } + } + + @Subscribe + public void onFocusChanged(FocusChanged focusChanged) + { + if (!config.alwaysOn()) + { + if (!focusChanged.isFocused() && config.reqfocus()) + { + client.setInventoryDragDelay(DEFAULT_DELAY); + overlayManager.remove(overlay); + } + } + } + + private void enableAntiDrag() + { + if (toggleDrag) + { + client.setInventoryDragDelay(config.dragDelay()); + } + else + { + client.setInventoryDragDelay(DEFAULT_DELAY); + } + } + private final HotkeyListener hotkeyListener = new HotkeyListener(() -> config.key()) { @Override public void hotkeyPressed() { - toggleDrag = !toggleDrag; - if (toggleDrag) + if (!config.alwaysOn()) { - if (config.overlay()) + toggleDrag = !toggleDrag; + if (toggleDrag) { - overlayManager.add(overlay); - } - if (config.changeCursor()) - { - CustomCursor selectedCursor = config.selectedCursor(); - clientUI.setCursor(selectedCursor.getCursorImage(), selectedCursor.toString()); - } + if (config.overlay()) + { + overlayManager.add(overlay); + } + if (config.changeCursor()) + { + CustomCursor selectedCursor = config.selectedCursor(); + clientUI.setCursor(selectedCursor.getCursorImage(), selectedCursor.toString()); + } - client.setInventoryDragDelay(config.dragDelay()); - } - else - { - overlayManager.remove(overlay); - client.setInventoryDragDelay(DEFAULT_DELAY); - if (config.changeCursor()) + client.setInventoryDragDelay(config.dragDelay()); + } + else { - net.runelite.client.plugins.customcursor.CustomCursor selectedCursor = configManager.getConfig(CustomCursorConfig.class).selectedCursor(); - clientUI.setCursor(selectedCursor.getCursorImage(), selectedCursor.toString()); + overlayManager.remove(overlay); + client.setInventoryDragDelay(DEFAULT_DELAY); + if (config.changeCursor()) + { + net.runelite.client.plugins.customcursor.CustomCursor selectedCursor = configManager.getConfig(CustomCursorConfig.class).selectedCursor(); + clientUI.setCursor(selectedCursor.getCursorImage(), selectedCursor.toString()); + } } } } }; - @Subscribe - public void onFocusChanged(FocusChanged focusChanged) - { - if (!focusChanged.isFocused() && config.reqfocus()) - { - client.setInventoryDragDelay(DEFAULT_DELAY); - overlayManager.remove(overlay); - } - } + } From 8b3a70d11515fc77175d4379edfabe4b2cca9595 Mon Sep 17 00:00:00 2001 From: se7enAte9 <50936458+se7enAte9@users.noreply.github.com> Date: Fri, 28 Jun 2019 15:07:07 -0400 Subject: [PATCH 15/58] menuentryswapper: remove early return (#797) --- .../MenuEntrySwapperPlugin.java | 40 ++++++++----------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java index c6eb0a7947..f7f04ddef9 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java @@ -906,34 +906,28 @@ public class MenuEntrySwapperPlugin extends Plugin } } } - - Player[] players = client.getCachedPlayers(); - Player player = null; - int identifier = event.getIdentifier(); - - if (identifier >= 0 && identifier < players.length) - { - player = players[identifier]; - } - - if (player == null) - { - return; - } //If the option is already to walk there, or cancel we don't need to swap it with anything - if (pOptionToReplace.equals(CANCEL) || pOptionToReplace.equals(WALK_HERE)) - { - return; - } + if (!pOptionToReplace.equals(CANCEL) && !pOptionToReplace.equals(WALK_HERE)) + { + Player[] players = client.getCachedPlayers(); + int identifier = event.getIdentifier(); - if (((config.getRemoveFreezePlayerCoX() && client.getVar(Varbits.IN_RAID) == 1) - || (config.getRemoveFreezePlayerToB() && client.getVar(Varbits.THEATRE_OF_BLOOD) == 2)) - && (player.isFriend() || player.isClanMember()) - && CAST_OPTIONS_KEYWORDS.contains(pOptionToReplace)) + if (identifier >= 0 && identifier < players.length) { - addswap(pOptionToReplace); + Player player = players[identifier]; + if (player != null) + { + if (((config.getRemoveFreezePlayerCoX() && client.getVar(Varbits.IN_RAID) == 1) + || (config.getRemoveFreezePlayerToB() && client.getVar(Varbits.THEATRE_OF_BLOOD) == 2)) + && (player.isFriend() || player.isClanMember()) + && CAST_OPTIONS_KEYWORDS.contains(pOptionToReplace)) + { + addswap(pOptionToReplace); + } + } } + } if (option.equals("talk-to")) { From 23f6463024e694895f499143824255aec51dcf1f Mon Sep 17 00:00:00 2001 From: Ganom Date: Fri, 28 Jun 2019 15:26:15 -0400 Subject: [PATCH 16/58] Clean up Anti-Drag Plugin (#798) * Clean up Anti-Drag Plugin * Cleanup Anti-Drag Config --- .../plugins/antidrag/AntiDragConfig.java | 78 ++++++++++++------- .../plugins/antidrag/AntiDragPlugin.java | 44 +++++------ 2 files changed, 74 insertions(+), 48 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/antidrag/AntiDragConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/antidrag/AntiDragConfig.java index 91286be5fc..69a54cc971 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/antidrag/AntiDragConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/antidrag/AntiDragConfig.java @@ -37,33 +37,66 @@ import net.runelite.client.config.ModifierlessKeybind; @ConfigGroup("antiDrag") public interface AntiDragConfig extends Config { + @ConfigItem( - keyName = "dragDelay", - name = "Drag Delay", - description = "Configures the inventory drag delay in client ticks (20ms)", - position = 1 + position = 0, + keyName = "alwaysOn", + name = "Always On", + description = "Makes the anti-drag always active and disables the hotkey toggle", + disabledBy = "keybind", + hide = "keybind" ) - default int dragDelay() + default boolean alwaysOn() { - return Constants.GAME_TICK_LENGTH / Constants.CLIENT_TICK_LENGTH; // one game tick + return false; } @ConfigItem( + position = 1, keyName = "keybind", - name = "keybind", + name = "Toggle with Keybind", + description = "Toggle anti drag on and off, rather than always on.", + disabledBy = "alwaysOn", + hide = "alwaysOn" + ) + default boolean keybind() + { + return false; + } + + @ConfigItem( + keyName = "key", + name = "Keybind", description = "The keybind you want to use for antidrag", - position = 2 + position = 2, + hidden = true, + unhide = "keybind" ) default Keybind key() { return new ModifierlessKeybind(KeyEvent.VK_SHIFT, 0); } + @ConfigItem( + keyName = "dragDelay", + name = "Drag Delay", + description = "Configures the inventory drag delay in client ticks (20ms)", + position = 3, + hidden = true, + unhide = "keybind" + ) + default int dragDelay() + { + return Constants.GAME_TICK_LENGTH / Constants.CLIENT_TICK_LENGTH; // one game tick + } + @ConfigItem( keyName = "reqfocus", name = "Reset on focus loss", description = "Disable antidrag when losing focus (like alt tabbing)", - position = 3 + position = 4, + hidden = true, + unhide = "keybind" ) default boolean reqfocus() { @@ -74,7 +107,9 @@ public interface AntiDragConfig extends Config keyName = "overlay", name = "Enable overlay", description = "Do you really need a description?", - position = 4 + position = 5, + hidden = true, + unhide = "keybind" ) default boolean overlay() { @@ -87,8 +122,8 @@ public interface AntiDragConfig extends Config name = "Overlay color", description = "Change the overlay color, duh", hidden = true, - unhide = "overlay", - position = 5 + unhide = "keybind", + position = 6 ) default Color color() { @@ -99,7 +134,9 @@ public interface AntiDragConfig extends Config keyName = "changeCursor", name = "Change Cursor", description = "Change cursor when you have anti-drag enabled.", - position = 6 + position = 7, + hidden = true, + unhide = "keybind" ) default boolean changeCursor() { @@ -111,22 +148,11 @@ public interface AntiDragConfig extends Config name = "Cursor", description = "Select which cursor you wish to use", hidden = true, - unhide = "changeCursor", - position = 7 + unhide = "keybind", + position = 8 ) default CustomCursor selectedCursor() { return CustomCursor.DRAGON_SCIMITAR; } - - @ConfigItem( - keyName = "alwaysOn", - name = "Always On", - description = "Makes the anti-drag always active and disables the hotkey toggle", - position = 8 - ) - default boolean alwaysOn() - { - return false; - } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/antidrag/AntiDragPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/antidrag/AntiDragPlugin.java index 0167cbc648..687ee9bc20 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/antidrag/AntiDragPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/antidrag/AntiDragPlugin.java @@ -52,7 +52,7 @@ import net.runelite.client.util.HotkeyListener; public class AntiDragPlugin extends Plugin { private static final int DEFAULT_DELAY = 5; - private static final String CONFIG_GROUP_NAME = "antiDrag"; + private boolean toggleDrag; @Inject @@ -85,10 +85,11 @@ public class AntiDragPlugin extends Plugin @Override protected void startUp() throws Exception { - keyManager.registerKeyListener(hotkeyListener); - toggleDrag = config.alwaysOn(); - enableAntiDrag(); - + if (config.keybind()) + { + keyManager.registerKeyListener(hotkeyListener); + } + client.setInventoryDragDelay(config.alwaysOn() ? config.dragDelay() : DEFAULT_DELAY); } @Override @@ -103,10 +104,23 @@ public class AntiDragPlugin extends Plugin @Subscribe public void onConfigChanged(ConfigChanged event) { - if (event.getGroup().equals(CONFIG_GROUP_NAME)) + if (event.getGroup().equals("antiDrag")) { - toggleDrag = config.alwaysOn(); - enableAntiDrag(); + if (event.getKey().equals("keybind")) + { + if (config.keybind()) + { + keyManager.registerKeyListener(hotkeyListener); + } + else + { + keyManager.unregisterKeyListener(hotkeyListener); + } + } + if (event.getKey().equals("alwaysOn")) + { + client.setInventoryDragDelay(config.alwaysOn() ? config.dragDelay() : DEFAULT_DELAY); + } } } @@ -123,18 +137,6 @@ public class AntiDragPlugin extends Plugin } } - private void enableAntiDrag() - { - if (toggleDrag) - { - client.setInventoryDragDelay(config.dragDelay()); - } - else - { - client.setInventoryDragDelay(DEFAULT_DELAY); - } - } - private final HotkeyListener hotkeyListener = new HotkeyListener(() -> config.key()) { @Override @@ -170,6 +172,4 @@ public class AntiDragPlugin extends Plugin } } }; - - } From 38d9800d10479795d2f1b97563aac30128d4aaf1 Mon Sep 17 00:00:00 2001 From: Owain van Brakel Date: Fri, 28 Jun 2019 22:11:57 +0200 Subject: [PATCH 17/58] Convert game thread events to singletons (#794) * Convert game thread events to singletons * Fix checkstyle * Fix copy paste error --- .../runelite/api/events/AnimationChanged.java | 7 ++ .../api/events/AreaSoundEffectPlayed.java | 7 ++ .../runelite/api/events/BeforeMenuRender.java | 7 ++ .../net/runelite/api/events/BeforeRender.java | 6 ++ .../api/events/BoostedLevelChanged.java | 7 ++ .../runelite/api/events/CannonballFired.java | 6 ++ .../net/runelite/api/events/ChatMessage.java | 9 ++- .../net/runelite/api/events/ClanChanged.java | 11 ++- .../runelite/api/events/ClanMemberJoined.java | 11 ++- .../runelite/api/events/ClanMemberLeft.java | 11 ++- .../net/runelite/api/events/ClientTick.java | 6 ++ .../runelite/api/events/CommandExecuted.java | 11 ++- .../api/events/DecorativeObjectChanged.java | 7 ++ .../api/events/DecorativeObjectDespawned.java | 7 ++ .../api/events/DecorativeObjectSpawned.java | 7 ++ .../api/events/DraggingWidgetChanged.java | 7 ++ .../api/events/ExperienceChanged.java | 7 ++ .../api/events/GameObjectChanged.java | 7 ++ .../api/events/GameObjectDespawned.java | 7 ++ .../api/events/GameObjectSpawned.java | 7 ++ .../runelite/api/events/GameStateChanged.java | 7 ++ .../net/runelite/api/events/GameTick.java | 9 ++- .../api/events/GrandExchangeOfferChanged.java | 7 ++ .../api/events/GraphicsObjectCreated.java | 14 +++- .../api/events/GroundObjectChanged.java | 7 ++ .../api/events/GroundObjectDespawned.java | 7 ++ .../api/events/GroundObjectSpawned.java | 7 ++ .../runelite/api/events/HitsplatApplied.java | 7 ++ .../runelite/api/events/InteractChanged.java | 7 ++ .../api/events/InteractingChanged.java | 16 +++- .../api/events/ItemContainerChanged.java | 14 +++- .../runelite/api/events/ItemDespawned.java | 16 +++- .../api/events/ItemQuantityChanged.java | 19 +++-- .../net/runelite/api/events/ItemSpawned.java | 15 +++- .../runelite/api/events/LocalPlayerDeath.java | 6 ++ .../runelite/api/events/MenuEntryAdded.java | 9 ++- .../net/runelite/api/events/MenuOpened.java | 7 ++ .../api/events/MenuOptionClicked.java | 7 ++ .../api/events/MenuShouldLeftClick.java | 7 ++ .../api/events/NameableNameChanged.java | 13 ++- .../runelite/api/events/NpcActionChanged.java | 7 ++ .../net/runelite/api/events/NpcDespawned.java | 13 ++- .../net/runelite/api/events/NpcSpawned.java | 13 ++- .../api/events/OverheadTextChanged.java | 15 +++- .../runelite/api/events/PlayerDespawned.java | 13 ++- .../api/events/PlayerMenuOptionClicked.java | 7 ++ .../api/events/PlayerMenuOptionsChanged.java | 7 ++ .../runelite/api/events/PlayerSpawned.java | 13 ++- .../runelite/api/events/PostHealthBar.java | 7 ++ .../api/events/PostItemDefinition.java | 7 ++ .../runelite/api/events/ProjectileMoved.java | 7 ++ .../api/events/ProjectileSpawned.java | 7 ++ .../runelite/api/events/RemovedFriend.java | 13 ++- .../api/events/ResizeableChanged.java | 7 ++ .../api/events/ScriptCallbackEvent.java | 7 ++ .../api/events/SoundEffectPlayed.java | 7 ++ .../api/events/SpotAnimationChanged.java | 7 ++ .../runelite/api/events/UsernameChanged.java | 6 ++ .../api/events/VarClientIntChanged.java | 11 ++- .../api/events/VarClientStrChanged.java | 11 ++- .../runelite/api/events/VarbitChanged.java | 7 ++ .../api/events/WallObjectChanged.java | 7 ++ .../api/events/WallObjectDespawned.java | 7 ++ .../api/events/WallObjectSpawned.java | 7 ++ .../api/events/WidgetHiddenChanged.java | 7 ++ .../net/runelite/api/events/WidgetLoaded.java | 7 ++ .../api/events/WidgetMenuOptionClicked.java | 7 ++ .../runelite/api/events/WidgetPositioned.java | 9 ++- .../runelite/api/events/WorldListLoad.java | 13 ++- .../net/runelite/client/callback/Hooks.java | 9 +-- .../runelite/client/chat/CommandManager.java | 4 +- .../runelite/client/menus/MenuManager.java | 4 +- .../plugins/devtools/DevToolsPlugin.java | 10 +-- .../freezetimers/FreezeTimersPlugin.java | 2 +- .../client/util/GameEventManager.java | 22 +++-- .../attackstyles/AttackStylesPluginTest.java | 6 +- .../plugins/cerberus/CerberusPluginTest.java | 2 +- .../ChatNotificationsPluginTest.java | 2 +- .../plugins/cooking/CookingPluginTest.java | 2 +- .../plugins/emojis/EmojiPluginTest.java | 8 +- .../idlenotifier/IdleNotifierPluginTest.java | 81 +++++++++++-------- .../motherlode/MotherlodePluginTest.java | 10 ++- .../screenshot/ScreenshotPluginTest.java | 16 ++-- .../plugins/slayer/SlayerPluginTest.java | 26 +++--- .../net/runelite/mixins/RSActorMixin.java | 17 ++-- .../net/runelite/mixins/RSClanChatMixin.java | 6 +- .../net/runelite/mixins/RSClientMixin.java | 42 ++++++---- .../runelite/mixins/RSFriendSystemMixin.java | 3 +- .../mixins/RSGraphicsObjectMixin.java | 3 +- .../runelite/mixins/RSGroundItemMixin.java | 7 +- .../mixins/RSHealthBarDefinitionMixin.java | 2 +- .../runelite/mixins/RSItemContainerMixin.java | 3 +- .../mixins/RSItemDefinitionMixin.java | 2 +- .../runelite/mixins/RSNPCDefinitionMixin.java | 2 +- .../java/net/runelite/mixins/RSNPCMixin.java | 4 +- .../runelite/mixins/RSProjectileMixin.java | 4 +- .../java/net/runelite/mixins/RSTileMixin.java | 44 ++++++---- .../net/runelite/mixins/RSVarcsMixin.java | 8 +- .../net/runelite/mixins/RSWidgetMixin.java | 4 +- .../net/runelite/mixins/RSWorldMixin.java | 3 +- .../net/runelite/mixins/ScriptVMMixin.java | 2 +- .../net/runelite/mixins/SoundEffectMixin.java | 4 +- 102 files changed, 756 insertions(+), 220 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/events/AnimationChanged.java b/runelite-api/src/main/java/net/runelite/api/events/AnimationChanged.java index 0c4e1d5b68..9d3bf12a07 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/AnimationChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/AnimationChanged.java @@ -20,6 +20,13 @@ import net.runelite.api.Actor; @Data public class AnimationChanged { + public static final AnimationChanged INSTANCE = new AnimationChanged(); + + private AnimationChanged() + { + // noop + } + /** * The actor that has entered a new animation. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/AreaSoundEffectPlayed.java b/runelite-api/src/main/java/net/runelite/api/events/AreaSoundEffectPlayed.java index 488bff8264..4fb1a120a6 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/AreaSoundEffectPlayed.java +++ b/runelite-api/src/main/java/net/runelite/api/events/AreaSoundEffectPlayed.java @@ -29,6 +29,13 @@ import lombok.Data; @Data public class AreaSoundEffectPlayed { + public static final AreaSoundEffectPlayed INSTANCE = new AreaSoundEffectPlayed(); + + private AreaSoundEffectPlayed() + { + // noop + } + private int soundId; private int sceneX; private int sceneY; diff --git a/runelite-api/src/main/java/net/runelite/api/events/BeforeMenuRender.java b/runelite-api/src/main/java/net/runelite/api/events/BeforeMenuRender.java index 5d1e10994b..db6d1de3f3 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/BeforeMenuRender.java +++ b/runelite-api/src/main/java/net/runelite/api/events/BeforeMenuRender.java @@ -29,6 +29,13 @@ import lombok.Data; @Data public class BeforeMenuRender { + public static final BeforeMenuRender INSTANCE = new BeforeMenuRender(); + + private BeforeMenuRender() + { + // noop + } + private boolean consumed; public void consume() diff --git a/runelite-api/src/main/java/net/runelite/api/events/BeforeRender.java b/runelite-api/src/main/java/net/runelite/api/events/BeforeRender.java index 741041e1e0..73c004d4b3 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/BeforeRender.java +++ b/runelite-api/src/main/java/net/runelite/api/events/BeforeRender.java @@ -29,4 +29,10 @@ package net.runelite.api.events; */ public class BeforeRender { + public static final BeforeRender INSTANCE = new BeforeRender(); + + private BeforeRender() + { + // noop + } } diff --git a/runelite-api/src/main/java/net/runelite/api/events/BoostedLevelChanged.java b/runelite-api/src/main/java/net/runelite/api/events/BoostedLevelChanged.java index a465e3b407..e38a043e9a 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/BoostedLevelChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/BoostedLevelChanged.java @@ -44,6 +44,13 @@ import lombok.Data; @Data public class BoostedLevelChanged { + public static final BoostedLevelChanged INSTANCE = new BoostedLevelChanged(); + + private BoostedLevelChanged() + { + // noop + } + /** * The skill that has had its level modified. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/CannonballFired.java b/runelite-api/src/main/java/net/runelite/api/events/CannonballFired.java index 077a88096d..c44789965a 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/CannonballFired.java +++ b/runelite-api/src/main/java/net/runelite/api/events/CannonballFired.java @@ -29,4 +29,10 @@ package net.runelite.api.events; */ public class CannonballFired { + public static final CannonballFired INSTANCE = new CannonballFired(); + + private CannonballFired() + { + // noop + } } diff --git a/runelite-api/src/main/java/net/runelite/api/events/ChatMessage.java b/runelite-api/src/main/java/net/runelite/api/events/ChatMessage.java index 791ec350b3..5b464d0807 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/ChatMessage.java +++ b/runelite-api/src/main/java/net/runelite/api/events/ChatMessage.java @@ -28,7 +28,6 @@ import net.runelite.api.ChatMessageType; import net.runelite.api.MessageNode; import lombok.AllArgsConstructor; import lombok.Data; -import lombok.NoArgsConstructor; /** * An event where a new chat message is received. @@ -40,9 +39,15 @@ import lombok.NoArgsConstructor; */ @Data @AllArgsConstructor -@NoArgsConstructor public class ChatMessage { + public static final ChatMessage INSTANCE = new ChatMessage(); + + private ChatMessage() + { + // noop + } + /** * The underlying MessageNode for the message. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/ClanChanged.java b/runelite-api/src/main/java/net/runelite/api/events/ClanChanged.java index e39dbc400e..de9ae6798e 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/ClanChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/ClanChanged.java @@ -24,14 +24,21 @@ */ package net.runelite.api.events; -import lombok.Value; +import lombok.Data; /** * An event where the client has joined or left a clan chat. */ -@Value +@Data public class ClanChanged { + public static final ClanChanged INSTANCE = new ClanChanged(); + + private ClanChanged() + { + // noop + } + /** * Whether or not the client is now in a clan chat. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/ClanMemberJoined.java b/runelite-api/src/main/java/net/runelite/api/events/ClanMemberJoined.java index c0a694555b..81a9a96fd6 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/ClanMemberJoined.java +++ b/runelite-api/src/main/java/net/runelite/api/events/ClanMemberJoined.java @@ -25,11 +25,18 @@ package net.runelite.api.events; import net.runelite.api.ClanMember; -import lombok.Value; +import lombok.Data; -@Value +@Data public class ClanMemberJoined { + public static final ClanMemberJoined INSTANCE = new ClanMemberJoined(); + + private ClanMemberJoined() + { + // noop + } + /** * The ClanMember that joined */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/ClanMemberLeft.java b/runelite-api/src/main/java/net/runelite/api/events/ClanMemberLeft.java index c403261532..75e46e5e1d 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/ClanMemberLeft.java +++ b/runelite-api/src/main/java/net/runelite/api/events/ClanMemberLeft.java @@ -25,11 +25,18 @@ package net.runelite.api.events; import net.runelite.api.ClanMember; -import lombok.Value; +import lombok.Data; -@Value +@Data public class ClanMemberLeft { + public static final ClanMemberLeft INSTANCE = new ClanMemberLeft(); + + private ClanMemberLeft() + { + // noop + } + /** * The ClanMember that left */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/ClientTick.java b/runelite-api/src/main/java/net/runelite/api/events/ClientTick.java index 369ff7982a..6874f4145c 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/ClientTick.java +++ b/runelite-api/src/main/java/net/runelite/api/events/ClientTick.java @@ -29,4 +29,10 @@ package net.runelite.api.events; */ public class ClientTick { + public static final ClientTick INSTANCE = new ClientTick(); + + private ClientTick() + { + // noop + } } diff --git a/runelite-api/src/main/java/net/runelite/api/events/CommandExecuted.java b/runelite-api/src/main/java/net/runelite/api/events/CommandExecuted.java index d0dfae5ff2..2f170642e8 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/CommandExecuted.java +++ b/runelite-api/src/main/java/net/runelite/api/events/CommandExecuted.java @@ -24,7 +24,7 @@ */ package net.runelite.api.events; -import lombok.Value; +import lombok.Data; /** * An event where a command has been used in the chat. @@ -41,9 +41,16 @@ import lombok.Value; * set the command field to an empty string. For example, the message ":: hello world!" * will set command to "" and arguments to ["hello", "world!"]. */ -@Value +@Data public class CommandExecuted { + public static final CommandExecuted INSTANCE = new CommandExecuted(); + + private CommandExecuted() + { + // noop + } + /** * The name of the command entered. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/DecorativeObjectChanged.java b/runelite-api/src/main/java/net/runelite/api/events/DecorativeObjectChanged.java index a18683d7b4..161f3c6b19 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/DecorativeObjectChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/DecorativeObjectChanged.java @@ -35,6 +35,13 @@ import lombok.Data; @Data public class DecorativeObjectChanged { + public static final DecorativeObjectChanged INSTANCE = new DecorativeObjectChanged(); + + private DecorativeObjectChanged() + { + // noop + } + /** * The affected tile. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/DecorativeObjectDespawned.java b/runelite-api/src/main/java/net/runelite/api/events/DecorativeObjectDespawned.java index 94c06488c7..efa9f657db 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/DecorativeObjectDespawned.java +++ b/runelite-api/src/main/java/net/runelite/api/events/DecorativeObjectDespawned.java @@ -35,6 +35,13 @@ import lombok.Data; @Data public class DecorativeObjectDespawned { + public static final DecorativeObjectDespawned INSTANCE = new DecorativeObjectDespawned(); + + private DecorativeObjectDespawned() + { + // noop + } + /** * The affected tile. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/DecorativeObjectSpawned.java b/runelite-api/src/main/java/net/runelite/api/events/DecorativeObjectSpawned.java index fe8d17862f..a25b493743 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/DecorativeObjectSpawned.java +++ b/runelite-api/src/main/java/net/runelite/api/events/DecorativeObjectSpawned.java @@ -34,6 +34,13 @@ import lombok.Data; @Data public class DecorativeObjectSpawned { + public static final DecorativeObjectSpawned INSTANCE = new DecorativeObjectSpawned(); + + private DecorativeObjectSpawned() + { + // noop + } + /** * The affected tile. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/DraggingWidgetChanged.java b/runelite-api/src/main/java/net/runelite/api/events/DraggingWidgetChanged.java index 8aef02d570..8f1179f76e 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/DraggingWidgetChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/DraggingWidgetChanged.java @@ -33,6 +33,13 @@ import lombok.Data; @Data public class DraggingWidgetChanged { + public static final DraggingWidgetChanged INSTANCE = new DraggingWidgetChanged(); + + private DraggingWidgetChanged() + { + // noop + } + /** * Whether a widget is currently being dragged. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/ExperienceChanged.java b/runelite-api/src/main/java/net/runelite/api/events/ExperienceChanged.java index 587efd4f41..980fbfcd75 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/ExperienceChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/ExperienceChanged.java @@ -34,6 +34,13 @@ import lombok.Data; @Data public class ExperienceChanged { + public static final ExperienceChanged INSTANCE = new ExperienceChanged(); + + private ExperienceChanged() + { + // noop + } + /** * The modified skill. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/GameObjectChanged.java b/runelite-api/src/main/java/net/runelite/api/events/GameObjectChanged.java index 117ad81f60..5cdba0899c 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/GameObjectChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/GameObjectChanged.java @@ -34,6 +34,13 @@ import net.runelite.api.Tile; @Data public class GameObjectChanged { + public static final GameObjectChanged INSTANCE = new GameObjectChanged(); + + private GameObjectChanged() + { + // noop + } + /** * The affected tile. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/GameObjectDespawned.java b/runelite-api/src/main/java/net/runelite/api/events/GameObjectDespawned.java index 5d2e9fad1a..28091ca793 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/GameObjectDespawned.java +++ b/runelite-api/src/main/java/net/runelite/api/events/GameObjectDespawned.java @@ -34,6 +34,13 @@ import lombok.Data; @Data public class GameObjectDespawned { + public static final GameObjectDespawned INSTANCE = new GameObjectDespawned(); + + private GameObjectDespawned() + { + // noop + } + /** * The affected tile. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/GameObjectSpawned.java b/runelite-api/src/main/java/net/runelite/api/events/GameObjectSpawned.java index 5dfc301066..e7965b1164 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/GameObjectSpawned.java +++ b/runelite-api/src/main/java/net/runelite/api/events/GameObjectSpawned.java @@ -34,6 +34,13 @@ import lombok.Data; @Data public class GameObjectSpawned { + public static final GameObjectSpawned INSTANCE = new GameObjectSpawned(); + + private GameObjectSpawned() + { + // noop + } + /** * The affected tile. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/GameStateChanged.java b/runelite-api/src/main/java/net/runelite/api/events/GameStateChanged.java index 2a0b61fc40..f89c8ecb43 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/GameStateChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/GameStateChanged.java @@ -33,6 +33,13 @@ import lombok.Data; @Data public class GameStateChanged { + public static final GameStateChanged INSTANCE = new GameStateChanged(); + + private GameStateChanged() + { + // noop + } + /** * The new game state. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/GameTick.java b/runelite-api/src/main/java/net/runelite/api/events/GameTick.java index aefa7fc3e4..2bf035633d 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/GameTick.java +++ b/runelite-api/src/main/java/net/runelite/api/events/GameTick.java @@ -24,8 +24,6 @@ */ package net.runelite.api.events; -import lombok.Data; - // The NPC update event seem to run every server tick, // but having the game tick event after all packets // have been processed is typically more useful. @@ -43,7 +41,12 @@ import lombok.Data; * Note that occurrences that take place purely on the client, such as right * click menus, are independent of the game tick. */ -@Data public class GameTick { + public static final GameTick INSTANCE = new GameTick(); + + private GameTick() + { + // noop + } } diff --git a/runelite-api/src/main/java/net/runelite/api/events/GrandExchangeOfferChanged.java b/runelite-api/src/main/java/net/runelite/api/events/GrandExchangeOfferChanged.java index 7260063760..7a49ee6f8d 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/GrandExchangeOfferChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/GrandExchangeOfferChanged.java @@ -44,6 +44,13 @@ import lombok.Data; @Data public class GrandExchangeOfferChanged { + public static final GrandExchangeOfferChanged INSTANCE = new GrandExchangeOfferChanged(); + + private GrandExchangeOfferChanged() + { + // noop + } + /** * The offer that has been modified. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/GraphicsObjectCreated.java b/runelite-api/src/main/java/net/runelite/api/events/GraphicsObjectCreated.java index f2cc4f35a9..4d624e716f 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/GraphicsObjectCreated.java +++ b/runelite-api/src/main/java/net/runelite/api/events/GraphicsObjectCreated.java @@ -25,16 +25,24 @@ package net.runelite.api.events; import net.runelite.api.GraphicsObject; -import lombok.Value; + +import lombok.Data; /** * An event where a new {@link GraphicsObject} has been created. */ -@Value +@Data public class GraphicsObjectCreated { + public static final GraphicsObjectCreated INSTANCE = new GraphicsObjectCreated(); + + private GraphicsObjectCreated() + { + // noop + } + /** * The newly created graphics object. */ - private final GraphicsObject graphicsObject; + private GraphicsObject graphicsObject; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/GroundObjectChanged.java b/runelite-api/src/main/java/net/runelite/api/events/GroundObjectChanged.java index 8fa97ae503..836780f6a5 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/GroundObjectChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/GroundObjectChanged.java @@ -34,6 +34,13 @@ import lombok.Data; @Data public class GroundObjectChanged { + public static final GroundObjectChanged INSTANCE = new GroundObjectChanged(); + + private GroundObjectChanged() + { + // noop + } + /** * The affected tile. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/GroundObjectDespawned.java b/runelite-api/src/main/java/net/runelite/api/events/GroundObjectDespawned.java index 54bb6dfbe0..0ff488f3b4 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/GroundObjectDespawned.java +++ b/runelite-api/src/main/java/net/runelite/api/events/GroundObjectDespawned.java @@ -34,6 +34,13 @@ import lombok.Data; @Data public class GroundObjectDespawned { + public static final GroundObjectDespawned INSTANCE = new GroundObjectDespawned(); + + private GroundObjectDespawned() + { + // noop + } + /** * The affected tile. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/GroundObjectSpawned.java b/runelite-api/src/main/java/net/runelite/api/events/GroundObjectSpawned.java index af1f15ab6f..7964707840 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/GroundObjectSpawned.java +++ b/runelite-api/src/main/java/net/runelite/api/events/GroundObjectSpawned.java @@ -34,6 +34,13 @@ import lombok.Data; @Data public class GroundObjectSpawned { + public static final GroundObjectSpawned INSTANCE = new GroundObjectSpawned(); + + private GroundObjectSpawned() + { + // noop + } + /** * The affected tile. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/HitsplatApplied.java b/runelite-api/src/main/java/net/runelite/api/events/HitsplatApplied.java index f96a0f08d7..3cf8986299 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/HitsplatApplied.java +++ b/runelite-api/src/main/java/net/runelite/api/events/HitsplatApplied.java @@ -38,6 +38,13 @@ import lombok.Data; @Data public class HitsplatApplied { + public static final HitsplatApplied INSTANCE = new HitsplatApplied(); + + private HitsplatApplied() + { + // noop + } + /** * The actor the hitsplat was applied to. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/InteractChanged.java b/runelite-api/src/main/java/net/runelite/api/events/InteractChanged.java index fcd2e54a43..f606eba5d0 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/InteractChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/InteractChanged.java @@ -30,5 +30,12 @@ import lombok.Data; @Data public class InteractChanged { + public static final InteractChanged INSTANCE = new InteractChanged(); + + private InteractChanged() + { + // noop + } + private Actor actor; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/InteractingChanged.java b/runelite-api/src/main/java/net/runelite/api/events/InteractingChanged.java index c76abd349f..4549527b4d 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/InteractingChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/InteractingChanged.java @@ -1,18 +1,26 @@ package net.runelite.api.events; import net.runelite.api.Actor; -import lombok.Value; + +import lombok.Data; /** * An event called when the actor an actor is interacting with changes */ -@Value +@Data public class InteractingChanged { - private final Actor source; + public static final InteractingChanged INSTANCE = new InteractingChanged(); + + private InteractingChanged() + { + // noop + } + + private Actor source; /** * Target actor, may be null */ - private final Actor target; + private Actor target; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/ItemContainerChanged.java b/runelite-api/src/main/java/net/runelite/api/events/ItemContainerChanged.java index ec0ff6627b..e68ad8fb44 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/ItemContainerChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/ItemContainerChanged.java @@ -25,7 +25,8 @@ package net.runelite.api.events; import net.runelite.api.ItemContainer; -import lombok.Value; + +import lombok.Data; /** * An event called whenever the stack size of an {@link api.Item} @@ -38,11 +39,18 @@ import lombok.Value; *
  • Dropping an item
  • * */ -@Value +@Data public class ItemContainerChanged { + public static final ItemContainerChanged INSTANCE = new ItemContainerChanged(); + + private ItemContainerChanged() + { + // noop + } + /** * The modified item container. */ - private final ItemContainer itemContainer; + private ItemContainer itemContainer; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/ItemDespawned.java b/runelite-api/src/main/java/net/runelite/api/events/ItemDespawned.java index aeb90ede92..1c22d7ce59 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/ItemDespawned.java +++ b/runelite-api/src/main/java/net/runelite/api/events/ItemDespawned.java @@ -26,15 +26,23 @@ package net.runelite.api.events; import net.runelite.api.Item; import net.runelite.api.Tile; -import lombok.Value; + +import lombok.Data; /** * Called when an item pile despawns from the ground. When the client loads a new scene, * all item piles are implicitly despawned, and despawn events will not be sent. */ -@Value +@Data public class ItemDespawned { - private final Tile tile; - private final Item item; + public static final ItemDespawned INSTANCE = new ItemDespawned(); + + private ItemDespawned() + { + // noop + } + + private Tile tile; + private Item item; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/ItemQuantityChanged.java b/runelite-api/src/main/java/net/runelite/api/events/ItemQuantityChanged.java index 2cb1048f06..ee273f407d 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/ItemQuantityChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/ItemQuantityChanged.java @@ -26,16 +26,23 @@ package net.runelite.api.events; import net.runelite.api.Item; import net.runelite.api.Tile; -import lombok.Value; +import lombok.Data; /** * Called when the quantity of an item pile changes. */ -@Value +@Data public class ItemQuantityChanged { - private final Item item; - private final Tile tile; - private final int oldQuantity; - private final int newQuantity; + public static final ItemQuantityChanged INSTANCE = new ItemQuantityChanged(); + + private ItemQuantityChanged() + { + // noop + } + + private Item item; + private Tile tile; + private int oldQuantity; + private int newQuantity; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/ItemSpawned.java b/runelite-api/src/main/java/net/runelite/api/events/ItemSpawned.java index eb41b3e530..aae38645c2 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/ItemSpawned.java +++ b/runelite-api/src/main/java/net/runelite/api/events/ItemSpawned.java @@ -26,15 +26,22 @@ package net.runelite.api.events; import net.runelite.api.Item; import net.runelite.api.Tile; -import lombok.Value; +import lombok.Data; /** * Called when an item pile spawns on the ground. When the client loads a new scene, * all item piles are implicitly reset and a new spawn event will be sent. */ -@Value +@Data public class ItemSpawned { - private final Tile tile; - private final Item item; + public static final ItemSpawned INSTANCE = new ItemSpawned(); + + private ItemSpawned() + { + // noop + } + + private Tile tile; + private Item item; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/LocalPlayerDeath.java b/runelite-api/src/main/java/net/runelite/api/events/LocalPlayerDeath.java index e46b815f49..0cf8f33c76 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/LocalPlayerDeath.java +++ b/runelite-api/src/main/java/net/runelite/api/events/LocalPlayerDeath.java @@ -29,4 +29,10 @@ package net.runelite.api.events; */ public class LocalPlayerDeath { + public static final LocalPlayerDeath INSTANCE = new LocalPlayerDeath(); + + private LocalPlayerDeath() + { + // noop + } } diff --git a/runelite-api/src/main/java/net/runelite/api/events/MenuEntryAdded.java b/runelite-api/src/main/java/net/runelite/api/events/MenuEntryAdded.java index 37f73ec792..0f1cafcf15 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/MenuEntryAdded.java +++ b/runelite-api/src/main/java/net/runelite/api/events/MenuEntryAdded.java @@ -35,10 +35,17 @@ import net.runelite.api.MenuEntry; @AllArgsConstructor public class MenuEntryAdded { + public static final MenuEntryAdded INSTANCE = new MenuEntryAdded(); + + private MenuEntryAdded() + { + // noop + } + /** * The MenuEntry object that was actually added */ - private final MenuEntry menuEntry; + private MenuEntry menuEntry; public String getOption() { diff --git a/runelite-api/src/main/java/net/runelite/api/events/MenuOpened.java b/runelite-api/src/main/java/net/runelite/api/events/MenuOpened.java index 3a7b04c287..634d8f46f3 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/MenuOpened.java +++ b/runelite-api/src/main/java/net/runelite/api/events/MenuOpened.java @@ -33,6 +33,13 @@ import lombok.Data; @Data public class MenuOpened { + public static final MenuOpened INSTANCE = new MenuOpened(); + + private MenuOpened() + { + // noop + } + /** * The menu entries in the newly opened menu. *

    diff --git a/runelite-api/src/main/java/net/runelite/api/events/MenuOptionClicked.java b/runelite-api/src/main/java/net/runelite/api/events/MenuOptionClicked.java index 2180458228..770fb6966e 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/MenuOptionClicked.java +++ b/runelite-api/src/main/java/net/runelite/api/events/MenuOptionClicked.java @@ -42,6 +42,13 @@ import net.runelite.api.MenuEntry; @Data public class MenuOptionClicked { + public static final MenuOptionClicked INSTANCE = new MenuOptionClicked(); + + private MenuOptionClicked() + { + // noop + } + public MenuOptionClicked(MenuEntry entry) { menuEntry = entry; diff --git a/runelite-api/src/main/java/net/runelite/api/events/MenuShouldLeftClick.java b/runelite-api/src/main/java/net/runelite/api/events/MenuShouldLeftClick.java index c36372ff2c..85561790ab 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/MenuShouldLeftClick.java +++ b/runelite-api/src/main/java/net/runelite/api/events/MenuShouldLeftClick.java @@ -33,6 +33,13 @@ import lombok.Data; @Data public class MenuShouldLeftClick { + public static final MenuShouldLeftClick INSTANCE = new MenuShouldLeftClick(); + + private MenuShouldLeftClick() + { + // noop + } + /** * If set to true, the menu will open on left click. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/NameableNameChanged.java b/runelite-api/src/main/java/net/runelite/api/events/NameableNameChanged.java index afcc43973d..839f81dcec 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/NameableNameChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/NameableNameChanged.java @@ -25,16 +25,23 @@ package net.runelite.api.events; import net.runelite.api.Nameable; -import lombok.Value; +import lombok.Data; /** * An event where a {@link Nameable} has had their name changed. */ -@Value +@Data public class NameableNameChanged { + public static final NameableNameChanged INSTANCE = new NameableNameChanged(); + + private NameableNameChanged() + { + // noop + } + /** * The nameable that changed names. */ - private final Nameable nameable; + private Nameable nameable; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/NpcActionChanged.java b/runelite-api/src/main/java/net/runelite/api/events/NpcActionChanged.java index 35838e067c..f5906ad03f 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/NpcActionChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/NpcActionChanged.java @@ -33,6 +33,13 @@ import net.runelite.api.NPCDefinition; @Data public class NpcActionChanged { + public static final NpcActionChanged INSTANCE = new NpcActionChanged(); + + private NpcActionChanged() + { + // noop + } + /** * The NPC composition that has been changed. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/NpcDespawned.java b/runelite-api/src/main/java/net/runelite/api/events/NpcDespawned.java index f1bc72344f..f5b20af29e 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/NpcDespawned.java +++ b/runelite-api/src/main/java/net/runelite/api/events/NpcDespawned.java @@ -26,18 +26,25 @@ package net.runelite.api.events; import net.runelite.api.Actor; import net.runelite.api.NPC; -import lombok.Value; +import lombok.Data; /** * An event where an {@link NPC} has despawned. */ -@Value +@Data public class NpcDespawned { + public static final NpcDespawned INSTANCE = new NpcDespawned(); + + private NpcDespawned() + { + // noop + } + /** * The despawned NPC. */ - private final NPC npc; + private NPC npc; public Actor getActor() { diff --git a/runelite-api/src/main/java/net/runelite/api/events/NpcSpawned.java b/runelite-api/src/main/java/net/runelite/api/events/NpcSpawned.java index 911d3780c1..226fa9918b 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/NpcSpawned.java +++ b/runelite-api/src/main/java/net/runelite/api/events/NpcSpawned.java @@ -26,18 +26,25 @@ package net.runelite.api.events; import net.runelite.api.Actor; import net.runelite.api.NPC; -import lombok.Value; +import lombok.Data; /** * An event where an {@link NPC} has spawned. */ -@Value +@Data public class NpcSpawned { + public static final NpcSpawned INSTANCE = new NpcSpawned(); + + private NpcSpawned() + { + // noop + } + /** * The spawned NPC. */ - private final NPC npc; + private NPC npc; public Actor getActor() { diff --git a/runelite-api/src/main/java/net/runelite/api/events/OverheadTextChanged.java b/runelite-api/src/main/java/net/runelite/api/events/OverheadTextChanged.java index a8a22730fd..242c2c07c5 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/OverheadTextChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/OverheadTextChanged.java @@ -1,12 +1,19 @@ package net.runelite.api.events; import net.runelite.api.Actor; -import lombok.Value; +import lombok.Data; -@Value +@Data public class OverheadTextChanged { - private final Actor actor; + public static final OverheadTextChanged INSTANCE = new OverheadTextChanged(); - private final String overheadText; + private OverheadTextChanged() + { + // noop + } + + private Actor actor; + + private String overheadText; } \ No newline at end of file diff --git a/runelite-api/src/main/java/net/runelite/api/events/PlayerDespawned.java b/runelite-api/src/main/java/net/runelite/api/events/PlayerDespawned.java index 7094f3bd1a..3740d6179d 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/PlayerDespawned.java +++ b/runelite-api/src/main/java/net/runelite/api/events/PlayerDespawned.java @@ -26,20 +26,27 @@ package net.runelite.api.events; import net.runelite.api.Actor; import net.runelite.api.Player; -import lombok.Value; +import lombok.Data; /** * An event where a {@link Player} has despawned. *

    * Note: This event does not get called for the local player. */ -@Value +@Data public class PlayerDespawned { + public static final PlayerDespawned INSTANCE = new PlayerDespawned(); + + private PlayerDespawned() + { + // noop + } + /** * The despawned player. */ - private final Player player; + private Player player; public Actor getActor() { diff --git a/runelite-api/src/main/java/net/runelite/api/events/PlayerMenuOptionClicked.java b/runelite-api/src/main/java/net/runelite/api/events/PlayerMenuOptionClicked.java index dcfb0421ca..b085b0e5bb 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/PlayerMenuOptionClicked.java +++ b/runelite-api/src/main/java/net/runelite/api/events/PlayerMenuOptionClicked.java @@ -33,6 +33,13 @@ import lombok.Data; @Data public class PlayerMenuOptionClicked { + public static final PlayerMenuOptionClicked INSTANCE = new PlayerMenuOptionClicked(); + + private PlayerMenuOptionClicked() + { + // noop + } + /** * The menu option clicked. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/PlayerMenuOptionsChanged.java b/runelite-api/src/main/java/net/runelite/api/events/PlayerMenuOptionsChanged.java index d33aa4d06c..4ce089baed 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/PlayerMenuOptionsChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/PlayerMenuOptionsChanged.java @@ -29,6 +29,13 @@ import lombok.Data; @Data public class PlayerMenuOptionsChanged { + public static final PlayerMenuOptionsChanged INSTANCE = new PlayerMenuOptionsChanged(); + + private PlayerMenuOptionsChanged() + { + // noop + } + /** * Index in playerOptions which changed. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/PlayerSpawned.java b/runelite-api/src/main/java/net/runelite/api/events/PlayerSpawned.java index 31cc16a9c0..aafcf5ec01 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/PlayerSpawned.java +++ b/runelite-api/src/main/java/net/runelite/api/events/PlayerSpawned.java @@ -26,18 +26,25 @@ package net.runelite.api.events; import net.runelite.api.Actor; import net.runelite.api.Player; -import lombok.Value; +import lombok.Data; /** * An event where a {@link Player} has spawned. */ -@Value +@Data public class PlayerSpawned { + public static final PlayerSpawned INSTANCE = new PlayerSpawned(); + + private PlayerSpawned() + { + // noop + } + /** * The spawned player. */ - private final Player player; + private Player player; public Actor getActor() { diff --git a/runelite-api/src/main/java/net/runelite/api/events/PostHealthBar.java b/runelite-api/src/main/java/net/runelite/api/events/PostHealthBar.java index c8896ff945..5f0f7addee 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/PostHealthBar.java +++ b/runelite-api/src/main/java/net/runelite/api/events/PostHealthBar.java @@ -30,5 +30,12 @@ import lombok.Data; @Data public class PostHealthBar { + public static final PostHealthBar INSTANCE = new PostHealthBar(); + + private PostHealthBar() + { + // noop + } + private HealthBar healthBar; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/PostItemDefinition.java b/runelite-api/src/main/java/net/runelite/api/events/PostItemDefinition.java index 35718b5ea9..66b4dbb7ce 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/PostItemDefinition.java +++ b/runelite-api/src/main/java/net/runelite/api/events/PostItemDefinition.java @@ -34,6 +34,13 @@ import net.runelite.api.ItemDefinition; @Data public class PostItemDefinition { + public static final PostItemDefinition INSTANCE = new PostItemDefinition(); + + private PostItemDefinition() + { + // noop + } + /** * The newly created item. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/ProjectileMoved.java b/runelite-api/src/main/java/net/runelite/api/events/ProjectileMoved.java index 70d73d7026..4deb6879bc 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/ProjectileMoved.java +++ b/runelite-api/src/main/java/net/runelite/api/events/ProjectileMoved.java @@ -37,6 +37,13 @@ import lombok.Data; @Data public class ProjectileMoved { + public static final ProjectileMoved INSTANCE = new ProjectileMoved(); + + private ProjectileMoved() + { + // noop + } + /** * The projectile being moved. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/ProjectileSpawned.java b/runelite-api/src/main/java/net/runelite/api/events/ProjectileSpawned.java index f5ba810a5f..d415e3b850 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/ProjectileSpawned.java +++ b/runelite-api/src/main/java/net/runelite/api/events/ProjectileSpawned.java @@ -34,6 +34,13 @@ import lombok.Data; @Data public class ProjectileSpawned { + public static final ProjectileSpawned INSTANCE = new ProjectileSpawned(); + + private ProjectileSpawned() + { + // noop + } + /** * The spawned projectile. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/RemovedFriend.java b/runelite-api/src/main/java/net/runelite/api/events/RemovedFriend.java index c60cd13c33..e8e7f24511 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/RemovedFriend.java +++ b/runelite-api/src/main/java/net/runelite/api/events/RemovedFriend.java @@ -24,16 +24,23 @@ */ package net.runelite.api.events; -import lombok.Value; +import lombok.Data; /** * An event where a request to remove a friend is sent to the server. */ -@Value +@Data public class RemovedFriend { + public static final RemovedFriend INSTANCE = new RemovedFriend(); + + private RemovedFriend() + { + // noop + } + /** * The name of the removed friend. */ - private final String name; + private String name; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/ResizeableChanged.java b/runelite-api/src/main/java/net/runelite/api/events/ResizeableChanged.java index 146f92ac38..084d0eb0f6 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/ResizeableChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/ResizeableChanged.java @@ -34,6 +34,13 @@ import lombok.Data; @Data public class ResizeableChanged { + public static final ResizeableChanged INSTANCE = new ResizeableChanged(); + + private ResizeableChanged() + { + // noop + } + /** * Whether the game is in resizable mode. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/ScriptCallbackEvent.java b/runelite-api/src/main/java/net/runelite/api/events/ScriptCallbackEvent.java index 0c1bdd5ee9..fc36c9ae4d 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/ScriptCallbackEvent.java +++ b/runelite-api/src/main/java/net/runelite/api/events/ScriptCallbackEvent.java @@ -33,6 +33,13 @@ import lombok.Data; @Data public class ScriptCallbackEvent { + public static final ScriptCallbackEvent INSTANCE = new ScriptCallbackEvent(); + + private ScriptCallbackEvent() + { + // noop + } + /** * The script being called. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/SoundEffectPlayed.java b/runelite-api/src/main/java/net/runelite/api/events/SoundEffectPlayed.java index 127a9a2646..049229c6e4 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/SoundEffectPlayed.java +++ b/runelite-api/src/main/java/net/runelite/api/events/SoundEffectPlayed.java @@ -29,6 +29,13 @@ import lombok.Data; @Data public class SoundEffectPlayed { + public static final SoundEffectPlayed INSTANCE = new SoundEffectPlayed(); + + private SoundEffectPlayed() + { + // noop + } + private int soundId; private int delay; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/SpotAnimationChanged.java b/runelite-api/src/main/java/net/runelite/api/events/SpotAnimationChanged.java index 79b8643d2c..6bfe72baec 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/SpotAnimationChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/SpotAnimationChanged.java @@ -21,6 +21,13 @@ import net.runelite.api.Actor; @Data public class SpotAnimationChanged { + public static final SpotAnimationChanged INSTANCE = new SpotAnimationChanged(); + + private SpotAnimationChanged() + { + // noop + } + /** * The actor that has had their graphic changed. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/UsernameChanged.java b/runelite-api/src/main/java/net/runelite/api/events/UsernameChanged.java index 91bed8a304..3dea001150 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/UsernameChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/UsernameChanged.java @@ -32,4 +32,10 @@ package net.runelite.api.events; */ public class UsernameChanged { + public static final UsernameChanged INSTANCE = new UsernameChanged(); + + private UsernameChanged() + { + // noop + } } diff --git a/runelite-api/src/main/java/net/runelite/api/events/VarClientIntChanged.java b/runelite-api/src/main/java/net/runelite/api/events/VarClientIntChanged.java index 82c2c404d4..ab9892b6de 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/VarClientIntChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/VarClientIntChanged.java @@ -25,13 +25,20 @@ */ package net.runelite.api.events; -import lombok.Value; +import lombok.Data; /** * An event where a varbit integer has changed. */ -@Value +@Data public class VarClientIntChanged { + public static final VarClientIntChanged INSTANCE = new VarClientIntChanged(); + + private VarClientIntChanged() + { + // noop + } + private int index; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/VarClientStrChanged.java b/runelite-api/src/main/java/net/runelite/api/events/VarClientStrChanged.java index e1d7da6ffa..7aca876b72 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/VarClientStrChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/VarClientStrChanged.java @@ -25,13 +25,20 @@ */ package net.runelite.api.events; -import lombok.Value; +import lombok.Data; /** * An event where a varbit string has changed. */ -@Value +@Data public class VarClientStrChanged { + public static final VarClientStrChanged INSTANCE = new VarClientStrChanged(); + + private VarClientStrChanged() + { + // noop + } + private int index; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/VarbitChanged.java b/runelite-api/src/main/java/net/runelite/api/events/VarbitChanged.java index 9680e54ac4..04b8a30ab3 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/VarbitChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/VarbitChanged.java @@ -34,6 +34,13 @@ import lombok.Data; @Data public class VarbitChanged { + public static final VarbitChanged INSTANCE = new VarbitChanged(); + + private VarbitChanged() + { + // noop + } + /** * Index in the varp array that was changed. * For varplayer, this is the varplayer id. diff --git a/runelite-api/src/main/java/net/runelite/api/events/WallObjectChanged.java b/runelite-api/src/main/java/net/runelite/api/events/WallObjectChanged.java index bea7686602..59ccec9a72 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/WallObjectChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/WallObjectChanged.java @@ -34,6 +34,13 @@ import lombok.Data; @Data public class WallObjectChanged { + public static final WallObjectChanged INSTANCE = new WallObjectChanged(); + + private WallObjectChanged() + { + // noop + } + /** * The affected tile. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/WallObjectDespawned.java b/runelite-api/src/main/java/net/runelite/api/events/WallObjectDespawned.java index 6ac609a46f..6c34cbc9ac 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/WallObjectDespawned.java +++ b/runelite-api/src/main/java/net/runelite/api/events/WallObjectDespawned.java @@ -34,6 +34,13 @@ import lombok.Data; @Data public class WallObjectDespawned { + public static final WallObjectDespawned INSTANCE = new WallObjectDespawned(); + + private WallObjectDespawned() + { + // noop + } + /** * The affected tile. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/WallObjectSpawned.java b/runelite-api/src/main/java/net/runelite/api/events/WallObjectSpawned.java index dc22e07f7d..babf7d50b8 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/WallObjectSpawned.java +++ b/runelite-api/src/main/java/net/runelite/api/events/WallObjectSpawned.java @@ -34,6 +34,13 @@ import lombok.Data; @Data public class WallObjectSpawned { + public static final WallObjectSpawned INSTANCE = new WallObjectSpawned(); + + private WallObjectSpawned() + { + // noop + } + /** * The affected tile. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/WidgetHiddenChanged.java b/runelite-api/src/main/java/net/runelite/api/events/WidgetHiddenChanged.java index 2cf434faa4..91883db505 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/WidgetHiddenChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/WidgetHiddenChanged.java @@ -33,6 +33,13 @@ import lombok.Data; @Data public class WidgetHiddenChanged { + public static final WidgetHiddenChanged INSTANCE = new WidgetHiddenChanged(); + + private WidgetHiddenChanged() + { + // noop + } + /** * The affected widget. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/WidgetLoaded.java b/runelite-api/src/main/java/net/runelite/api/events/WidgetLoaded.java index c71bc41634..bf9c258412 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/WidgetLoaded.java +++ b/runelite-api/src/main/java/net/runelite/api/events/WidgetLoaded.java @@ -32,6 +32,13 @@ import lombok.Data; @Data public class WidgetLoaded { + public static final WidgetLoaded INSTANCE = new WidgetLoaded(); + + private WidgetLoaded() + { + // noop + } + /** * The group ID of the loaded widget. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/WidgetMenuOptionClicked.java b/runelite-api/src/main/java/net/runelite/api/events/WidgetMenuOptionClicked.java index 6945e88790..abe0962d8e 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/WidgetMenuOptionClicked.java +++ b/runelite-api/src/main/java/net/runelite/api/events/WidgetMenuOptionClicked.java @@ -33,6 +33,13 @@ import lombok.Data; @Data public class WidgetMenuOptionClicked { + public static final WidgetMenuOptionClicked INSTANCE = new WidgetMenuOptionClicked(); + + private WidgetMenuOptionClicked() + { + // noop + } + /** * The clicked menu option. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/WidgetPositioned.java b/runelite-api/src/main/java/net/runelite/api/events/WidgetPositioned.java index d5479e3485..6f58e9fe07 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/WidgetPositioned.java +++ b/runelite-api/src/main/java/net/runelite/api/events/WidgetPositioned.java @@ -24,13 +24,16 @@ */ package net.runelite.api.events; -import lombok.Value; - /** * An event where the position of a {@link net.runelite.api.widgets.Widget} * relative to its parent has changed. */ -@Value public class WidgetPositioned { + public static final WidgetPositioned INSTANCE = new WidgetPositioned(); + + private WidgetPositioned() + { + // noop + } } diff --git a/runelite-api/src/main/java/net/runelite/api/events/WorldListLoad.java b/runelite-api/src/main/java/net/runelite/api/events/WorldListLoad.java index 67fa28797e..f060a50139 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/WorldListLoad.java +++ b/runelite-api/src/main/java/net/runelite/api/events/WorldListLoad.java @@ -25,13 +25,20 @@ package net.runelite.api.events; import net.runelite.api.World; -import lombok.Value; +import lombok.Data; /** * Event when the world list is loaded for the world switcher */ -@Value +@Data public class WorldListLoad { - private final World[] worlds; + public static final WorldListLoad INSTANCE = new WorldListLoad(); + + private WorldListLoad() + { + // noop + } + + private World[] worlds; } diff --git a/runelite-client/src/main/java/net/runelite/client/callback/Hooks.java b/runelite-client/src/main/java/net/runelite/client/callback/Hooks.java index ca25fa84a8..df29fd2c04 100644 --- a/runelite-client/src/main/java/net/runelite/client/callback/Hooks.java +++ b/runelite-client/src/main/java/net/runelite/client/callback/Hooks.java @@ -87,9 +87,6 @@ public class Hooks implements Callbacks private static final OverlayRenderer renderer = injector.getInstance(OverlayRenderer.class); private static final OverlayManager overlayManager = injector.getInstance(OverlayManager.class); - private static final GameTick GAME_TICK = new GameTick(); - private static final BeforeRender BEFORE_RENDER = new BeforeRender(); - @Inject private EventBus eventBus; @@ -151,13 +148,13 @@ public class Hooks implements Callbacks deferredEventBus.replay(); - eventBus.post(GAME_TICK); + eventBus.post(GameTick.INSTANCE); int tick = client.getTickCount(); client.setTickCount(tick + 1); } - eventBus.post(BEFORE_RENDER); + eventBus.post(BeforeRender.INSTANCE); clientThread.invoke(); @@ -511,7 +508,7 @@ public class Hooks implements Callbacks public static boolean drawMenu() { - BeforeMenuRender event = new BeforeMenuRender(); + BeforeMenuRender event = BeforeMenuRender.INSTANCE; client.getCallbacks().post(event); return event.isConsumed(); } diff --git a/runelite-client/src/main/java/net/runelite/client/chat/CommandManager.java b/runelite-client/src/main/java/net/runelite/client/chat/CommandManager.java index 7529fc6d56..cf5292991e 100644 --- a/runelite-client/src/main/java/net/runelite/client/chat/CommandManager.java +++ b/runelite-client/src/main/java/net/runelite/client/chat/CommandManager.java @@ -114,7 +114,9 @@ public class CommandManager String command = split[0]; String[] args = Arrays.copyOfRange(split, 1, split.length); - CommandExecuted commandExecuted = new CommandExecuted(command, args); + CommandExecuted commandExecuted = CommandExecuted.INSTANCE; + commandExecuted.setCommand(command); + commandExecuted.setArguments(args); eventBus.post(commandExecuted); } diff --git a/runelite-client/src/main/java/net/runelite/client/menus/MenuManager.java b/runelite-client/src/main/java/net/runelite/client/menus/MenuManager.java index 6c674c1d14..c723bfa326 100644 --- a/runelite-client/src/main/java/net/runelite/client/menus/MenuManager.java +++ b/runelite-client/src/main/java/net/runelite/client/menus/MenuManager.java @@ -429,7 +429,7 @@ public class MenuManager if (curMenuOption.getMenuTarget().equals(event.getTarget()) && curMenuOption.getMenuOption().equals(event.getOption())) { - WidgetMenuOptionClicked customMenu = new WidgetMenuOptionClicked(); + WidgetMenuOptionClicked customMenu = WidgetMenuOptionClicked.INSTANCE; customMenu.setMenuOption(event.getOption()); customMenu.setMenuTarget(event.getTarget()); customMenu.setWidget(curMenuOption.getWidget()); @@ -444,7 +444,7 @@ public class MenuManager // username (level-42) or username String username = Text.removeTags(target).split("[(]")[0].trim(); - PlayerMenuOptionClicked playerMenuOptionClicked = new PlayerMenuOptionClicked(); + PlayerMenuOptionClicked playerMenuOptionClicked = PlayerMenuOptionClicked.INSTANCE; playerMenuOptionClicked.setMenuOption(event.getOption()); playerMenuOptionClicked.setMenuTarget(username); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPlugin.java index cc64835acb..9fd09a8ac8 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPlugin.java @@ -258,7 +258,7 @@ public class DevToolsPlugin extends Plugin int value = Integer.parseInt(args[1]); client.setVarpValue(client.getVarps(), varp, value); client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "Set VarPlayer " + varp + " to " + value, null); - VarbitChanged varbitChanged = new VarbitChanged(); + VarbitChanged varbitChanged = VarbitChanged.INSTANCE; varbitChanged.setIndex(varp); eventBus.post(varbitChanged); // fake event break; @@ -276,7 +276,7 @@ public class DevToolsPlugin extends Plugin int value = Integer.parseInt(args[1]); client.setVarbitValue(client.getVarps(), varbit, value); client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "Set varbit " + varbit + " to " + value, null); - eventBus.post(new VarbitChanged()); // fake event + eventBus.post(VarbitChanged.INSTANCE); // fake event break; } case "addxp": @@ -293,7 +293,7 @@ public class DevToolsPlugin extends Plugin client.queueChangedSkill(skill); - ExperienceChanged experienceChanged = new ExperienceChanged(); + ExperienceChanged experienceChanged = ExperienceChanged.INSTANCE; experienceChanged.setSkill(skill); eventBus.post(experienceChanged); break; @@ -312,11 +312,11 @@ public class DevToolsPlugin extends Plugin client.queueChangedSkill(skill); - ExperienceChanged experienceChanged = new ExperienceChanged(); + ExperienceChanged experienceChanged = ExperienceChanged.INSTANCE; experienceChanged.setSkill(skill); eventBus.post(experienceChanged); - BoostedLevelChanged boostedLevelChanged = new BoostedLevelChanged(); + BoostedLevelChanged boostedLevelChanged = BoostedLevelChanged.INSTANCE; boostedLevelChanged.setSkill(skill); eventBus.post(boostedLevelChanged); break; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/freezetimers/FreezeTimersPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/freezetimers/FreezeTimersPlugin.java index e66279aa4d..8ac9d913d7 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/freezetimers/FreezeTimersPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/freezetimers/FreezeTimersPlugin.java @@ -121,7 +121,7 @@ public class FreezeTimersPlugin extends Plugin { if (prayerTracker.getSpotanimLastTick(actor) != actor.getSpotAnimation()) { - SpotAnimationChanged callback = new SpotAnimationChanged(); + SpotAnimationChanged callback = SpotAnimationChanged.INSTANCE; callback.setActor(actor); client.getCallbacks().post(callback); } diff --git a/runelite-client/src/main/java/net/runelite/client/util/GameEventManager.java b/runelite-client/src/main/java/net/runelite/client/util/GameEventManager.java index edaedc856f..94359890e8 100644 --- a/runelite-client/src/main/java/net/runelite/client/util/GameEventManager.java +++ b/runelite-client/src/main/java/net/runelite/client/util/GameEventManager.java @@ -118,7 +118,9 @@ public class GameEventManager if (itemContainer != null) { - eventBus.post(new ItemContainerChanged(itemContainer)); + ItemContainerChanged event = ItemContainerChanged.INSTANCE; + event.setItemContainer(itemContainer); + eventBus.post(event); } } @@ -126,7 +128,8 @@ public class GameEventManager { if (npc != null) { - final NpcSpawned npcSpawned = new NpcSpawned(npc); + final NpcSpawned npcSpawned = NpcSpawned.INSTANCE; + npcSpawned.setNpc(npc); eventBus.post(npcSpawned); } } @@ -135,7 +138,8 @@ public class GameEventManager { if (player != null) { - final PlayerSpawned playerSpawned = new PlayerSpawned(player); + final PlayerSpawned playerSpawned = PlayerSpawned.INSTANCE; + playerSpawned.setPlayer(player); eventBus.post(playerSpawned); } } @@ -144,7 +148,7 @@ public class GameEventManager { Optional.ofNullable(tile.getWallObject()).ifPresent(object -> { - final WallObjectSpawned objectSpawned = new WallObjectSpawned(); + final WallObjectSpawned objectSpawned = WallObjectSpawned.INSTANCE; objectSpawned.setTile(tile); objectSpawned.setWallObject(object); eventBus.post(objectSpawned); @@ -152,7 +156,7 @@ public class GameEventManager Optional.ofNullable(tile.getDecorativeObject()).ifPresent(object -> { - final DecorativeObjectSpawned objectSpawned = new DecorativeObjectSpawned(); + final DecorativeObjectSpawned objectSpawned = DecorativeObjectSpawned.INSTANCE; objectSpawned.setTile(tile); objectSpawned.setDecorativeObject(object); eventBus.post(objectSpawned); @@ -160,7 +164,7 @@ public class GameEventManager Optional.ofNullable(tile.getGroundObject()).ifPresent(object -> { - final GroundObjectSpawned objectSpawned = new GroundObjectSpawned(); + final GroundObjectSpawned objectSpawned = GroundObjectSpawned.INSTANCE; objectSpawned.setTile(tile); objectSpawned.setGroundObject(object); eventBus.post(objectSpawned); @@ -170,7 +174,7 @@ public class GameEventManager .filter(Objects::nonNull) .forEach(object -> { - final GameObjectSpawned objectSpawned = new GameObjectSpawned(); + final GameObjectSpawned objectSpawned = GameObjectSpawned.INSTANCE; objectSpawned.setTile(tile); objectSpawned.setGameObject(object); eventBus.post(objectSpawned); @@ -186,7 +190,9 @@ public class GameEventManager current = current.getNext(); - final ItemSpawned itemSpawned = new ItemSpawned(tile, item); + final ItemSpawned itemSpawned = ItemSpawned.INSTANCE; + itemSpawned.setItem(item); + itemSpawned.setTile(tile); eventBus.post(itemSpawned); } }); diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/attackstyles/AttackStylesPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/attackstyles/AttackStylesPluginTest.java index 2060d0d536..6a94e305e1 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/attackstyles/AttackStylesPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/attackstyles/AttackStylesPluginTest.java @@ -93,14 +93,14 @@ public class AttackStylesPluginTest when(client.getVar(VarPlayer.ATTACK_STYLE)).thenReturn(AttackStyle.ACCURATE.ordinal()); // verify that earning xp in a warned skill will display red text on the widget - attackPlugin.onVarbitChanged(new VarbitChanged()); + attackPlugin.onVarbitChanged(VarbitChanged.INSTANCE); assertTrue(attackPlugin.isWarnedSkillSelected()); // Switch to attack style that doesn't give attack xp when(client.getVar(VarPlayer.ATTACK_STYLE)).thenReturn(AttackStyle.AGGRESSIVE.ordinal()); // Verify the widget will now display white text - attackPlugin.onVarbitChanged(new VarbitChanged()); + attackPlugin.onVarbitChanged(VarbitChanged.INSTANCE); warnedSkills = attackPlugin.getWarnedSkills(); assertTrue(warnedSkills.contains(Skill.ATTACK)); assertFalse(attackPlugin.isWarnedSkillSelected()); @@ -129,7 +129,7 @@ public class AttackStylesPluginTest // equip type_4 weapon type on player when(client.getVar(Varbits.EQUIPPED_WEAPON_TYPE)).thenReturn(WeaponType.TYPE_4.ordinal()); - attackPlugin.onVarbitChanged(new VarbitChanged()); + attackPlugin.onVarbitChanged(VarbitChanged.INSTANCE); // Verify there is a warned skill Set warnedSkills = attackPlugin.getWarnedSkills(); diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/cerberus/CerberusPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/cerberus/CerberusPluginTest.java index 4f35f7b174..daac7907de 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/cerberus/CerberusPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/cerberus/CerberusPluginTest.java @@ -71,7 +71,7 @@ public class CerberusPluginTest mockNpc(new LocalPoint(2, 5)), mockNpc(new LocalPoint(1, 5)) )); - cerberusPlugin.onGameTick(new GameTick()); + cerberusPlugin.onGameTick(GameTick.INSTANCE); // Expected sort is by lowest y first, then by lowest x assertEquals(ghosts.get(0).getLocalLocation(), new LocalPoint(0, 0)); diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsPluginTest.java index c30c8a4e9e..58cf5ac99e 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsPluginTest.java @@ -83,7 +83,7 @@ public class ChatNotificationsPluginTest MessageNode messageNode = mock(MessageNode.class); when(messageNode.getValue()).thenReturn("Deathbeam, Deathbeam OSRS"); - ChatMessage chatMessage = new ChatMessage(); + ChatMessage chatMessage = ChatMessage.INSTANCE; chatMessage.setType(ChatMessageType.PUBLICCHAT); chatMessage.setMessageNode(messageNode); diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/cooking/CookingPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/cooking/CookingPluginTest.java index 6b8334e99d..f05a53c8f9 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/cooking/CookingPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/cooking/CookingPluginTest.java @@ -118,7 +118,7 @@ public class CookingPluginTest when(config.fermentTimer()).thenReturn(true); when(client.getLocalPlayer()).thenReturn(player); - SpotAnimationChanged graphicChanged = new SpotAnimationChanged(); + SpotAnimationChanged graphicChanged = SpotAnimationChanged.INSTANCE; graphicChanged.setActor(player); cookingPlugin.onSpotAnimationChanged(graphicChanged); diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/emojis/EmojiPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/emojis/EmojiPluginTest.java index 3427246946..ebf58ca625 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/emojis/EmojiPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/emojis/EmojiPluginTest.java @@ -73,7 +73,7 @@ public class EmojiPluginTest when(client.createIndexedSprite()).thenReturn(mock(IndexedSprite.class)); // Trip emoji loading - GameStateChanged gameStateChanged = new GameStateChanged(); + GameStateChanged gameStateChanged = GameStateChanged.INSTANCE; gameStateChanged.setGameState(GameState.LOGGED_IN); emojiPlugin.onGameStateChanged(gameStateChanged); @@ -81,7 +81,7 @@ public class EmojiPluginTest // With chat recolor, message may be wrapped in col tags when(messageNode.getValue()).thenReturn(":) :) :)"); - ChatMessage chatMessage = new ChatMessage(); + ChatMessage chatMessage = ChatMessage.INSTANCE; chatMessage.setType(ChatMessageType.PUBLICCHAT); chatMessage.setMessageNode(messageNode); @@ -98,14 +98,14 @@ public class EmojiPluginTest when(client.createIndexedSprite()).thenReturn(mock(IndexedSprite.class)); // Trip emoji loading - GameStateChanged gameStateChanged = new GameStateChanged(); + GameStateChanged gameStateChanged = GameStateChanged.INSTANCE; gameStateChanged.setGameState(GameState.LOGGED_IN); emojiPlugin.onGameStateChanged(gameStateChanged); MessageNode messageNode = mock(MessageNode.class); when(messageNode.getValue()).thenReturn(":D"); - ChatMessage chatMessage = new ChatMessage(); + ChatMessage chatMessage = ChatMessage.INSTANCE; chatMessage.setType(ChatMessageType.PUBLICCHAT); chatMessage.setMessageNode(messageNode); diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/idlenotifier/IdleNotifierPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/idlenotifier/IdleNotifierPluginTest.java index 51dc7842e0..b8373c81b3 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/idlenotifier/IdleNotifierPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/idlenotifier/IdleNotifierPluginTest.java @@ -132,13 +132,13 @@ public class IdleNotifierPluginTest public void checkAnimationIdle() { when(player.getAnimation()).thenReturn(AnimationID.WOODCUTTING_BRONZE); - AnimationChanged animationChanged = new AnimationChanged(); + AnimationChanged animationChanged = AnimationChanged.INSTANCE; animationChanged.setActor(player); plugin.onAnimationChanged(animationChanged); - plugin.onGameTick(new GameTick()); + plugin.onGameTick(GameTick.INSTANCE); when(player.getAnimation()).thenReturn(AnimationID.IDLE); plugin.onAnimationChanged(animationChanged); - plugin.onGameTick(new GameTick()); + plugin.onGameTick(GameTick.INSTANCE); verify(notifier).notify("[" + PLAYER_NAME + "] is now idle!"); } @@ -146,16 +146,16 @@ public class IdleNotifierPluginTest public void checkAnimationReset() { when(player.getAnimation()).thenReturn(AnimationID.WOODCUTTING_BRONZE); - AnimationChanged animationChanged = new AnimationChanged(); + AnimationChanged animationChanged = AnimationChanged.INSTANCE; animationChanged.setActor(player); plugin.onAnimationChanged(animationChanged); - plugin.onGameTick(new GameTick()); + plugin.onGameTick(GameTick.INSTANCE); when(player.getAnimation()).thenReturn(AnimationID.LOOKING_INTO); plugin.onAnimationChanged(animationChanged); - plugin.onGameTick(new GameTick()); + plugin.onGameTick(GameTick.INSTANCE); when(player.getAnimation()).thenReturn(AnimationID.IDLE); plugin.onAnimationChanged(animationChanged); - plugin.onGameTick(new GameTick()); + plugin.onGameTick(GameTick.INSTANCE); verify(notifier, times(0)).notify(any()); } @@ -163,14 +163,14 @@ public class IdleNotifierPluginTest public void checkAnimationLogout() { when(player.getAnimation()).thenReturn(AnimationID.WOODCUTTING_BRONZE); - AnimationChanged animationChanged = new AnimationChanged(); + AnimationChanged animationChanged = AnimationChanged.INSTANCE; animationChanged.setActor(player); plugin.onAnimationChanged(animationChanged); - plugin.onGameTick(new GameTick()); + plugin.onGameTick(GameTick.INSTANCE); // Logout when(client.getGameState()).thenReturn(GameState.LOGIN_SCREEN); - GameStateChanged gameStateChanged = new GameStateChanged(); + GameStateChanged gameStateChanged = GameStateChanged.INSTANCE; gameStateChanged.setGameState(GameState.LOGIN_SCREEN); plugin.onGameStateChanged(gameStateChanged); @@ -182,7 +182,7 @@ public class IdleNotifierPluginTest // Tick when(player.getAnimation()).thenReturn(AnimationID.IDLE); plugin.onAnimationChanged(animationChanged); - plugin.onGameTick(new GameTick()); + plugin.onGameTick(GameTick.INSTANCE); verify(notifier, times(0)).notify(any()); } @@ -190,11 +190,16 @@ public class IdleNotifierPluginTest public void checkCombatIdle() { when(player.getInteracting()).thenReturn(monster); - plugin.onInteractingChanged(new InteractingChanged(player, monster)); - plugin.onGameTick(new GameTick()); + InteractingChanged event = InteractingChanged.INSTANCE; + event.setSource(player); + event.setTarget(monster); + plugin.onInteractingChanged(event); + plugin.onGameTick(GameTick.INSTANCE); when(player.getInteracting()).thenReturn(null); - plugin.onInteractingChanged(new InteractingChanged(player, null)); - plugin.onGameTick(new GameTick()); + event.setSource(player); + event.setTarget(null); + plugin.onInteractingChanged(event); + plugin.onGameTick(GameTick.INSTANCE); verify(notifier).notify("[" + PLAYER_NAME + "] is now out of combat!"); } @@ -202,27 +207,37 @@ public class IdleNotifierPluginTest public void checkCombatReset() { when(player.getInteracting()).thenReturn(monster); - plugin.onInteractingChanged(new InteractingChanged(player, monster)); - plugin.onGameTick(new GameTick()); + InteractingChanged event = InteractingChanged.INSTANCE; + event.setSource(player); + event.setTarget(monster); + plugin.onInteractingChanged(event); + plugin.onGameTick(GameTick.INSTANCE); when(player.getInteracting()).thenReturn(randomEvent); - plugin.onInteractingChanged(new InteractingChanged(player, randomEvent)); - plugin.onGameTick(new GameTick()); + event.setSource(player); + event.setTarget(randomEvent); + plugin.onInteractingChanged(event); + plugin.onGameTick(GameTick.INSTANCE); when(player.getInteracting()).thenReturn(null); - plugin.onInteractingChanged(new InteractingChanged(player, null)); - plugin.onGameTick(new GameTick()); + event.setSource(player); + event.setTarget(null); + plugin.onInteractingChanged(event); + plugin.onGameTick(GameTick.INSTANCE); verify(notifier, times(0)).notify(any()); } @Test public void checkCombatLogout() { - plugin.onInteractingChanged(new InteractingChanged(player, monster)); + InteractingChanged event = InteractingChanged.INSTANCE; + event.setSource(player); + event.setTarget(monster); + plugin.onInteractingChanged(event); when(player.getInteracting()).thenReturn(monster); - plugin.onGameTick(new GameTick()); + plugin.onGameTick(GameTick.INSTANCE); // Logout when(client.getGameState()).thenReturn(GameState.LOGIN_SCREEN); - GameStateChanged gameStateChanged = new GameStateChanged(); + GameStateChanged gameStateChanged = GameStateChanged.INSTANCE; gameStateChanged.setGameState(GameState.LOGIN_SCREEN); plugin.onGameStateChanged(gameStateChanged); @@ -233,8 +248,10 @@ public class IdleNotifierPluginTest // Tick when(player.getInteracting()).thenReturn(null); - plugin.onInteractingChanged(new InteractingChanged(player, null)); - plugin.onGameTick(new GameTick()); + event.setSource(player); + event.setTarget(null); + plugin.onInteractingChanged(event); + plugin.onGameTick(GameTick.INSTANCE); verify(notifier, times(0)).notify(any()); } @@ -245,11 +262,11 @@ public class IdleNotifierPluginTest when(client.getMouseIdleTicks()).thenReturn(80_000); // But player is being damaged (is in combat) - final HitsplatApplied hitsplatApplied = new HitsplatApplied(); + final HitsplatApplied hitsplatApplied = HitsplatApplied.INSTANCE; hitsplatApplied.setActor(player); hitsplatApplied.setHitsplat(new Hitsplat(Hitsplat.HitsplatType.DAMAGE, 0, 0)); plugin.onHitsplatApplied(hitsplatApplied); - plugin.onGameTick(new GameTick()); + plugin.onGameTick(GameTick.INSTANCE); verify(notifier, times(0)).notify(any()); } @@ -262,8 +279,8 @@ public class IdleNotifierPluginTest when(client.getKeyboardIdleTicks()).thenReturn(80_000); when(client.getMouseIdleTicks()).thenReturn(14_500); - plugin.onGameTick(new GameTick()); - plugin.onGameTick(new GameTick()); + plugin.onGameTick(GameTick.INSTANCE); + plugin.onGameTick(GameTick.INSTANCE); verify(notifier, times(1)).notify(any()); } @@ -273,11 +290,11 @@ public class IdleNotifierPluginTest when(config.getSpecEnergyThreshold()).thenReturn(50); when(client.getVar(Matchers.eq(VarPlayer.SPECIAL_ATTACK_PERCENT))).thenReturn(400); // 40% - plugin.onGameTick(new GameTick()); // once to set lastSpecEnergy to 400 + plugin.onGameTick(GameTick.INSTANCE); // once to set lastSpecEnergy to 400 verify(notifier, never()).notify(any()); when(client.getVar(Matchers.eq(VarPlayer.SPECIAL_ATTACK_PERCENT))).thenReturn(500); // 50% - plugin.onGameTick(new GameTick()); + plugin.onGameTick(GameTick.INSTANCE); verify(notifier).notify(Matchers.eq("[" + PLAYER_NAME + "] has restored spec energy!")); } } \ No newline at end of file diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/motherlode/MotherlodePluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/motherlode/MotherlodePluginTest.java index 7f4c3bcbb0..3e00ae7b6d 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/motherlode/MotherlodePluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/motherlode/MotherlodePluginTest.java @@ -115,13 +115,13 @@ public class MotherlodePluginTest public void testOreCounter() { // set inMlm - GameStateChanged gameStateChanged = new GameStateChanged(); + GameStateChanged gameStateChanged = GameStateChanged.INSTANCE; gameStateChanged.setGameState(GameState.LOGGED_IN); motherlodePlugin.onGameStateChanged(gameStateChanged); // Initial sack count when(client.getVar(Varbits.SACK_NUMBER)).thenReturn(42); - motherlodePlugin.onVarbitChanged(new VarbitChanged()); + motherlodePlugin.onVarbitChanged(VarbitChanged.INSTANCE); // Create before inventory ItemContainer inventory = mock(ItemContainer.class); @@ -140,7 +140,7 @@ public class MotherlodePluginTest // Withdraw 20 when(client.getVar(Varbits.SACK_NUMBER)).thenReturn(22); - motherlodePlugin.onVarbitChanged(new VarbitChanged()); + motherlodePlugin.onVarbitChanged(VarbitChanged.INSTANCE); inventory = mock(ItemContainer.class); // +1 rune, +4 nugget, +2 coal, +1 addy @@ -162,7 +162,9 @@ public class MotherlodePluginTest when(client.getItemContainer(InventoryID.INVENTORY)).thenReturn(inventory); // Trigger comparison - motherlodePlugin.onItemContainerChanged(new ItemContainerChanged(inventory)); + ItemContainerChanged event = ItemContainerChanged.INSTANCE; + event.setItemContainer(inventory); + motherlodePlugin.onItemContainerChanged(event); verify(motherlodeSession).updateOreFound(ItemID.RUNITE_ORE, 1); verify(motherlodeSession).updateOreFound(ItemID.GOLDEN_NUGGET, 4); diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/screenshot/ScreenshotPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/screenshot/ScreenshotPluginTest.java index 9aff61c346..9efc27c57e 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/screenshot/ScreenshotPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/screenshot/ScreenshotPluginTest.java @@ -175,11 +175,11 @@ public class ScreenshotPluginTest assertEquals("Hitpoints(99)", screenshotPlugin.parseLevelUpWidget(LEVEL_UP_LEVEL)); - WidgetLoaded event = new WidgetLoaded(); + WidgetLoaded event = WidgetLoaded.INSTANCE; event.setGroupId(LEVEL_UP_GROUP_ID); screenshotPlugin.onWidgetLoaded(event); - GameTick tick = new GameTick(); + GameTick tick = GameTick.INSTANCE; screenshotPlugin.onGameTick(tick); verify(drawManager).requestNextFrameListener(Matchers.any(Consumer.class)); @@ -198,11 +198,11 @@ public class ScreenshotPluginTest assertEquals("Firemaking(9)", screenshotPlugin.parseLevelUpWidget(LEVEL_UP_LEVEL)); - WidgetLoaded event = new WidgetLoaded(); + WidgetLoaded event = WidgetLoaded.INSTANCE; event.setGroupId(LEVEL_UP_GROUP_ID); screenshotPlugin.onWidgetLoaded(event); - GameTick tick = new GameTick(); + GameTick tick = GameTick.INSTANCE; screenshotPlugin.onGameTick(tick); verify(drawManager).requestNextFrameListener(Matchers.any(Consumer.class)); @@ -221,11 +221,11 @@ public class ScreenshotPluginTest assertEquals("Attack(70)", screenshotPlugin.parseLevelUpWidget(LEVEL_UP_LEVEL)); - WidgetLoaded event = new WidgetLoaded(); + WidgetLoaded event = WidgetLoaded.INSTANCE; event.setGroupId(LEVEL_UP_GROUP_ID); screenshotPlugin.onWidgetLoaded(event); - GameTick tick = new GameTick(); + GameTick tick = GameTick.INSTANCE; screenshotPlugin.onGameTick(tick); verify(drawManager).requestNextFrameListener(Matchers.any(Consumer.class)); @@ -244,11 +244,11 @@ public class ScreenshotPluginTest assertEquals("Hunter(2)", screenshotPlugin.parseLevelUpWidget(DIALOG_SPRITE_TEXT)); - WidgetLoaded event = new WidgetLoaded(); + WidgetLoaded event = WidgetLoaded.INSTANCE; event.setGroupId(DIALOG_SPRITE_GROUP_ID); screenshotPlugin.onWidgetLoaded(event); - GameTick tick = new GameTick(); + GameTick tick = GameTick.INSTANCE; screenshotPlugin.onGameTick(tick); verify(drawManager).requestNextFrameListener(Matchers.any(Consumer.class)); diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/slayer/SlayerPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/slayer/SlayerPluginTest.java index 099a76d19b..c339b1de6e 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/slayer/SlayerPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/slayer/SlayerPluginTest.java @@ -155,7 +155,7 @@ public class SlayerPluginTest Widget npcDialog = mock(Widget.class); when(npcDialog.getText()).thenReturn(TASK_NEW); when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog); - slayerPlugin.onGameTick(new GameTick()); + slayerPlugin.onGameTick(GameTick.INSTANCE); assertEquals("Suqahs", slayerPlugin.getCurrentTask().getTaskName()); assertEquals(231, slayerPlugin.getCurrentTask().getAmount()); @@ -167,7 +167,7 @@ public class SlayerPluginTest Widget npcDialog = mock(Widget.class); when(npcDialog.getText()).thenReturn(TASK_NEW_KONAR); when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog); - slayerPlugin.onGameTick(new GameTick()); + slayerPlugin.onGameTick(GameTick.INSTANCE); assertEquals("Wyrms", slayerPlugin.getCurrentTask().getTaskName()); assertEquals(147, slayerPlugin.getCurrentTask().getAmount()); @@ -180,7 +180,7 @@ public class SlayerPluginTest Widget npcDialog = mock(Widget.class); when(npcDialog.getText()).thenReturn(TASK_NEW_KONAR_2); when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog); - slayerPlugin.onGameTick(new GameTick()); + slayerPlugin.onGameTick(GameTick.INSTANCE); assertEquals("Hellhounds", slayerPlugin.getCurrentTask().getTaskName()); assertEquals(142, slayerPlugin.getCurrentTask().getAmount()); @@ -193,7 +193,7 @@ public class SlayerPluginTest Widget npcDialog = mock(Widget.class); when(npcDialog.getText()).thenReturn(TASK_NEW_KONAR_3); when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog); - slayerPlugin.onGameTick(new GameTick()); + slayerPlugin.onGameTick(GameTick.INSTANCE); assertEquals("Trolls", slayerPlugin.getCurrentTask().getTaskName()); assertEquals(135, slayerPlugin.getCurrentTask().getAmount()); @@ -206,7 +206,7 @@ public class SlayerPluginTest Widget npcDialog = mock(Widget.class); when(npcDialog.getText()).thenReturn(TASK_NEW_FIRST); when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog); - slayerPlugin.onGameTick(new GameTick()); + slayerPlugin.onGameTick(GameTick.INSTANCE); assertEquals("goblins", slayerPlugin.getCurrentTask().getTaskName()); assertEquals(17, slayerPlugin.getCurrentTask().getAmount()); @@ -218,7 +218,7 @@ public class SlayerPluginTest Widget npcDialog = mock(Widget.class); when(npcDialog.getText()).thenReturn(TASK_NEW_NPC_CONTACT); when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog); - slayerPlugin.onGameTick(new GameTick()); + slayerPlugin.onGameTick(GameTick.INSTANCE); assertEquals("Suqahs", slayerPlugin.getCurrentTask().getTaskName()); assertEquals(211, slayerPlugin.getCurrentTask().getAmount()); @@ -230,7 +230,7 @@ public class SlayerPluginTest Widget npcDialog = mock(Widget.class); when(npcDialog.getText()).thenReturn(TASK_BOSS_NEW); when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog); - slayerPlugin.onGameTick(new GameTick()); + slayerPlugin.onGameTick(GameTick.INSTANCE); assertEquals("Vet'ion", slayerPlugin.getCurrentTask().getTaskName()); assertEquals(3, slayerPlugin.getCurrentTask().getAmount()); @@ -243,7 +243,7 @@ public class SlayerPluginTest Widget npcDialog = mock(Widget.class); when(npcDialog.getText()).thenReturn(TASK_BOSS_NEW_THE); when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog); - slayerPlugin.onGameTick(new GameTick()); + slayerPlugin.onGameTick(GameTick.INSTANCE); assertEquals("Chaos Elemental", slayerPlugin.getCurrentTask().getTaskName()); assertEquals(3, slayerPlugin.getCurrentTask().getAmount()); @@ -296,7 +296,7 @@ public class SlayerPluginTest Widget npcDialog = mock(Widget.class); when(npcDialog.getText()).thenReturn(TASK_EXISTING); when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog); - slayerPlugin.onGameTick(new GameTick()); + slayerPlugin.onGameTick(GameTick.INSTANCE); assertEquals("suqahs", slayerPlugin.getCurrentTask().getTaskName()); assertEquals(222, slayerPlugin.getCurrentTask().getAmount()); @@ -331,7 +331,7 @@ public class SlayerPluginTest ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "Perterter", TASK_POINTS, null, 0); slayerPlugin.onChatMessage(chatMessageEvent); - VarbitChanged varbitChanged = new VarbitChanged(); + VarbitChanged varbitChanged = VarbitChanged.INSTANCE; slayerPlugin.onVarbitChanged(varbitChanged); assertEquals(9, slayerPlugin.getStreak()); @@ -347,7 +347,7 @@ public class SlayerPluginTest ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "Perterter", TASK_LARGE_STREAK, null, 0); slayerPlugin.onChatMessage(chatMessageEvent); - VarbitChanged varbitChanged = new VarbitChanged(); + VarbitChanged varbitChanged = VarbitChanged.INSTANCE; slayerPlugin.onVarbitChanged(varbitChanged); assertEquals(2465, slayerPlugin.getStreak()); @@ -408,7 +408,7 @@ public class SlayerPluginTest when(slayerConfig.taskCommand()).thenReturn(true); when(chatClient.getTask(anyString())).thenReturn(task); - ChatMessage setMessage = new ChatMessage(); + ChatMessage setMessage = ChatMessage.INSTANCE; setMessage.setType(ChatMessageType.PUBLICCHAT); setMessage.setName("Adam"); setMessage.setMessageNode(mock(MessageNode.class)); @@ -430,7 +430,7 @@ public class SlayerPluginTest when(slayerConfig.taskCommand()).thenReturn(true); when(chatClient.getTask(anyString())).thenReturn(task); - ChatMessage chatMessage = new ChatMessage(); + ChatMessage chatMessage = ChatMessage.INSTANCE; chatMessage.setType(ChatMessageType.PUBLICCHAT); chatMessage.setName("Adam"); chatMessage.setMessageNode(mock(MessageNode.class)); diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSActorMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSActorMixin.java index f25c98e263..113e6a77cc 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSActorMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSActorMixin.java @@ -186,7 +186,7 @@ public abstract class RSActorMixin implements RSActor @Inject public void animationChanged(int idx) { - AnimationChanged animationChange = new AnimationChanged(); + AnimationChanged animationChange = AnimationChanged.INSTANCE; animationChange.setActor(this); client.getCallbacks().post(animationChange); } @@ -195,7 +195,7 @@ public abstract class RSActorMixin implements RSActor @Inject public void spotAnimationChanged(int idx) { - SpotAnimationChanged spotAnimationChanged = new SpotAnimationChanged(); + SpotAnimationChanged spotAnimationChanged = SpotAnimationChanged.INSTANCE; spotAnimationChanged.setActor(this); client.getCallbacks().post(spotAnimationChanged); } @@ -204,7 +204,9 @@ public abstract class RSActorMixin implements RSActor @Inject public void interactingChanged(int idx) { - InteractingChanged interactingChanged = new InteractingChanged(this, getInteracting()); + InteractingChanged interactingChanged = InteractingChanged.INSTANCE; + interactingChanged.setSource(this); + interactingChanged.setTarget(getInteracting()); client.getCallbacks().post(interactingChanged); } @@ -215,7 +217,10 @@ public abstract class RSActorMixin implements RSActor String overheadText = getOverheadText(); if (overheadText != null) { - OverheadTextChanged overheadTextChanged = new OverheadTextChanged(this, overheadText); + + OverheadTextChanged overheadTextChanged = OverheadTextChanged.INSTANCE; + overheadTextChanged.setActor(this); + overheadTextChanged.setOverheadText(overheadText); client.getCallbacks().post(overheadTextChanged); } } @@ -251,7 +256,7 @@ public abstract class RSActorMixin implements RSActor { client.getLogger().debug("You died!"); - LocalPlayerDeath event = new LocalPlayerDeath(); + LocalPlayerDeath event = LocalPlayerDeath.INSTANCE; client.getCallbacks().post(event); } else if (this instanceof RSNPC) @@ -278,7 +283,7 @@ public abstract class RSActorMixin implements RSActor public void applyActorHitsplat(int type, int value, int var3, int var4, int gameCycle, int duration) { final Hitsplat hitsplat = new Hitsplat(Hitsplat.HitsplatType.fromInteger(type), value, gameCycle + duration); - final HitsplatApplied event = new HitsplatApplied(); + final HitsplatApplied event = HitsplatApplied.INSTANCE; event.setActor(this); event.setHitsplat(hitsplat); client.getCallbacks().post(event); diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSClanChatMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSClanChatMixin.java index beacf0eec4..c829abf231 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSClanChatMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSClanChatMixin.java @@ -27,7 +27,8 @@ public abstract class RSClanChatMixin implements RSClanChat return; } - ClanMemberJoined event = new ClanMemberJoined(member); + ClanMemberJoined event = ClanMemberJoined.INSTANCE; + event.setMember(member); client.getCallbacks().postDeferred(event); } @@ -41,7 +42,8 @@ public abstract class RSClanChatMixin implements RSClanChat return; } - ClanMemberLeft event = new ClanMemberLeft(member); + ClanMemberLeft event = ClanMemberLeft.INSTANCE; + event.setMember(member); client.getCallbacks().postDeferred(event); } } diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java index 069c9a99d4..762dd86fa5 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java @@ -867,7 +867,7 @@ public abstract class RSClientMixin implements RSClient @Inject public static void draggingWidgetChanged(int idx) { - DraggingWidgetChanged draggingWidgetChanged = new DraggingWidgetChanged(); + DraggingWidgetChanged draggingWidgetChanged = DraggingWidgetChanged.INSTANCE; draggingWidgetChanged.setDraggingWidget(client.isDraggingWidget()); client.getCallbacks().post(draggingWidgetChanged); } @@ -905,7 +905,7 @@ public abstract class RSClientMixin implements RSClient if (loaded) { - WidgetLoaded event = new WidgetLoaded(); + WidgetLoaded event = WidgetLoaded.INSTANCE; event.setGroupId(groupId); client.getCallbacks().post(event); } @@ -937,7 +937,7 @@ public abstract class RSClientMixin implements RSClient @Inject public static void experiencedChanged(int idx) { - ExperienceChanged experienceChanged = new ExperienceChanged(); + ExperienceChanged experienceChanged = ExperienceChanged.INSTANCE; Skill[] possibleSkills = Skill.values(); // We subtract one here because 'Overall' isn't considered a skill that's updated. @@ -958,7 +958,7 @@ public abstract class RSClientMixin implements RSClient if (idx >= 0 && idx < skills.length - 1) { Skill updatedSkill = skills[idx]; - BoostedLevelChanged boostedLevelChanged = new BoostedLevelChanged(); + BoostedLevelChanged boostedLevelChanged = BoostedLevelChanged.INSTANCE; boostedLevelChanged.setSkill(updatedSkill); client.getCallbacks().post(boostedLevelChanged); } @@ -977,7 +977,7 @@ public abstract class RSClientMixin implements RSClient client.getPlayerMenuTypes()[idx] = playerAction.getId(); } - PlayerMenuOptionsChanged optionsChanged = new PlayerMenuOptionsChanged(); + PlayerMenuOptionsChanged optionsChanged = PlayerMenuOptionsChanged.INSTANCE; optionsChanged.setIndex(idx); client.getCallbacks().post(optionsChanged); } @@ -986,7 +986,7 @@ public abstract class RSClientMixin implements RSClient @Inject public static void gameStateChanged(int idx) { - GameStateChanged gameStateChange = new GameStateChanged(); + GameStateChanged gameStateChange = GameStateChanged.INSTANCE; gameStateChange.setGameState(client.getGameState()); client.getCallbacks().post(gameStateChange); } @@ -1007,7 +1007,9 @@ public abstract class RSClientMixin implements RSClient { npc.setIndex(idx); - client.getCallbacks().postDeferred(new NpcSpawned(npc)); + NpcSpawned npcSpawned = NpcSpawned.INSTANCE; + npcSpawned.setNpc(npc); + client.getCallbacks().postDeferred(npcSpawned); } } @@ -1027,11 +1029,15 @@ public abstract class RSClientMixin implements RSClient if (oldPlayer != null) { - client.getCallbacks().post(new PlayerDespawned(oldPlayer)); + PlayerDespawned playerDespawned = PlayerDespawned.INSTANCE; + playerDespawned.setPlayer(oldPlayer); + client.getCallbacks().post(playerDespawned); } if (player != null) { - client.getCallbacks().postDeferred(new PlayerSpawned(player)); + PlayerSpawned playerSpawned = PlayerSpawned.INSTANCE; + playerSpawned.setPlayer(player); + client.getCallbacks().postDeferred(playerSpawned); } } @@ -1051,7 +1057,7 @@ public abstract class RSClientMixin implements RSClient return; } - GrandExchangeOfferChanged offerChangedEvent = new GrandExchangeOfferChanged(); + GrandExchangeOfferChanged offerChangedEvent = GrandExchangeOfferChanged.INSTANCE; offerChangedEvent.setOffer(internalOffer); offerChangedEvent.setSlot(idx); client.getCallbacks().post(offerChangedEvent); @@ -1061,7 +1067,7 @@ public abstract class RSClientMixin implements RSClient @Inject public static void settingsChanged(int idx) { - VarbitChanged varbitChanged = new VarbitChanged(); + VarbitChanged varbitChanged = VarbitChanged.INSTANCE; varbitChanged.setIndex(idx); client.getCallbacks().post(varbitChanged); } @@ -1075,7 +1081,7 @@ public abstract class RSClientMixin implements RSClient if (oldIsResized != isResized) { - ResizeableChanged resizeableChanged = new ResizeableChanged(); + ResizeableChanged resizeableChanged = ResizeableChanged.INSTANCE; resizeableChanged.setResized(isResized); client.getCallbacks().post(resizeableChanged); @@ -1087,7 +1093,9 @@ public abstract class RSClientMixin implements RSClient @Inject public static void clanMemberManagerChanged(int idx) { - client.getCallbacks().post(new ClanChanged(client.getClanMemberManager() != null)); + ClanChanged event = ClanChanged.INSTANCE; + event.setJoined(client.getClanMemberManager() != null); + client.getCallbacks().post(event); } @FieldHook("canvasWidth") @@ -1271,7 +1279,7 @@ public abstract class RSClientMixin implements RSClient @Inject public static void onUsernameChanged(int idx) { - client.getCallbacks().post(new UsernameChanged()); + client.getCallbacks().post(UsernameChanged.INSTANCE); } @Override @@ -1300,7 +1308,7 @@ public abstract class RSClientMixin implements RSClient @MethodHook("openMenu") public void menuOpened(int var1, int var2) { - final MenuOpened event = new MenuOpened(); + final MenuOpened event = MenuOpened.INSTANCE; event.setMenuEntries(getMenuEntries()); callbacks.post(event); } @@ -1513,7 +1521,7 @@ public abstract class RSClientMixin implements RSClient @FieldHook("cycleCntr") public static void onCycleCntrChanged(int idx) { - client.getCallbacks().post(new ClientTick()); + client.getCallbacks().post(ClientTick.INSTANCE); } @Copy("shouldLeftClickOpenMenu") @@ -1530,7 +1538,7 @@ public abstract class RSClientMixin implements RSClient return true; } - MenuShouldLeftClick menuShouldLeftClick = new MenuShouldLeftClick(); + MenuShouldLeftClick menuShouldLeftClick = MenuShouldLeftClick.INSTANCE; client.getCallbacks().post(menuShouldLeftClick); if (menuShouldLeftClick.isForceRightClick()) diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSFriendSystemMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSFriendSystemMixin.java index 7497e7c2a5..6a495d7fd6 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSFriendSystemMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSFriendSystemMixin.java @@ -18,7 +18,8 @@ public abstract class RSFriendSystemMixin implements RSFriendSystem @Inject public void rl$removeFriend(String friendName) { - RemovedFriend removedFriend = new RemovedFriend(friendName); + RemovedFriend removedFriend = RemovedFriend.INSTANCE; + removedFriend.setName(friendName); client.getCallbacks().post(removedFriend); } } diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSGraphicsObjectMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSGraphicsObjectMixin.java index c7757732ba..3fe720a8ab 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSGraphicsObjectMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSGraphicsObjectMixin.java @@ -17,7 +17,8 @@ public abstract class RSGraphicsObjectMixin implements RSGraphicsObject @Inject RSGraphicsObjectMixin() { - final GraphicsObjectCreated event = new GraphicsObjectCreated(this); + final GraphicsObjectCreated event = GraphicsObjectCreated.INSTANCE; + event.setGraphicsObject(this); client.getCallbacks().post(event); } diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSGroundItemMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSGroundItemMixin.java index 23d0ce6586..078ca652e7 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSGroundItemMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSGroundItemMixin.java @@ -66,7 +66,12 @@ public abstract class RSGroundItemMixin implements RSGroundItem { client.getLogger().debug("Item quantity changed: {} ({} -> {})", getId(), getQuantity(), quantity); - ItemQuantityChanged itemQuantityChanged = new ItemQuantityChanged(this, getTile(), getQuantity(), quantity); + ItemQuantityChanged itemQuantityChanged = ItemQuantityChanged.INSTANCE; + itemQuantityChanged.setItem(this); + itemQuantityChanged.setTile(getTile()); + itemQuantityChanged.setOldQuantity(getQuantity()); + itemQuantityChanged.setNewQuantity(quantity); + client.getCallbacks().post(itemQuantityChanged); } } diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSHealthBarDefinitionMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSHealthBarDefinitionMixin.java index f6f31abdf6..f7143c4fd1 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSHealthBarDefinitionMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSHealthBarDefinitionMixin.java @@ -19,7 +19,7 @@ public abstract class RSHealthBarDefinitionMixin implements RSHealthBarDefinitio @Inject public void onRead(RSBuffer buffer) { - PostHealthBar postHealthBar = new PostHealthBar(); + PostHealthBar postHealthBar = PostHealthBar.INSTANCE; postHealthBar.setHealthBar(this); client.getCallbacks().post(postHealthBar); } diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSItemContainerMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSItemContainerMixin.java index 74c1bf29a3..21cd6e9c72 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSItemContainerMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSItemContainerMixin.java @@ -75,7 +75,8 @@ public abstract class RSItemContainerMixin implements RSItemContainer rl$lastCycle = cycle; - ItemContainerChanged event = new ItemContainerChanged(this); + ItemContainerChanged event = ItemContainerChanged.INSTANCE; + event.setItemContainer(this); client.getCallbacks().postDeferred(event); } diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSItemDefinitionMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSItemDefinitionMixin.java index 68105f05bc..763dfcb0d6 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSItemDefinitionMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSItemDefinitionMixin.java @@ -60,7 +60,7 @@ public abstract class RSItemDefinitionMixin implements RSItemDefinition @MethodHook(value = "post", end = true) public void post() { - final PostItemDefinition event = new PostItemDefinition(); + final PostItemDefinition event = PostItemDefinition.INSTANCE; event.setItemDefinition(this); client.getCallbacks().post(event); } diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSNPCDefinitionMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSNPCDefinitionMixin.java index 07d16f949a..9c1d646c62 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSNPCDefinitionMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSNPCDefinitionMixin.java @@ -42,7 +42,7 @@ public abstract class RSNPCDefinitionMixin implements RSNPCDefinition @Inject public void actionsHook(int idx) { - NpcActionChanged npcActionChanged = new NpcActionChanged(); + NpcActionChanged npcActionChanged = NpcActionChanged.INSTANCE; npcActionChanged.setNpcDefinition(this); npcActionChanged.setIdx(idx); client.getCallbacks().post(npcActionChanged); diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSNPCMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSNPCMixin.java index ea0f74f93c..c9d2b0657b 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSNPCMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSNPCMixin.java @@ -109,7 +109,9 @@ public abstract class RSNPCMixin implements RSNPC { if (composition == null) { - client.getCallbacks().post(new NpcDespawned(this)); + NpcDespawned event = NpcDespawned.INSTANCE; + event.setNpc(this); + client.getCallbacks().post(event); } } diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSProjectileMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSProjectileMixin.java index 1c10eeb835..221a81642f 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSProjectileMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSProjectileMixin.java @@ -46,7 +46,7 @@ public abstract class RSProjectileMixin implements RSProjectile @Inject RSProjectileMixin() { - final ProjectileSpawned projectileSpawned = new ProjectileSpawned(); + final ProjectileSpawned projectileSpawned = ProjectileSpawned.INSTANCE; projectileSpawned.setProjectile(this); client.getCallbacks().post(projectileSpawned); } @@ -105,7 +105,7 @@ public abstract class RSProjectileMixin implements RSProjectile public void projectileMoved(int targetX, int targetY, int targetZ, int cycle) { final LocalPoint position = new LocalPoint(targetX, targetY); - final ProjectileMoved projectileMoved = new ProjectileMoved(); + final ProjectileMoved projectileMoved = ProjectileMoved.INSTANCE; projectileMoved.setProjectile(this); projectileMoved.setPosition(position); projectileMoved.setZ(targetZ); diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSTileMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSTileMixin.java index ed17140360..34b624cf88 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSTileMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSTileMixin.java @@ -126,21 +126,21 @@ public abstract class RSTileMixin implements RSTile if (current == null && previous != null) { - WallObjectDespawned wallObjectDespawned = new WallObjectDespawned(); + WallObjectDespawned wallObjectDespawned = WallObjectDespawned.INSTANCE; wallObjectDespawned.setTile(this); wallObjectDespawned.setWallObject(previous); client.getCallbacks().post(wallObjectDespawned); } else if (current != null && previous == null) { - WallObjectSpawned wallObjectSpawned = new WallObjectSpawned(); + WallObjectSpawned wallObjectSpawned = WallObjectSpawned.INSTANCE; wallObjectSpawned.setTile(this); wallObjectSpawned.setWallObject(current); client.getCallbacks().post(wallObjectSpawned); } else if (current != null) { - WallObjectChanged wallObjectChanged = new WallObjectChanged(); + WallObjectChanged wallObjectChanged = WallObjectChanged.INSTANCE; wallObjectChanged.setTile(this); wallObjectChanged.setPrevious(previous); wallObjectChanged.setWallObject(current); @@ -159,21 +159,21 @@ public abstract class RSTileMixin implements RSTile if (current == null && previous != null) { - DecorativeObjectDespawned decorativeObjectDespawned = new DecorativeObjectDespawned(); + DecorativeObjectDespawned decorativeObjectDespawned = DecorativeObjectDespawned.INSTANCE; decorativeObjectDespawned.setTile(this); decorativeObjectDespawned.setDecorativeObject(previous); client.getCallbacks().post(decorativeObjectDespawned); } else if (current != null && previous == null) { - DecorativeObjectSpawned decorativeObjectSpawned = new DecorativeObjectSpawned(); + DecorativeObjectSpawned decorativeObjectSpawned = DecorativeObjectSpawned.INSTANCE; decorativeObjectSpawned.setTile(this); decorativeObjectSpawned.setDecorativeObject(current); client.getCallbacks().post(decorativeObjectSpawned); } else if (current != null) { - DecorativeObjectChanged decorativeObjectChanged = new DecorativeObjectChanged(); + DecorativeObjectChanged decorativeObjectChanged = DecorativeObjectChanged.INSTANCE; decorativeObjectChanged.setTile(this); decorativeObjectChanged.setPrevious(previous); decorativeObjectChanged.setDecorativeObject(current); @@ -192,21 +192,21 @@ public abstract class RSTileMixin implements RSTile if (current == null && previous != null) { - GroundObjectDespawned groundObjectDespawned = new GroundObjectDespawned(); + GroundObjectDespawned groundObjectDespawned = GroundObjectDespawned.INSTANCE; groundObjectDespawned.setTile(this); groundObjectDespawned.setGroundObject(previous); client.getCallbacks().post(groundObjectDespawned); } else if (current != null && previous == null) { - GroundObjectSpawned groundObjectSpawned = new GroundObjectSpawned(); + GroundObjectSpawned groundObjectSpawned = GroundObjectSpawned.INSTANCE; groundObjectSpawned.setTile(this); groundObjectSpawned.setGroundObject(current); client.getCallbacks().post(groundObjectSpawned); } else if (current != null) { - GroundObjectChanged groundObjectChanged = new GroundObjectChanged(); + GroundObjectChanged groundObjectChanged = GroundObjectChanged.INSTANCE; groundObjectChanged.setTile(this); groundObjectChanged.setPrevious(previous); groundObjectChanged.setGroundObject(current); @@ -282,7 +282,7 @@ public abstract class RSTileMixin implements RSTile logger.trace("Game object despawn: {}", previous.getId()); - GameObjectDespawned gameObjectDespawned = new GameObjectDespawned(); + GameObjectDespawned gameObjectDespawned = GameObjectDespawned.INSTANCE; gameObjectDespawned.setTile(this); gameObjectDespawned.setGameObject(previous); client.getCallbacks().post(gameObjectDespawned); @@ -296,7 +296,7 @@ public abstract class RSTileMixin implements RSTile logger.trace("Game object spawn: {}", current.getId()); - GameObjectSpawned gameObjectSpawned = new GameObjectSpawned(); + GameObjectSpawned gameObjectSpawned = GameObjectSpawned.INSTANCE; gameObjectSpawned.setTile(this); gameObjectSpawned.setGameObject(current); client.getCallbacks().post(gameObjectSpawned); @@ -310,7 +310,7 @@ public abstract class RSTileMixin implements RSTile logger.trace("Game object change: {} -> {}", previous.getId(), current.getId()); - GameObjectChanged gameObjectsChanged = new GameObjectChanged(); + GameObjectChanged gameObjectsChanged = GameObjectChanged.INSTANCE; gameObjectsChanged.setTile(this); gameObjectsChanged.setPrevious(previous); gameObjectsChanged.setGameObject(current); @@ -339,7 +339,9 @@ public abstract class RSTileMixin implements RSTile for (RSNode cur = head.getNext(); cur != head; cur = cur.getNext()) { RSGroundItem item = (RSGroundItem) cur; - ItemDespawned itemDespawned = new ItemDespawned(this, item); + ItemDespawned itemDespawned = ItemDespawned.INSTANCE; + itemDespawned.setTile(this); + itemDespawned.setItem(item); client.getCallbacks().post(itemDespawned); } } @@ -357,7 +359,9 @@ public abstract class RSTileMixin implements RSTile { if (lastUnlink != null) { - ItemDespawned itemDespawned = new ItemDespawned(this, lastUnlink); + ItemDespawned itemDespawned = ItemDespawned.INSTANCE; + itemDespawned.setTile(this); + itemDespawned.setItem(lastUnlink); client.getCallbacks().post(itemDespawned); } return; @@ -369,7 +373,9 @@ public abstract class RSTileMixin implements RSTile { if (lastUnlink != null) { - ItemDespawned itemDespawned = new ItemDespawned(this, lastUnlink); + ItemDespawned itemDespawned = ItemDespawned.INSTANCE; + itemDespawned.setTile(this); + itemDespawned.setItem(lastUnlink); client.getCallbacks().post(itemDespawned); } return; @@ -402,7 +408,9 @@ public abstract class RSTileMixin implements RSTile if (lastUnlink != null && lastUnlink != previous && lastUnlink != next) { - ItemDespawned itemDespawned = new ItemDespawned(this, lastUnlink); + ItemDespawned itemDespawned = ItemDespawned.INSTANCE; + itemDespawned.setTile(this); + itemDespawned.setItem(lastUnlink); client.getCallbacks().post(itemDespawned); } @@ -417,7 +425,9 @@ public abstract class RSTileMixin implements RSTile item.setX(x); item.setY(y); - ItemSpawned itemSpawned = new ItemSpawned(this, item); + ItemSpawned itemSpawned = ItemSpawned.INSTANCE; + itemSpawned.setTile(this); + itemSpawned.setItem(item); client.getCallbacks().post(itemSpawned); current = forward ? current.getNext() : current.getPrevious(); diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSVarcsMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSVarcsMixin.java index 86a757092b..e3d8db2864 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSVarcsMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSVarcsMixin.java @@ -19,13 +19,17 @@ public abstract class RSVarcsMixin implements RSVarcs @Inject public void onVarCIntChanged(int id, int value) { - client.getCallbacks().post(new VarClientIntChanged(id)); + VarClientIntChanged event = VarClientIntChanged.INSTANCE; + event.setIndex(id); + client.getCallbacks().post(event); } @MethodHook(value = "setString", end = true) @Inject public void onVarCStrChanged(int id, String value) { - client.getCallbacks().post(new VarClientStrChanged(id)); + VarClientStrChanged event = VarClientStrChanged.INSTANCE; + event.setIndex(id); + client.getCallbacks().post(event); } } diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSWidgetMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSWidgetMixin.java index 4c59a88e53..02b69facf0 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSWidgetMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSWidgetMixin.java @@ -408,7 +408,7 @@ public abstract class RSWidgetMixin implements RSWidget @Override public void broadcastHidden(boolean hidden) { - WidgetHiddenChanged event = new WidgetHiddenChanged(); + WidgetHiddenChanged event = WidgetHiddenChanged.INSTANCE; event.setWidget(this); event.setHidden(hidden); @@ -496,7 +496,7 @@ public abstract class RSWidgetMixin implements RSWidget client.getLogger().trace("Posting widget position changed"); - WidgetPositioned widgetPositioned = new WidgetPositioned(); + WidgetPositioned widgetPositioned = WidgetPositioned.INSTANCE; client.getCallbacks().postDeferred(widgetPositioned); } diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSWorldMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSWorldMixin.java index eefb479963..2b8ff3fc30 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSWorldMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSWorldMixin.java @@ -62,7 +62,8 @@ public abstract class RSWorldMixin implements RSWorld if (worlds != null && worlds.length > 0 && worlds[worlds.length - 1] == this) { // this is the last world in the list. - WorldListLoad worldLoad = new WorldListLoad(worlds); + WorldListLoad worldLoad = WorldListLoad.INSTANCE; + worldLoad.setWorlds(worlds); client.getCallbacks().post(worldLoad); } } diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/ScriptVMMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/ScriptVMMixin.java index ab372ca932..c1b2d09409 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/ScriptVMMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/ScriptVMMixin.java @@ -98,7 +98,7 @@ public abstract class ScriptVMMixin implements RSClient return true; } - ScriptCallbackEvent event = new ScriptCallbackEvent(); + ScriptCallbackEvent event = ScriptCallbackEvent.INSTANCE; event.setScript(currentScript); event.setEventName(stringOp); client.getCallbacks().post(event); diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/SoundEffectMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/SoundEffectMixin.java index 6338d07521..737e0f0a54 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/SoundEffectMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/SoundEffectMixin.java @@ -120,7 +120,7 @@ public abstract class SoundEffectMixin implements RSClient { // Regular sound effect - SoundEffectPlayed event = new SoundEffectPlayed(); + SoundEffectPlayed event = SoundEffectPlayed.INSTANCE; event.setSoundId(client.getQueuedSoundEffectIDs()[soundIndex]); event.setDelay(client.getQueuedSoundEffectDelays()[soundIndex]); client.getCallbacks().post(event); @@ -133,7 +133,7 @@ public abstract class SoundEffectMixin implements RSClient int y = (packedLocation >> 8) & 0xFF; int range = (packedLocation) & 0xFF; - AreaSoundEffectPlayed event = new AreaSoundEffectPlayed(); + AreaSoundEffectPlayed event = AreaSoundEffectPlayed.INSTANCE; event.setSoundId(client.getQueuedSoundEffectIDs()[soundIndex]); event.setSceneX(x); event.setSceneY(y); From 2af2715ac8f051d900f0d03866302f9276ffcfb3 Mon Sep 17 00:00:00 2001 From: GROUNDBOI Date: Fri, 28 Jun 2019 16:12:28 -0400 Subject: [PATCH 18/58] Change font on boosts overlay (#793) * Update CombatIconsOverlay.java * Make it a config option --- .../client/plugins/boosts/BoostsConfig.java | 19 +++++++++++++++---- .../plugins/boosts/CombatIconsOverlay.java | 8 +++++++- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostsConfig.java index d5d7cadba8..8443994243 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostsConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostsConfig.java @@ -82,11 +82,22 @@ public interface BoostsConfig extends Config return false; } + @ConfigItem( + keyName = "boldIconFont", + name = "Bold Font for Icons", + description = "", + position = 5 + ) + default boolean boldIconFont() + { + return false; + } + @ConfigItem( keyName = "displayNextBuffChange", name = "Display next buff change", description = "Configures whether or not to display when the next buffed stat change will be", - position = 5 + position = 6 ) default DisplayChangeMode displayNextBuffChange() { @@ -97,7 +108,7 @@ public interface BoostsConfig extends Config keyName = "displayNextDebuffChange", name = "Display next debuff change", description = "Configures whether or not to display when the next debuffed stat change will be", - position = 6 + position = 7 ) default DisplayChangeMode displayNextDebuffChange() { @@ -108,7 +119,7 @@ public interface BoostsConfig extends Config keyName = "boostThreshold", name = "Boost Amount Threshold", description = "The amount of levels boosted to send a notification at. A value of 0 will disable notification.", - position = 7 + position = 8 ) default int boostThreshold() { @@ -119,7 +130,7 @@ public interface BoostsConfig extends Config keyName = "groupNotifications", name = "Group Notifications", description = "Configures whether or not to group notifications for multiple skills into a single notification", - position = 8 + position = 9 ) default boolean groupNotifications() { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/boosts/CombatIconsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/boosts/CombatIconsOverlay.java index 0609c4f1c8..2e4c9c5ab9 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/boosts/CombatIconsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/boosts/CombatIconsOverlay.java @@ -19,6 +19,7 @@ import net.runelite.client.ui.overlay.components.ComponentOrientation; import net.runelite.client.ui.overlay.components.ImageComponent; import net.runelite.client.ui.overlay.components.LineComponent; import net.runelite.client.ui.overlay.components.PanelComponent; +import net.runelite.client.ui.FontManager; import net.runelite.client.util.ColorUtil; import net.runelite.client.util.ImageUtil; @@ -50,7 +51,12 @@ class CombatIconsOverlay extends Overlay { return null; } - + + if (config.boldIconFont()) + { + graphics.setFont(FontManager.getRunescapeBoldFont()); + } + panelComponent.getChildren().clear(); panelComponent.setPreferredSize(new Dimension(28, 0)); panelComponent.setWrapping(2); From 63cd22956db3e7eae4e18f82b39b666f3a4459c9 Mon Sep 17 00:00:00 2001 From: GROUNDBOI Date: Fri, 28 Jun 2019 16:26:08 -0400 Subject: [PATCH 19/58] Shift Looting (#786) * Shift Looting Adds the option to let you loot with the shift to walk plugin. * Update ShiftWalkerPlugin.java * Update ShiftWalkerConfig.java * codestyle fix codestyle fix * Update ShiftWalkerConfig.java * Update ShiftWalkerConfig.java * Update ShiftWalkerPlugin.java --- .../shiftwalker/ShiftWalkerConfig.java | 21 ++++++++++++++++++- .../shiftwalker/ShiftWalkerPlugin.java | 13 ++++++++++-- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/shiftwalker/ShiftWalkerConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/shiftwalker/ShiftWalkerConfig.java index 36ad3f492a..a4e2b92543 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/shiftwalker/ShiftWalkerConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/shiftwalker/ShiftWalkerConfig.java @@ -26,11 +26,30 @@ package net.runelite.client.plugins.shiftwalker; import net.runelite.client.config.Config; import net.runelite.client.config.ConfigGroup; -// import net.runelite.client.config.ConfigItem; +import net.runelite.client.config.ConfigItem; @ConfigGroup("shiftwalkhere") public interface ShiftWalkerConfig extends Config { + @ConfigItem( + keyName = "shiftWalk", + name = "Shift to Walk", + description = "For when you want Walk here as a priority" + ) + default boolean shiftWalk() + { + return false; + } + + @ConfigItem( + keyName = "shiftLoot", + name = "Shift to Loot", + description = "For when people stand on your loot" + ) + default boolean shiftLoot() + { + return false; + } /* @ConfigItem( diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/shiftwalker/ShiftWalkerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/shiftwalker/ShiftWalkerPlugin.java index e9378e6f99..7197de9eaa 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/shiftwalker/ShiftWalkerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/shiftwalker/ShiftWalkerPlugin.java @@ -50,7 +50,7 @@ public class ShiftWalkerPlugin extends Plugin { private static final String WALK_HERE = "Walk here"; - + private static final String TAKE = "Take"; @Inject private ShiftWalkerConfig config; @@ -92,11 +92,20 @@ public class ShiftWalkerPlugin extends Plugin void startPrioritizing() { - menuManager.addPriorityEntry(WALK_HERE); + if (config.shiftLoot()) + { + menuManager.addPriorityEntry(TAKE); + } + + if (config.shiftWalk()) + { + menuManager.addPriorityEntry(WALK_HERE); + } } void stopPrioritizing() { + menuManager.removePriorityEntry(TAKE); menuManager.removePriorityEntry(WALK_HERE); } } From 6f0fdc5a10ab36951451b97dfd2f772f5210fa65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Evaldas=20Lavrinovi=C4=8Dius?= Date: Wed, 26 Jun 2019 11:02:01 +0300 Subject: [PATCH 20/58] Fix WC world map icons around Hosidius area (#9205) Fixes #9204 --- .../client/plugins/worldmap/RareTreeLocation.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/RareTreeLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/RareTreeLocation.java index d32dee4c32..843d6eb645 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/RareTreeLocation.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/RareTreeLocation.java @@ -67,6 +67,7 @@ enum RareTreeLocation new WorldPoint(1640, 3496, 0), new WorldPoint(1613, 3494, 0), new WorldPoint(1560, 3636, 0), + new WorldPoint(1646, 3590, 0), // Miscellania new WorldPoint(2550, 3869, 0), @@ -109,9 +110,8 @@ enum RareTreeLocation new WorldPoint(1353, 3731, 0), new WorldPoint(1529, 3452, 0), new WorldPoint(1591, 3421, 0), - new WorldPoint(1647, 3510, 0), - new WorldPoint(1632, 3509, 0), - new WorldPoint(1623, 3512, 0), + new WorldPoint(1647, 3508, 0), + new WorldPoint(1621, 3512, 0), new WorldPoint(1593, 3491, 0), new WorldPoint(1583, 3499, 0), new WorldPoint(1696, 3554, 0), @@ -119,6 +119,9 @@ enum RareTreeLocation new WorldPoint(1625, 3669, 0), new WorldPoint(1642, 3683, 0), new WorldPoint(1642, 3663, 0), + new WorldPoint(1642, 3533, 0), + new WorldPoint(1671, 3657, 0), + new WorldPoint(1680, 3657, 0), // Tirannwn new WorldPoint(2217, 3141, 0), @@ -187,8 +190,10 @@ enum RareTreeLocation new WorldPoint(1389, 3821, 0), new WorldPoint(1610, 3443, 0), new WorldPoint(1578, 3488, 0), - new WorldPoint(1772, 3510, 0), new WorldPoint(1685, 3740, 0), + new WorldPoint(1681, 3689, 0), + new WorldPoint(1751, 3564, 0), + new WorldPoint(1796, 3600, 0), // Misthalin new WorldPoint(3355, 3312, 0), From e5ea78249ec5cf680d8a97cc156e98b256eb8286 Mon Sep 17 00:00:00 2001 From: Sander de Groot Date: Mon, 24 Jun 2019 16:14:25 -0400 Subject: [PATCH 21/58] Add Barbarian Assault quick-start option to menu entry swapper --- .../plugins/menuentryswapper/MenuEntrySwapperPlugin.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java index c6eb0a7947..236ef2cdd7 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java @@ -1181,6 +1181,10 @@ public class MenuEntrySwapperPlugin extends Plugin { swap(client, "quick-leave", option, target, true); } + else if (config.swapQuick() && option.equals("climb-down")) + { + swap("quick-start", option, target, true); + } else if (config.swapAdmire() && option.equals("admire")) { swap(client, "teleport", option, target, true); From 6c9af71445a7d35b448f13cb8c85803437b8e932 Mon Sep 17 00:00:00 2001 From: Sander de Groot Date: Fri, 14 Jun 2019 22:36:41 -0400 Subject: [PATCH 22/58] Adjust alignment of icons in fixed 2005 interface style and fix inventory icon --- .../plugins/interfacestyles/WidgetOffset.java | 24 +++++++++--------- .../plugins/interfacestyles/2005/900.png | Bin 924 -> 8357 bytes 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/WidgetOffset.java b/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/WidgetOffset.java index fe61af1af7..9edf17165e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/WidgetOffset.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/WidgetOffset.java @@ -118,33 +118,33 @@ enum WidgetOffset FIXED_2005_INTERFACE_CONTAINER(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_INTERFACE_CONTAINER, 7, null, null, null), FIXED_2005_BANK_CONTAINER(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_BANK_CONTAINER, 7, null, null, null), FIXED_2005_COMBAT_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_COMBAT_TAB, 19, 2, null, null), - FIXED_2005_COMBAT_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_COMBAT_ICON, 26, null, null, null), + FIXED_2005_COMBAT_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_COMBAT_ICON, 28, 1, null, null), FIXED_2005_STATS_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_STATS_TAB, 55, null, 30, null), - FIXED_2005_STATS_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_STATS_ICON, 53, null, null, null), + FIXED_2005_STATS_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_STATS_ICON, 51, null, null, null), FIXED_2005_QUESTS_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_QUESTS_TAB, 82, 1, 30, null), - FIXED_2005_QUESTS_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_QUESTS_ICON, 81, null, null, null), + FIXED_2005_QUESTS_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_QUESTS_ICON, 80, null, null, null), FIXED_2005_INVENTORY_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_INVENTORY_TAB, null, null, 45, null), - FIXED_2005_INVENTORY_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_INVENTORY_ICON, 115, null, null, null), + FIXED_2005_INVENTORY_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_INVENTORY_ICON, 113, 1, null, null), FIXED_2005_EQUIPMENT_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_EQUIPMENT_TAB, 153, 1, 30, null), - FIXED_2005_EQUIPMENT_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_EQUIPMENT_ICON, 152, 4, null, null), + FIXED_2005_EQUIPMENT_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_EQUIPMENT_ICON, 151, 4, null, null), FIXED_2005_PRAYER_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_PRAYER_TAB, 180, null, 32, null), - FIXED_2005_PRAYER_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_PRAYER_ICON, 180, null, null, null), + FIXED_2005_PRAYER_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_PRAYER_ICON, 178, null, null, null), FIXED_2005_MAGIC_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_MAGIC_TAB, 209, 1, 30, null), - FIXED_2005_MAGIC_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_MAGIC_ICON, 206, 3, null, null), + FIXED_2005_MAGIC_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_MAGIC_ICON, 206, 2, null, null), FIXED_2005_CLAN_CHAT_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_CLAN_CHAT_TAB, 15, null, null, null), FIXED_2005_CLAN_CHAT_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_CLAN_CHAT_ICON, 22, 0, null, null), FIXED_2005_FRIENDS_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_FRIENDS_TAB, 51, null, 30, null), - FIXED_2005_FRIENDS_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_FRIENDS_ICON, 50, null, null, null), + FIXED_2005_FRIENDS_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_FRIENDS_ICON, 49, -1, null, null), FIXED_2005_IGNORES_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_IGNORES_TAB, 79, null, 30, null), FIXED_2005_IGNORES_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_IGNORES_ICON, 78, null, null, null), FIXED_2005_LOGOUT_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_LOGOUT_TAB, 107, 1, 45, null), - FIXED_2005_LOGOUT_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_LOGOUT_ICON, 114, 1, null, null), + FIXED_2005_LOGOUT_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_LOGOUT_ICON, 112, null, null, null), FIXED_2005_OPTIONS_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_OPTIONS_TAB, 150, null, 30, null), - FIXED_2005_OPTIONS_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_OPTIONS_ICON, 149, null, null, null), + FIXED_2005_OPTIONS_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_OPTIONS_ICON, 148, -1, null, null), FIXED_2005_EMOTES_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_EMOTES_TAB, 178, null, 30, null), - FIXED_2005_EMOTES_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_EMOTES_ICON, 179, null, null, null), + FIXED_2005_EMOTES_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_EMOTES_ICON, 178, 1, null, null), FIXED_2005_MUSIC_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_MUSIC_TAB, 206, null, 30, null), - FIXED_2005_MUSIC_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_MUSIC_ICON, 202, 5, null, null); + FIXED_2005_MUSIC_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_MUSIC_ICON, 202, 2, null, null); private Skin skin; private WidgetInfo widgetInfo; diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/900.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/900.png index 407e476c549bcba6b12b4add6e3e356e33881326..80c3b83fc8bcc414459bcfe200b709d6ff07a72c 100644 GIT binary patch literal 8357 zcmV;WAX?vvP) zaB^>EX>4U6ba`-PAZ2)IW&i+q+O3=Cu^hRQh5y5fH32#Sb08zugEfD@gKly->cvyM zLtfQgg-UTm0^`pA{qJ@E!=Ku`cez-ry;jek+;fkEFPi`S`FsvOzklDK`27{%|L*55 zX8+?A!6!ba&$sn_UqASH`Rxt%eSMg}|GBgEy-xdH==+Nw7fiadmhpXE`(7x;&(Fj6 zd)L438~K;V`TkAzd6FM5{^R%A2*xh_Fhv(n3d!@Y-WU@rNIeZcSN;vD#LrLlb$mb1 ze;qq_(q9Mf=U0D-ogd$yr{9Od`TBi9{X>ktKM&=vWA`HT>x#l}cmCZkY=rKA{qsxg z?%nO)^Le_FE0L=1`%pg~<$c8qC!tL5ZIut>Z{cfuADxfJBQAoz$>!u^xzIx-+Bf8| z!w5H=_j!fI5_3G!_#ESk>HVxFi#@KFl&p_%qmiENQX?CStR;RNf379G`}TLg6&iQm zfmg=B#gxB4eYn5+;lK0o^FsHkbVKm%6DP`obww2*%TVU@FRvmY;eKOUUVPt&`=xID zFNsZLu)Hug9&q^ixx_5tx7tcC&xzL+pPm1dd$9ez03qVug~fzK27INwLk-?yv=E46 zBR_+c$CTqF1EG|-gS+G=rAl&I)V+C+h4`E!MSZSq~QB%#e)LN|yqlP8RR;-#?vu>lMmRo7HS!=Dg(PK|QSn0K!>#g@b1~(mC zdhqVSE5?{{rkQ7%b=qvR&#@?DVQuoc=pY!$?S=-|=N_q)W7b>PcU4V@joHk+`;-r83v-?jk@K0Z;pD^vF;%7aJ zoSk0kNjusiM#=hZ>(!tLIRP-NPEo_TinBp#BYhXI;oh zu-$$0Rv&C?ybn))OT9B61D}4bq@OzDjg%>mn|RRO$n7Y-yEQI%2WM|Cm3;0JmbbgW zwbA%|>#P@Oou^NIZhib%#P8PN^h+(H&RhZ|GZz2GkqySbEzFYo_A_!piGy~^=6YPM zoqT<*gn~j3qq(V;Y!VpybIxRyXG?t*P&D&gYb?@KZE^`ZDYSMfC0)aG z3&K(tCxlzQr8L-!n|ce^;N?a~6C1tit_>_x>tRkVS=Z^Egw58p2-k9f#yh{iF_?Z- z4vX@;owm;9ze?UZaL_^>`>Y<;Eu^cAop`cD_K&aT2E9KBbcS}@O{ah#dwnXh>hTF3 zkoEVU70^7E0{|oK9;n4$;G9h}^ZcvFy+)(YXN_a{z0Lp>LiDBVJR@!1JSpG_z>+zG zJ3UkiaM+^PHwt2z0@DT&@S`taDcuxQd}|k4J)CBxBr5c9qn3Ayp;pugFBJah+J4OB zd0pL+#+r+Zj_|HAdMHG5w!7990F~0IMqrizO-pCG!b(=o^hO#Zv;zFpwq8k0Yu)OY zYZ7+jO_Zq`i3UM57r%B3XViX;MY%@94e7#MjWV;dBk(j!r&muI6BLfC(x9MlgrZv` z6K3h|O&ChyKi{AOhX7A3n|7tI^plva@uTfuLvYz!3AtUk|1MS5=E|e(+^Y(7pcH1g zo66SJS5ueYgI-v7%)Myx8G8l;q%Q6aW5F)46Xo9z^ig9s)))C_QiRDxI7|1gx7(eg zUmz)+O$x7-#MLRRUdd1$wMD{P_J#;7fN*)|KqJ9BYa+DPo|!7;TS^1WAe5392KG$2 z4$+diaauf#GQ)GgYB0;FO8_u<6151t1)zW;KpV&h2CW~z{r-whi*43U)eW*6Rwlxb zm+qefXquzl?0D5U^U%a4Q9Fp%eT~QN#Eykc03{@}+3w+JF}(?z2YG|zs7ABA>AdFD zQ)j0Bw*NrSEy0juwH*iIemc;?5mqZWm(r$&sDO1pM0k6WUGU%$_ zr}NfNnwv@}4Xm_ta!EU(B33Q&6r@PK4?F2ZpgngS4ELQN*xqOyI6ol%9Pe!bBwq>s z8@xX!Gz~f5bEyQDrxc`LPUFHPo$&U~U%+b*N_7+}XU`9dTu+M}NF&c%MKBkp4&oV- z2eFK^0{>ALRZ7QFlCrzLD9j}B?(Ps#_onsGI-J*THRmJ|*cxpH9Ib{hrc)}Fjus9e zq6ZL=TmmLA<8Uiy5wxzNOwt1aldBaWez8d|4eI~UiI4ywoELCHyWMz5k|bQ6z3(n7 z+DC@o_XbHpC>FktRaIKqKoYXfR;Kb%0E5~?bv3p3zQe1#L)1--7$I8=8WUc>0{FbC zfLL+3yZJkIJ&3@XDa~#!B4g%7ee>P}7I_fnEH=g(eOaxRD@%k)ULl zmY9OX-iVbOX~}?gTJvr=jfbTpKwP3Q zTIJ%<6|Zlk#JZP@Nh$IboxSg z1_ud*vK9}+BSGb zaSQ(`6+$^662E}se9a`YJV+89uNw+6zyiyT&~x;($wOb1#zrYE#HnE!A8w+u#uJDS z*)w`8zW#QK7!ZycCJ+;B6*BORw?nUN;ue51Cw%l_VRdIPdW;K zs99j7JhkGusQ|Q!7L8me4%12H9sJl#Ytf2GEz}*>T#Sv?f~0@4_{3F%r&kaf04@O^ zJ&EA?c#-(J?BGl{=0{IW2cqmSTZkdL70~w&{P0=(o3+=Ap!-Fb0nBblLvR6Ll|t{} zC3YBnkCvkNp)K+PHQc4rVr`UK5uennU|==?8rr(Kyo7;xI=+Xf2Rx37#FHUMD?z37 z@I@A_i73llD~O&t)dAyeDQ4CO(^AA8!F4P+;Gn>%)Rd^_ zi6fY0n3N~-1a_bZ&#Y6{#`k+Rm7PwW`qG2Q&>rfHmN*Bq;;BU(I+p43zH`mgUj%*?1XbALc`Fd6a-=S~$DQVu)?Tq75Uy2aT*rZWT|{Niy{u}@7=#5mn(VvTG0p7s*} z><-(dmlzUN@tPYPgF&d`eXfh5Q877v9Deh{ucQCm&;$o1@|^7Z_u`zSrHeUgWhR9V z8wqP54`EWwjTJQqZV1VoY6kaf5{6}~r7q&2N|Tj``M~YrFc%10Q9t~r!JEYSMpR1% z5(LRz_&p0HZDBnqPMprVJ=#`hvK)M1a*vxciC93|b5aB2iGbo6Sf2PA%JVz282Vm` zpNj7U5djFV21hqFc?3d;YCt^QEl`=$RS> zflC|ir{>Y;{S5yr8@gak`{ z=L#E0!%*OXDgwQ)PXAed$a*&#LUP`8pPR~wWaw~l_sR_DH_f3igvTE(e;7EnqaopC zsoUf-JVwwaNTKUkQ{Mx+DW}2)^CH*}zAJ%45rbk+%U6QFho^fH__(|#YitdPP*LF& ztay*RA<5A6c{RVXLjrUJSdv0R>UrLAF}S&Bd~mQ}^MMS+2}K|@E+Py4b^O}ei^(QA zacgpO_IU7g1OZKpRa1l!D`XmlxGquP--_);)Ik8)feCFdMBjsbWb6D4q7<`T0(f`8 zX3dV#UKjh9E@H8*xrrFXQbGC~(Od`tAQPR*1EK~s=Ajgvp9y`J(OsuRS{;KirJ!Y7 zKnGZyDi8QQDnldnLmNXC0$8LtJm9hCP^iN6KXV9aAd`E{oWTnW|%V`MKdfkTZRneIP!qAu=m&#&RkG6UfOarh|!0cnN}Jx%i&iWecDcj;aQ-+&t$%E4!l8ZaM_8DdIc;v;-6 zd5UQPj5v(0DJG>pNAimnVu81HP<)EN-aLC!Ch18a;5`8tNZ-&rbq<(tF?1x@g5kkS z(6y7e!(TuRDiws6bs>Mzp~Derln^EZ?!9FX2p)s5Ni^??LO20rlPPAQ5WYdtFeBQq zSDXQeTc{)K6O04xkFvb>7Ls_%sF9Rs&@d8?+Q6_k1yKH+6`)50vY9S8s2S|8+ox$% z$}L3ZML=lr%F?I+NQFX@?gmvlYL2GqD710F^xfUac(W8SA7FB%t`Tk^8oG4PDJ|4N+ZtEQ z8tKp<5e4PRqY>nJ(~yn|v%86)E)t9whpBD%Cbty;>9wUm*Ziz^Dg+t3_$CfKBz6JS zrXeqlrjx=O#2o{fG0ykr7JOhM;)k8Zw<)rNaaI>9iTw+ z9g)EU;kAzk3IKkx*Tt{t85Cp<+_k7|rF&>YwO2iJY;@xRx z)>B!JAP$dFa15s{hq-=|`2!awShMf zBpsCnf8G$#_*P*ZNC}wRq0pmb%ZG#|5p)4z1mV(E#D7j#U#R`FPP_{iyCD``2gXDu z!1vhXa;S?v0Z4c4!p1sVl6?#dDB*s zCUI!14&d@FRYdkNlg%l-qn3tV4FKo@f|IaI=0FmNd%T$y0!Af1(17i$;l`UlZ6xzZ z$eN-Vs`jyb$N&Y;fDKJNLX9HfrulDDCuU$FtbmT^jTP8~E< zyp2^qdI(RVz%^($YDco=uHx={Vol^rI-c61YaxPI#)nf9oWzPz7QCM}FEZ`+T<8Ke ziFs`*X9uqF)<*l-iW>gSk1~1z{=hEeP;eFkMI?pSoa&UO{l&?p5qlYD<1!|xXm+v? zj7bBjrF{!~21B}D8;b4CV1wSPF<2nzTt$Q^pFsclC_0L>@&pku)L2FP%>q>oj`0o= z-!99$H3UHelFG`|Q%oui3VTavef-K+YB%i5;OP}gs4B;{~qX-4R< z`Q5DOmN&lKTPmJ=C$GBzgxcLi7`?D}2?F$rwrV={iDrgb&BypfbcfpCYEg;`m8LBz zZyMfA4FiGXiFO#QnM~J(!_06MZF;}fZj6p_L(8!@JWuDE}w!t5oVW??ZkQ83)nsVWHHd^RT zh)2GJ@CA(}G&8mNCUX@_K~xa4bWEuMVMbZ&Cv4cw*??R;-0&T%557Xb{YV%kVZHcTRsgnXX zz<@PUgtHBr)eQ1OBHBXE>l?qNYwDQOHfCwc&MggtvgyM$l%LqB_-&M<-XkcNpt z-^HtMzzgb{oLa;TPrg~K7`vmtULMS2h?<&_284KmV5~Gdq}S#`grFAT$c&&Kv0ykHnq~y4yS}cXeCjGs~(*|NRii3_oN=gqpJ*Y(KUIvQ{=t*Nh0^J&8+=@1H(4~HcbD=MbBg(C!%DIm0C^{??a>xDBO zbB>^a7-*{l7m?~W9ke4=Vq};!2+ojtF3IU>a-M+|4UP*2`G6h~WsEHwn3QT*uabQa zN3%sF!)Mc4==8QKKyq+>ZyywsE1K0y^A*yvuaZw-x7fThB(Qpj{BAVba*!Bb}c70>gOxwp%2O}sd*g~6)D8bAb8)A&ZPVJ5uJ{t(G0 zi|J2r2zO0o9atd3{ThBG&Ck(|WEE&`CXdzqXJb^rjIls@PRSa)2ziy?m#ts3dL4aC z*>y$t?@mr}+l6~AFAg>o+-qJ(E5O;O!zuH(9fB7*M}u_GS<{paG3y+jA#Q;BOpHNW zq~uPbzBY97d?_mEmHIszCYFp2bv9!dUbJHU=j4KnXeK3}QsvGd<4fzNj$}Z|1rNT! z3VfeO-?U2) zb~JmO3nh82MhRh_hmsL*5l<^LMr9gSTsWBec zq9)$cGDPKmeJwWv)cagh-3tV1KNn+>PD5sayOi!tI&b=Rle2J(Ks}gfxm>0(SU9?}uEq!g87Y~@> z2}d*`_@n;`0q8j5-2n^W6GDFHZ*?A0FJ99AIy9?%Yx}kT<9hh>XYeS#uUK_x+Il2F zM&&oJ!PIh!kQf=W22?uVLq^OxH4Rnl z_Z+KyzIaDu+;3-P{`|KWu+)$H#70nT_=nyy{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2jd1101N~u zh3cjN00ZqwL_t(o!|hj1YZE~jekSXJuFW+QIMb8@PT&M z#_O*fy)Yf~!tVquJ3#fK3QB{rZg*_}z(CG&?*O1u{9x$MZg6@xMb z0FRXb0G$a300g0$>$@{}tfb#pYCN}|?^M99N3!52^riu~Dw&4q1 zhVjtW^V&nq!E%%xU`06c^n1(}YJljDVs&p)@3B&0cBFxJ*G_>9LZQFwOgQ=@^}H7` zKuT7~KwmhxhFD)C0_t%LK%m)31ZQU39x8SYPdK6&nmOOK5QGA7lVm8dg(bLkMa}pW zIUo&;rt00>BjEGE%6u_P^s%P0rh8(8nAliVrR;yPar!+*DI0vV25G9CY8}N12s3~= zvicyQk^qb5{uWHmp}w;Ilwx zN2SJby8*1PS=fCB+`Pe2sd0>lHiA%S@U(8B1}GZ}7R8BhD0mPGc&n--Dgc0l;-@dS zzz+8C=#_sP7J^WfV||V0iNyd$Q{dw#8y!n%Eaks%1=ef>59{;b?d5Tt95&|R)(Vn0@ zL1-;4^noH1>W|b%CJ>^r=?OGFf#*+n&SZj6U?6AcOt=O+nkMC3=mV{?%;60ZFo8(-F-8K`7Al)V1n$psmOZR*>FeO9nN2j9vd4MrV29)&x6Nsr5+Vz4^XoE5B zwt7(k{uDV0{c`|$Cp6kGJJNuRQXt8&2yCwQ%bp2~HmB?sO-z-Yd{C1OP5m;*aypDI z10>s)X2yNtq!gdc{_Ot(#^j1~2}MAP0KEI==rcrN;DX@G{g^N&0bs?slscqjeWEbn vf}nr?XOsc+r$PVz*K7{tZvvl>^FiY$Co~SMPqcfG00000NkvXXu0mjf#ZHoP delta 902 zcmV;119|+VL7WGWBYyx1a7bBm000XU000XU0RWnu7ytkRPDw;TR9J=WmQQOFQ5400 z$rzA8(-5#^$Rh4a2)gQ`D_4S0-1!Mys7w6>f-cT;qR7<9}}id2-jwM!vGv)(0>- zXz}_my)wri5g2#KhCLW`JVw4^eW2G*0(+m3c=tW!ICAH@@v8|}+R(eHlM1Bj$w3Q% z)9iBTw{AaWIEUlN9s8#Qwr-P2QoqpzV1J$h5adAzolE>iv-rK+Ppue(j>ov8GM5TY z0^<&u`LF~wD}M|ZS`i>`gRb}_fQy+{WHKWsnzGUc94gd$V6#saCoolQhF-$32lv-0 z`dv+Snq6{qu80#5e*}>#{)Y>Q6PCQ-RAB42R^V&g=H9J@aG}>fp1`+Lud-XK;y0SG z20^5X?*XbHv9YREJU+DB({xpC8cmoB2{VC-YJ0>dW`8VmPb~rIE5Oi8h!c<#Ai)Jf zqK?$YYO6R6`}33_QkK7*1WXKj%WEdVD!ToY`|EIL&13ha{(doQ6&?Uxj0vX)q#{9_ z*vW%P;jcF7_EWk5lrq0~vqj@@kEd_Fe6McBoi*8G$95737x3k*!FZ)qD^AQH8ge2o zX3aeL1AiVq+RJ^TifT>OrlFn7YJs?49+)ayFHt6l6#Mg($w7;&FL9L zYUvmj1UCDnIrgS{&%IlTMI>C#ik79ereSiFx2-LyspJ~ED$IJh8h1&6Y_y{g$ zt$ZHnwb-r$a2!K(aDX;VoY+J}%8{=a`HEN1wfttK;u9enE|$lzlK^13-|WATtImS$ zoieFeh%E|sS@qTuxGt#bfVoQYDryyw0Chx6h{WR#&iB5n@LQW*WPUf{ cHU2sL0B!!8K&}`MeE Date: Wed, 26 Jun 2019 16:05:04 -0400 Subject: [PATCH 23/58] Added Larran's chest to loot tracker (#9209) Closes #9177 --- .../client/plugins/loottracker/LootTrackerPlugin.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java index 7c21c9f7dc..bea6d2d477 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java @@ -129,9 +129,12 @@ public class LootTrackerPlugin extends Plugin // Chest loot handling private static final String CHEST_LOOTED_MESSAGE = "You find some treasure in the chest!"; + private static final Pattern LARRAN_LOOTED_PATTERN = Pattern.compile("You have opened Larran's (big|small) chest .*"); private static final Map CHEST_EVENT_TYPES = ImmutableMap.of( 5179, "Brimstone Chest", - 11573, "Crystal Chest" + 11573, "Crystal Chest", + 12093, "Larran's big chest", + 13113, "Larran's small chest" ); private static final File LOOT_RECORDS_FILE = new File(RuneLite.RUNELITE_DIR, "lootRecords.json"); private static final Set RESPAWN_REGIONS = ImmutableSet.of( @@ -538,7 +541,7 @@ public class LootTrackerPlugin extends Plugin final String message = event.getMessage(); - if (message.equals(CHEST_LOOTED_MESSAGE)) + if (message.equals(CHEST_LOOTED_MESSAGE) || LARRAN_LOOTED_PATTERN.matcher(message).matches()) { final int regionID = client.getLocalPlayer().getWorldLocation().getRegionID(); if (!CHEST_EVENT_TYPES.containsKey(regionID)) From 94b35239b8e0e404e1cdd6e9e3e1ab33880e6fe2 Mon Sep 17 00:00:00 2001 From: sdburns1998 Date: Sat, 29 Jun 2019 00:25:41 +0200 Subject: [PATCH 24/58] interface styles: add RuneScape cross sprites option --- .../main/java/net/runelite/api/Client.java | 4 + .../InterfaceStylesConfig.java | 10 +++ .../InterfaceStylesPlugin.java | 78 ++++++++++++++++++ .../interfacestyles/rs3/cross_sprites/0.png | Bin 0 -> 15717 bytes .../interfacestyles/rs3/cross_sprites/1.png | Bin 0 -> 15729 bytes .../interfacestyles/rs3/cross_sprites/2.png | Bin 0 -> 15819 bytes .../interfacestyles/rs3/cross_sprites/3.png | Bin 0 -> 15896 bytes .../interfacestyles/rs3/cross_sprites/4.png | Bin 0 -> 15689 bytes .../interfacestyles/rs3/cross_sprites/5.png | Bin 0 -> 15691 bytes .../interfacestyles/rs3/cross_sprites/6.png | Bin 0 -> 15701 bytes .../interfacestyles/rs3/cross_sprites/7.png | Bin 0 -> 15684 bytes .../java/net/runelite/rs/api/RSClient.java | 4 + 12 files changed, 96 insertions(+) create mode 100644 runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/0.png create mode 100644 runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/1.png create mode 100644 runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/2.png create mode 100644 runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/3.png create mode 100644 runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/4.png create mode 100644 runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/5.png create mode 100644 runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/6.png create mode 100644 runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/7.png diff --git a/runelite-api/src/main/java/net/runelite/api/Client.java b/runelite-api/src/main/java/net/runelite/api/Client.java index 604478d6f3..d03116c58d 100644 --- a/runelite-api/src/main/java/net/runelite/api/Client.java +++ b/runelite-api/src/main/java/net/runelite/api/Client.java @@ -1626,6 +1626,10 @@ public interface Client extends GameShell * Returns client item composition cache */ NodeCache getItemDefinitionCache(); + /** + * Returns the array of cross sprites that appear and animate when left-clicking + */ + Sprite[] getCrossSprites(); EnumDefinition getEnum(int id); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesConfig.java index 540186558c..3f64778e52 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesConfig.java @@ -62,4 +62,14 @@ public interface InterfaceStylesConfig extends Config { return false; } + + @ConfigItem( + keyName = "rsCrossSprites", + name = "RuneScape cross sprites", + description = "Replaces left-click cross sprites with the ones in RuneScape" + ) + default boolean rsCrossSprites() + { + return false; + } } \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesPlugin.java index fa70dff0fc..17093f237e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesPlugin.java @@ -31,11 +31,13 @@ import java.awt.image.BufferedImage; import javax.inject.Inject; import lombok.extern.slf4j.Slf4j; import net.runelite.api.Client; +import net.runelite.api.GameState; import net.runelite.api.HealthBar; import net.runelite.api.SpriteID; import net.runelite.api.Sprite; import net.runelite.api.events.BeforeMenuRender; import net.runelite.api.events.ConfigChanged; +import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.PostHealthBar; import net.runelite.api.events.WidgetPositioned; import net.runelite.api.widgets.Widget; @@ -69,6 +71,8 @@ public class InterfaceStylesPlugin extends Plugin @Inject private SpriteManager spriteManager; + private SpritePixels[] defaultCrossSprites; + @Provides InterfaceStylesConfig provideConfig(ConfigManager configManager) { @@ -89,6 +93,7 @@ public class InterfaceStylesPlugin extends Plugin restoreWidgetDimensions(); removeGameframe(); restoreHealthBars(); + restoreCrossSprites(); }); } @@ -126,6 +131,22 @@ public class InterfaceStylesPlugin extends Plugin } } + @Subscribe + public void onGameStateChanged(GameStateChanged gameStateChanged) + { + if (gameStateChanged.getGameState() != GameState.LOGIN_SCREEN) + { + return; + } + + /* + * The cross sprites aren't loaded yet when the initial config change event is received. + * So run the overriding for cross sprites when we reach the login screen, + * at which point the cross sprites will have been loaded. + */ + overrideCrossSprites(); + } + private void updateAllOverrides() { removeGameframe(); @@ -134,6 +155,7 @@ public class InterfaceStylesPlugin extends Plugin restoreWidgetDimensions(); adjustWidgetDimensions(); overrideHealthBars(); + overrideCrossSprites(); } @Subscribe @@ -283,6 +305,62 @@ public class InterfaceStylesPlugin extends Plugin clientThread.invokeLater(client::resetHealthBarCaches); } + private void overrideCrossSprites() + { + if (config.rsCrossSprites()) + { + // If we've already replaced them, + // we don't need to replace them again + if (defaultCrossSprites != null) + { + return; + } + + SpritePixels[] crossSprites = client.getCrossSprites(); + + if (crossSprites == null) + { + return; + } + + defaultCrossSprites = new SpritePixels[crossSprites.length]; + System.arraycopy(crossSprites, 0, defaultCrossSprites, 0, defaultCrossSprites.length); + + for (int i = 0; i < crossSprites.length; i++) + { + SpritePixels newSprite = getFileSpritePixels("rs3/cross_sprites/" + i + ".png"); + + if (newSprite == null) + { + continue; + } + + crossSprites[i] = newSprite; + } + } + else + { + restoreCrossSprites(); + } + } + + private void restoreCrossSprites() + { + if (defaultCrossSprites == null) + { + return; + } + + SpritePixels[] crossSprites = client.getCrossSprites(); + + if (crossSprites != null && defaultCrossSprites.length == crossSprites.length) + { + System.arraycopy(defaultCrossSprites, 0, crossSprites, 0, defaultCrossSprites.length); + } + + defaultCrossSprites = null; + } + private void restoreWidgetDimensions() { for (WidgetOffset widgetOffset : WidgetOffset.values()) diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/0.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/0.png new file mode 100644 index 0000000000000000000000000000000000000000..b817c474c04ce529e239bb864c3c823625600dca GIT binary patch literal 15717 zcmeI3Ply{;7{Es>i`~-VpF&wC%)DfWCNtBS zNt0a=sy%2yPz1q)BB%(Wh!-z<&|)ii(TfN1B!UOMco0FotZ!zL%;atISlWUpFOWaq z``-6`@B4l4eKT{&_0@Av9-Mz@o?)1SE6cSt^!-5mzJCsVKJxnxKwta)<&BVG4&993 z_q=xU&{2jlpLH7R(R%%?VR_vmu)QWM4!S;?jdZ65KCmvqh;72Q<5mj4efD{Qb?i#v zf>Iai{vzCTmbU|Ve*0X*+P-AzcHvZY-W(XnK^I1V9dtWxXbdWa#IJ#V$HRPqO{PSb zDusnOAiG{)Wf#2wvPx0qEU{E(HN7Y*dRdYmXC*;Yc|qqznG-}q&<#Okhp$3)9{n-{ zyJf7^&J4pLsZ!XCBH!Toe!pMrmx^A{=0#oCc|qbOi9<8EaLbLrfOErRsgseP8Vs$# z@gv7`+1M{=dcCMpD8zxruVG$Ye;mjShwKnVegJ%4EDHQIBikC=_`RT$EX}rf*nwT> zMj^5jr`q|OUgU+F-i(lA^~}JiCiVI__SE%uyHi7l(b5%!V2E_8W!TvAA-@JguNPQw z=?Y5a*tF~;rgx}Xht-)){IubzRyEJ+#oKzpwP1*f5$1}7N|hYk)1W;$I#P6;YT7nz&vI-d3u?7Q z0Cl;og|*F zGv{nqpr--{wR6zP&53idQ7%A$s-|for>kYaK`3jSu9PKC)Krv+CIC?_k8+vfW>=_X zC$9SzR))AX=i%ka(X8%CY;7&6QkL( za5HCjIroMj^`A4J9izVqT~gObT_v+-I|;p3)CU1vXruGAmxh*loixMUPd_DyQF1an z&K(pY1Xu2?3?{5KHWLxDFL6$fmwVIp-T6(DjEd_}3sLZ!f2Gn>3LzE0@+<5=J zGQ_~s=+-81+t9A^qs&GF|E0?9tskZd-(KagOXmNea_LE&?1`g3ySs;)@!gVv`Y-AQ zAnALe$?qD=_Dni|J?^8OUNT=-1@z*@_;YBQSL3D|WYfGFH_a@ccAcmy4WnVhIji`V zF1_D4kDfkYRaKOdV)FPfZn5eNU}wGNp!NSS>3yodz$(yFE^E&Yu64GUk1#l_nw}+ zIC$=R|BDmfKJm%=krQ*PhhIFrbnMpt>p#7F_Hyg(`}WN-_B$WEaNzSdkDzGG%F?;o JN2f17{|_DZ1xWw^ literal 0 HcmV?d00001 diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/1.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/1.png new file mode 100644 index 0000000000000000000000000000000000000000..a6add2616dc8bf19a883048ea72f95258e1beedc GIT binary patch literal 15729 zcmeI3O^6&t6o6YJYqBIEO2FU`HnYSZVo(3iOgA%=Y<4#8f)kg`YIeOOHPzL#ZDzXL z?w+051xYj@21F#FD4r#^oIC_Pgh+Dprl5Eb!IM$&;6*R4)zkCSQ#(^Ei6BZf%yhqc z_1>%cUe)XFLtj}s{o;Y?$EP`tJFvJ=S;pr>@o(=G{(t)SZGcbv{DrlU;||`Ae-C_k z?BEj|SA5f1S&de!FPYG5W`X6^P`1W*8={PxAo4DVQ_%vrrE zRsA`%?ksEt=*-sX6}WW)8dm0bdAis!v4bXx0N-gg+|cZlGF`tWzK)y44Bzb%T_|N{ ztatoB(CDz~_yutQ!SIdx2LZIVVbnC~JZwo04HlGT%EgitTng+g7t)P#0yxFhofa6-B^3gmBZ1Ku2)HnZ!xoPX&cAaQw*e zTt4;-YF;ZUWioM~!O@#n(;ozK!yY?KQS1O;l(UjJ&d7oT8^0Aaxn~6-HW_%-J1|{pq>~Q=cHO4#2!1|W^-)lFq+@M2zp4zT81l|J`$Hv=(Pff<~Q(E zX2#7va_nJpMm)uuiDO3{XM$O*NzA%SA<0k?&()j@5Qw~B#q%2FWR)%T5%P0$@v6%6 z&z*H#%WH?v7e&%!nD3!CQ~?nxV@pGja)P9-D5@zJOkFxADW)W)oFqL7A63tC?9EXh z`U+mtvS#Y}w2xFz(g)r@7Kp&Eyrlc4{8-Smy`TxAveN{0B>HZ>C=MG_JqN4Gobwu9 zfQN<3YEc~5Jl3k>!B)JiXI+RwoQyD)B%G@5#ytt@qpf{K!zm|a!}6eGnZuyamH{#} zRVd_TU65sD2nMpC0CN!P(8>cvs};p~^I{jnam9YSt)mgs)1i$wUIx{wx#)%wz|&c* zlyO7W!6Vaw4WWjRP%GGZ!N_TfP{qsfo zYBGJ|$v9Kab_9AkaBw*XjZ~j_E*74PhUA(8bE=@p$QBG$s|f{320}r#Gzm%uuywt= z&hcEvxY-eE!HM&}Nu(jp%^CE@XzMWV-NNgGAVhIlDP{U~Wl*Vc*TGTjmM0UyxMY`M zyz7xw6h~Tz!y?U`o$1^ig2aEyd~%HTI&x`MBXQO3HQ7n%*-;w=Xts{`({2h{;&s%F zbU%KVU`E}Y*>LV75h2*Pzche?1#C^O394iPA#Z8A0JMT4KsBGYRof~k7VM|_9@2md zuVl)qsSb+wzn6v>coH411GkQ>ve=(lzu~`>x!u*nWWx8BIpUW2Kge9N6Gv-ezs~Ng zp~d)VDXzb`7JzQulZ)bxw&9vd`me@yw9)GJH*yj_L^=NNnWojG=^EWMttL%}man)@ zR91S?h~|`4{79EPZ=AtzAE=zubrs)p$Y#=F$?2fRYQ@3N8)1AWkaIm7QZd$WZIWS1 z(KAd^m3mL;-o}zv{1$>=fW*NY(2hIY;QsSZUJPgSPkJSMu^Ld$RwKTdbp=G!TAas%8qVplN3>N`} zE;3wnK7^LxB7o3EhKtUJ&@x;E5W2{4(fJTshKm3~7a1-(A41D;5kTl7!$s#qXc;a7 z2wh~j=zIt*!$kn0iwqZ?520na2q1Kk;iB^)vIv+yIa1lW0BEv=JLueT;0tj8C;+h_QQ;b~vA#odjF+6YH zJ&3u~UJ74_ZwzD_eI`Zgu z`)^&Fy7pkS$6vej^_3g@Pqd%<;m|Xu-hXT9^GCk?M!%F1mkz&scz)*2zALXUe)8*A d6=!2=KX>aUd={NMdICr07Uxe_uAe;r_TPdo2FU;b literal 0 HcmV?d00001 diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/2.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/2.png new file mode 100644 index 0000000000000000000000000000000000000000..015b85e5a0ea4be8083f5c65d9ed379a045694bb GIT binary patch literal 15819 zcmeI3&5zqe6u`}g+Oo7&)k;tmP_0x*t%_qiwv*UOvfABj*_B9HZ9}`|0G-&AthI@4 zY-f|*OM!|?tvFPb_!5_15aQAUCn^q5sqhCNAqpoXxImFW;sP94#&!}rlVn(E4+u@9 ze7t${-kbTo=Qs8tmzGXGy=Uss6vHrk78lCP=zCxA-n9dL9{zO;ps$CVg|i;R?7bDd z?|b9;-p3fGaNDe|_$!rXG~I5cfnnERy4!NlY^0m+IzV58K3jtg(<-KZ{`iv=YZ}GW z8KojroH@8^E^NB+)aJ>mzPYBWMryh=Rp@HSK@0kT?Y5ehr*(^|(65Gm2g7`d4X5~P z#nem?kX@-Pv2(TyStXt2bWzH)IW;XRYCa=B#byLC%L^(m%A6o-f~pB3+k2%-Q|MR0 zHR{@O`9v=ql8UKS-*+^g?{qrpj+D0D1~00r$_p7jli|<|&fBnj(B&-eNaUpNrwl#a zH67oyEjI8AYIfT%rcyzm!K=5gmNN)sc|CTBBHslLFQx^4oROgqY@D{+43}o;JZ!=i zw0sZQiDT`YRol0{ReM6nfqG(Kl#@zj5PR%;TdlF7J%4^3A?P6;Yw1-t9LO(2&u+Uq zoL@&< zoZYltv@BSX3jDa?u~ubUZwF;PW9iUC$?y_MLa7Qb+*!~V9_=fdW+`eLhOL{176;Yq zB7mwaarvC6aH0rRPKAcf=~-P@bR!2ca;?Az7cX)Vud7!Zz47s`>k7=|Yc=toyN&`5 zZzf5Kgd(W0N<~|=JRcxZi{%m;NSkQWVjT*o{mC2vvcbtUS>S3AN}MDMl9U5#R#fz` z?1s(bP4`^)qa)YjH?Asb#xM+(yzywA31=gLo^?%hQh;V+POujP?FHm(0@URk2c^8q zLNvh~P3QIyjF?Z3(OHESsUbzK!da7@ zcy`_I02j_Q(51SaUKx2EHpAWj-353TiSWSs-K9Z=*?LxyM9z>=0}%vSA|!bGRq=`|M~BEd)1W8tT8O7l5$ui3NUSEUuYo z{z}kCo9%GEnibHC7lY59X;O`wo+XVor!L$??281jUaZSa4SB4h)k8%h78Tr#2Z(T=!WM=h+Kl_NV@59%w-1+5? z15fA=AKo$h%KTC1gEeOUg={&ZRGY+I^7u{?O^2r$0Y@2?b^r M=TDZe&z^hrFCj}I8~^|S literal 0 HcmV?d00001 diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/3.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/3.png new file mode 100644 index 0000000000000000000000000000000000000000..e62c91b16c78c4fdc4d2c8218852925f6a6b35b4 GIT binary patch literal 15896 zcmeI3Ply{;7{Es=wXSUOP_$amA*Euellec%3`xrFrgaxgUAB>Kq0qj}d&!PXW~MW< zO?DBiRjYy*g+h+$=( z%ZGOFje!_HceBM6j4zGJVOXK+z508H{72%>H8_8&<-3w zay*xh{eqge9u+g0IMCqL+gHmU1aiY3J4{jR0AG}|k~ql-+5;PZJ!p2925k{FQ46_I zi0$NwcK(_ddEuHjCFDRoH89Rer80;;alNh9#L!`MGJjI%+YeyYtidn2l%(|tJWT=4mYApl^L|#z!yk;q>vgJNPeqkZ5 zsvQ6H3CD$AJ3LqrNt0o|hu%;bM5u%iHFZ;g z5Sl_hC+mVNBU3ODv<2I+ZQX`BplG#%82@;&i{ZL@wb2`&?Aor&0GXQlFSxGjNXge~ z^51uz>}8ZwItet&aq(6v){+}W04HIoT*3oc2lG@gH@%LaVA`f3Xqtwv|yT8w>P&;NU|DG*ffpy+FJd&8R76 z&Q=6NRZYRb%NOz*)C7oB4L}v<>In4rGQrJQs6{8P){W8P=~nA;bZ&HXSgqaT!UsW! z;$~RP^t<8Ud`SwhSBBlDY5_YwXi9e6s}L-RBcsD*4J-@E1ZO;*+e0vBK0QWz4Y{;l zm$>TAn(id@>QNg6Xs&^~z;@bj;&s%FbpKbs?Yl@s2+rSK8Vm^m3FQnySCE4154RFi zlk0*}134Q?xw@fh{WPbtNNzE%subYCk%Ny5$&xiomios@BKU)&2ox9`aX zacpc@Gs*nbxQ{m1yYo#$!Y@&dKYONWHEDX1Zkkq;rbEjYTqi0iy=cU6$}0XNn*2*T zj_;XJ$N`}E;3wnK7^LxB7o3EhKtUJ z&@x;E5W2{4(fJTshKm3~7a1-(A41D;5kTl7!$s#qXc;a72wh~j=zIt*!$kn0iwqZ? z520na2q1Kk;iB^)v zIv+yIa1lW0BEv=JLueT;0tj7XxafQcEyG0sp^FR`oe!a9xCkJ0k>R5AA+!t^0fa6x zTy#E!mf<3R&_#xe&WF%4Tm%rhNX0cXd=eVD`0?j9e$M&!jo+`~XQX+1aizj>n+G`V z!mAv2XA6J-#Bu8q$NhYU|#Z|J^S8Q5AAs%bMyUoetE5YZsm!OzuUE!`|QS>w?4SO?`s^2TRL*A{L%cGi+=*y CQ#i%| literal 0 HcmV?d00001 diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/4.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/4.png new file mode 100644 index 0000000000000000000000000000000000000000..695cc03088eeab56a7bee600787fed85b0640821 GIT binary patch literal 15689 zcmeI3&5zqe6u{kXSzy&xy;0f&Zc0T_>)4L-Wh+U$-E6xnk+R(`>Xr)~+mpoI#5T6K z$*wrGaN>#pRpr1R0OEjLlS16sy*KAe|iw6v8FXuQfMZ{EE3 zW`1wxjeYRjD;F;um^(7ZaomCBrRpmAJ`{eQnkE0A`+WzIuczImt3Jma{3iVDdGFN0 zqa0U4*4lcoUVBM1oOT+Sj*ipawo7^w-I=b7j13&{I&N5YIrZz8U!{1$Mer!SOJkOXmecR*HNV1kywBx9k9Q1=~L!JL&tWV&CvAH?SO= z5B(zD*$m35R2XP*_2$)f2Z3zA$Bs}GyT}#gv?NY4GL3o*3E>7H<#)J){#Y{k1I@i>ugoHa!C`-XK#s zK56!WRUam2#8ar5I(FQ(rkI7A*eqHKafV7{uG)f!QQ&xMj?=2dt8Ar@kY88`S5<*O zdBw6#r{lj^5~0a3-$QS>iUM3AmZ~7-1u3@{u17^v3a6xuCP@h=aZli*=9pG}Ys`nD zNd>a3lRgqXp%1cuOcbD9c}ez7_%RKw?s#n!RID~?V9~W3C2`o8=s8$b+Je(^JTfd? zQA*;Z=80BS$Jh*)^}KChpCrRiB#ERd+PLRXW3;ueXjv7Kl(cD?nyIT;sTXuXmsLej za5gWXtZoX$dOa%@idjR!g_0Oc0y`VIf3%fg|}_-J;i16gn=vhTu#ZAMA!^1R;(^=tye8_PvM6rft>HzK*dDE ztJ4eHKEbd1HVu3>Tdb&@x;A2wh~j=zM^d;Q~PDBEv=J1GEem z074fTE;=8eWw-zky2xR5A0a}I& z0HKQv7o88#GF$)%U1YfEe1MkW0zl{@!$s!Iv=2AxBw8k$Z*m504>7> zfY3#Ti_QmV87=^XE;3wnK0wQG0U&gd;iB^aT80Y%p^H>pbHn$Bu}xkU?vS^FKmS%1 z$Q#AHv9wy_xa|`hck?Zd`*VkU|IBfl636{=jpMZ29QTa#&TIG2lfL?Lb$+e;z5d6} z&Y77Lw{KmaUBB+i1$n_Q$(l>_01; z_hyzqZoPqSes`#K=fShTeW=fze6aWat)(BD&%bc&();f|dAhK7mOJ{{k?q4zTzHj4 P zJ56@g11&w!QxW3pz#o8wgb)%Z4zv;+IB@F)BqYQI0S6>FfrQG~&WAHeMoU`>fyPok z-n@D5&HUcX8~fnvtEZovpF1?iFwFeQa%~O$J{EuWJdD1d{QV9e>tK<^D8u}kM^Eo!@5?!d| z7UF>HMtzlC^a98#`66eEQkgBOc~Mcz1^F0T5X2%csJtk1f~X0qCWvhR%2nskKRvK) zZLM~)9}Y>C+-4N{8qasT-F#QddqI;IRaNDM0$(U_s0SBrxe@4bZg@C#GVoJ_p&2-S z%%P3n30ld}ER%;V*oJNt zB0F)aoxkZtUbyMa2su>G42*J8uMcBS9dElmHFOv)T|x-@NT*tcjV&MYYcTXWfeDu` zp{X36Hv7o2N68uU6l-RV9rm0VX0awUOO`^KAsx+CTMQtGyrAKEt!lc;RtE^##l?74 zmDnR^9M|%?;WIjqn~d^3@&;=lf>mUxazc?4lt#QBB~6x(3I$CNGEUN-n2)+=Iri3s z4@nbBnlR=g(-ZfB_KyW3up=+oz8OE3so7r822s^%gC^vCx2f}^#!S!Qs?rv{mKUI5 z!K$S5)0(GR)jYEkFY5)@gds{sm`M^!RkCqUfaZAXK+$rlC@Fc%u{6t2p=6f~&Jb0J zlb~GWfNWS?*|ue&RF+K%mUKSeuE=OKlGszyIvyiC0n!NL#MkTEiW^1%O<<*#jK@La zfj|_BWm`eZKu|at$bd7-io_|B1Xa<5iXs)0)i7>88d=}&3Em&ovjOJF7 zxe}TtrwTyeM9EOgielTQZ46vz%qLvG5ICr0gI1=`faX65F~!Y9sAVV4?G^?;&c-^t zINmzSZBkr)5QH!;9hKamb_}aA>N>piqy%ZejLUM>jCVG)bbhRLG%VcAnM~l$5TyPy z=CfmTH=#?a45_Q6*K8-DXGdKSz=bB-Gdn3-sn>Bc-2L=@ffyybujSlBB0_NK-qN5N zA}H9F$O&rMY@-O;82}`rk`K3_Oi)ZUVOnttvm5 z*`VRSl)0T%z;wcQmpSZM{2yd4-HGEhaZt)9Yp5RI5oxIYqFMlwx+m)VMB8Z1r2RMI zI@;auC#s@7n+z0d&RE5_ZRtJ5I(ou@)gn4E z6`jYMaf?-_2U{C82i;SI@kt<}Q#P@|6;ln*&N9p>`i5z$GS33ZF_yNXCk^zF!w;Ww zCQi8F`Ex)2jAnE{y<)y-5DW-eq`1g@FfGM}0U?VN7nu*HrMNI4WRc<`^TD(f7Y2kZ zQe0#{n3m$gfRIIsi_8bpQd}4ivPf}}`CwX#3j;zHDK0V}OiOWLK*%D+MdpKPDJ~2M zS){ngd@wD=g#jUp6c?Efrlq(rAY_r^BJ;tt6c+}BEK*!#KA4u`!hn!Pii^w#(^6a* z5VA;dk@;X+iVFim7AY<=A52SeVL-?t#YN_WX(=uY2w9}K$b2v@#f1SOixd}`52mHK zFd$@+;v)0Gv=kQxge($q&5hn0hAw(pxQpHj{tgt2=#665Twbd)%=Xg^^Xh91^T!?Z z`xC=-1cv$fJi}=3G0fxMo3DI%67{uKY733tx5me}zmGqE-ne#f&-wkIKJw0?b9a99 zKe;9DS`=;@dwvjif2i%hKL6-b7Y|-tpI>t7Q~P1_CL_H3Y(vt)4HS=ASvp<&=*0P}e*pO!hE;wquxk&wCe-w9E?~Kt~qWw_s5stIC9rQ5lqmFZH~Kn~h40&KV4azmqA&Lw^gbR9SIIX3AMoh#>N z z*N*qXA*q~eMv-sue5cdNcci=*tns3*>%36l3k44K;KEHe0$t7x52sH0erhnZ0>_UW z&t+r3!1UImaxNDK8XUcOwf#XLH|()P6!|Xjc`+~WAn#lseCLpKVM zojBIcZ+ejzHoXZU2kMD|QBLahLF}>PZMVmU4x_mZgrJ9XtYx^e=|g@QhTeK$!MP1I zmBZs^A32R-az;GGnu%kFU1x$>tVzw1rI2Q*gyw2g0|+87Sn<48C0%7peS~ba8n3D% z`@|{7wY^UGWQoU3hWQ?PgEbJr3bNEWLFEKxC0>uRA*e@$f*}YQCuvX2N8PiX#^yF3 z5^`WDde%p#C+-979~(qqM_#ghGk$E#Xm~*zL=~qE)*$b@YbAcznCUrKRYuioc>x+0 ztVkt(T=Q6~nrE%Y%X-$eV2F|tW|D+bm2BK&U~ROuuV^_Hl$5;f*oJNDP-+xS&J=Zt zlc20}KsIeoYcyn`sL7TDizPnZuE=OOlGszyIvOK80n!NL#MkS_f*VEvO<kf24N$Z-wICGiWHpSM4@cH>-H+aL9Zyx(G*gvTjgvH` zz(GmY(4-}WlSIK%HAw|U*yy{?m~V6aT;QOR4O*E#eVYFy#27c*Ld`pIZZ|RTaW+oE zmquHMxlM|z4}uWJrK6nd*N#CoMqLL-DJek)u;Q{@vErQ#5#W*5;jnNsXG{WjL^<`J zF`pcx(}XUmGNi7OUXz`KUL)#&0M4$VJ+qUdm3kdD!`+YH7l=`^`&!OzBq9VGx0eRV zv@H_=le28S$SJ05a=HpsPEr~o)CAjBbhV%6TTVmKD2V;y`tPM72A)Q@n!sIyc7^ZH ztl#io%G}N>U^?Mj%N%xF{2yd4-HD?$v0uu!*U(b@L}Z})i)sN#>YiBQx3vw|Oxk}n zuA{B>q`$5T=-|cpzh|0NwCIHNo174t=dU_i(s#YN_WX(=uY2w9}K$b2v@#f1SOixd}`52mHKFd$@+ z;v)0Gv=kQxge+2AWImXd;=+KCMT(2e2h&nq7!a~Zagq68T8aw;LKZ15G9OG!abZBn zBE?1KgJ~%)3Vor!L$??281k9Tx33&mg2&I zkVT4%%m>p_To@3tNO6(*U|Na`140%lE;1iXOL1X9$Rfo>=7VV|E({1+q`1g@FfGM} z0U?VN7nu*HrMNI4WRZw#didQibkWDc9rRW3%=LpGp)ZPAYks-TFk6o^%*(GZ%wIRr z`5MEl3k>u7S%xv*XPEoFcV4`59QAbni>g<8fXWlz>=H_qy zXWxpus>0Rpb{9);KW0yzdHCb|t}xNX#?+#s-MhcQ=rjI}OAqK@J$kYF(A-<+UvGZ@ z<|i)m^<8s6-E&}fZtmy#7mi)neC@`<2Os`eJF&56hB@)YzNZgg`|~`C%q+|;);>LU G_QKysfA?ts literal 0 HcmV?d00001 diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/7.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/7.png new file mode 100644 index 0000000000000000000000000000000000000000..c17114ae828d3f89b6b216099a54c12ce1abad53 GIT binary patch literal 15684 zcmeI3O^n+_6o9>gqOxi$Zis@wN+~KTj>qv&Vk=3t-E7%KWC`1?x|Kk5Y>yMu#16K% z$?l1^5)wCr09AquTq|+p!T~Da!ig)KsF0B0!T}+{DU9v>IFn?ww3QHOEG71vH}Acf z@69~h2fy9eeE#V2@nw$Vj&7{iw($9p_;>gr{QuPN1Bg!#ch@h49Cz&N__y@_>0^&` zTp7CCJJC-4MZ@wtd1(74%J(~6+#Bo8^t;fyf+F5TP1mdBe*6539Piqd+(oqx>fKe; za@Y3*bbfzx+uFZk>2~f+b-CO(u!9bYAm8t_z0l}aa*1C9U&qa2j!(KoS1P%cI3T}M zZ}6*rfOs{p36><6_@bVdRJ~MCp5qHZ(nO$(k|F@f0J;Gret6`n%lN7s*p9JPJ2wo6 zrAn?9MO{M_d%a%1C+Gd3DN4Goi=ZGD3IgsSgnM2D`+^sqNS%!Q)KF*zZZ~p$kB|LA z)8CCMxm+A*d<^H+>5c<=;gB7sDE47jl=48FXJlJro9=GVPKIV%B5I=!@}dyiNptPG zEkE+ZmcJn6SiLYX&PlyKjy-q0ozC3QVYGG?BN!r`YZ-3ub&b~tddow;{189aS zXMJRPl0NYMv0(%cb9rssH78LNKV5Ad*1RW6J3 zn&(>8d}}ve)+?TcLY#~+lO&v~WaFNN&FR*WqU~03Qu4NI8@8z<*(sWWDe1BxBSjOS zV%kEf2xPB>camj}5OrH_We-dJjo0(ASZk*da0(_i}^XQG~)=6%Y z;@X8lh~m;w$&G5qxEkZGHLssD`m;uyUa z@@SPIb(Qp5>?HJ^s0RbI(!_h_AVn+nI&DU}pT93Kqh$BB-Frwx2(R8-8dL~%$CP!! zv2{~`mSPJ!k`UhEvIbOHl7VWD(tOux&(xTz^ zQG2K6;%AC5z7t5=(1ujZHN3RQFrye6rm4!j3naI(v=zT;;Flb6{FXCwha2C2?&rm1 zM)%Vz;fnLd$RwKTdbp=G!TAas%8qVplN3>N`}E;3wnK7^LxB7o3EhKtUJ&@x;E z5W2{4(fJTshKm3~7a1-(A41D;5kTl7!$s#qXc;a72wh~j=zIt*!$kn0iwqZ?520na z2q1Kk;iB^)vIv+yI za1lW0A{E#2Yj zGj4L+qyD?EeRB@?eRZR@vfcl|{Btlk^T5fQcLsyOkq?f)68{Dt-@L}Xb!%1oaqz_E zXM?cx{o%*1e{$^BQvb;9#*I6N%%flae8~K2Y3<1mm!7@@U+31Yt-q{nee}+$&2QgB d&%6LGb3e5j5B_nXf#Y!8#@c4>)3cYa{|(ic^*I0l literal 0 HcmV?d00001 diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java b/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java index d33785c9e7..17a61f3b48 100644 --- a/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java +++ b/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java @@ -1034,4 +1034,8 @@ public interface RSClient extends RSGameShell, Client @Import("viewportWalking") void setViewportWalking(boolean viewportWalking); + + @Import("crossSprites") + @Override + RSSpritePixels[] getCrossSprites(); } From a2f643db44034d3616fddb932123702f2fdbc7cb Mon Sep 17 00:00:00 2001 From: winterdaze <35933468+winterdaze-rs@users.noreply.github.com> Date: Thu, 27 Jun 2019 08:43:48 -0500 Subject: [PATCH 25/58] Add tooltips to DevTools buttons (#9224) --- .../net/runelite/client/plugins/devtools/DevToolsButton.java | 1 + 1 file changed, 1 insertion(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsButton.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsButton.java index 52de0309a9..e21af75f5a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsButton.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsButton.java @@ -37,6 +37,7 @@ class DevToolsButton extends JButton { super(title); addActionListener((ev) -> setActive(!active)); + this.setToolTipText(title); } void setActive(boolean active) From 8f302a1532e92631651be80ff119d28e73fb503f Mon Sep 17 00:00:00 2001 From: William Collishaw Date: Thu, 27 Jun 2019 01:27:56 -0600 Subject: [PATCH 26/58] Replace use of deprecated Guava Files write method --- cache/src/test/java/net/runelite/cache/AreaDumper.java | 2 +- cache/src/test/java/net/runelite/cache/EnumDumperTest.java | 2 +- cache/src/test/java/net/runelite/cache/FrameDumper.java | 2 +- cache/src/test/java/net/runelite/cache/FramemapDumper.java | 2 +- cache/src/test/java/net/runelite/cache/InventoryDumper.java | 2 +- cache/src/test/java/net/runelite/cache/KitDumperTest.java | 2 +- cache/src/test/java/net/runelite/cache/OverlayDumper.java | 2 +- cache/src/test/java/net/runelite/cache/SequenceDumper.java | 2 +- .../test/java/net/runelite/cache/SoundEffectsDumperTest.java | 2 +- cache/src/test/java/net/runelite/cache/StructManagerTest.java | 2 +- cache/src/test/java/net/runelite/cache/TextureDumper.java | 2 +- cache/src/test/java/net/runelite/cache/UnderlayDumper.java | 2 +- cache/src/test/java/net/runelite/cache/VarbitDumper.java | 2 +- cache/src/test/java/net/runelite/cache/WorldMapDumperTest.java | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) diff --git a/cache/src/test/java/net/runelite/cache/AreaDumper.java b/cache/src/test/java/net/runelite/cache/AreaDumper.java index b789d78a0d..2aab1db48b 100644 --- a/cache/src/test/java/net/runelite/cache/AreaDumper.java +++ b/cache/src/test/java/net/runelite/cache/AreaDumper.java @@ -64,7 +64,7 @@ public class AreaDumper for (AreaDefinition area : areaManager.getAreas()) { - Files.write(gson.toJson(area), new File(outDir, area.id + ".json"), Charset.defaultCharset()); + Files.asCharSink(new File(outDir, area.id + ".json"), Charset.defaultCharset()).write(gson.toJson(area)); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/EnumDumperTest.java b/cache/src/test/java/net/runelite/cache/EnumDumperTest.java index a094b9fc24..705356b0b5 100644 --- a/cache/src/test/java/net/runelite/cache/EnumDumperTest.java +++ b/cache/src/test/java/net/runelite/cache/EnumDumperTest.java @@ -80,7 +80,7 @@ public class EnumDumperTest if (def != null) { - Files.write(gson.toJson(def), new File(dumpDir, file.getFileId() + ".json"), Charset.defaultCharset()); + Files.asCharSink(new File(dumpDir, file.getFileId() + ".json"), Charset.defaultCharset()).write(gson.toJson(def)); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/FrameDumper.java b/cache/src/test/java/net/runelite/cache/FrameDumper.java index 2bd7e2ca17..8e856cd2f8 100644 --- a/cache/src/test/java/net/runelite/cache/FrameDumper.java +++ b/cache/src/test/java/net/runelite/cache/FrameDumper.java @@ -101,7 +101,7 @@ public class FrameDumper frames.add(frame); } - Files.write(gson.toJson(frames), new File(outDir, archive.getArchiveId() + ".json"), Charset.defaultCharset()); + Files.asCharSink(new File(outDir, archive.getArchiveId() + ".json"), Charset.defaultCharset()).write(gson.toJson(frames)); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/FramemapDumper.java b/cache/src/test/java/net/runelite/cache/FramemapDumper.java index 4513bf3dfb..f95e92c9fa 100644 --- a/cache/src/test/java/net/runelite/cache/FramemapDumper.java +++ b/cache/src/test/java/net/runelite/cache/FramemapDumper.java @@ -74,7 +74,7 @@ public class FramemapDumper FramemapLoader loader = new FramemapLoader(); FramemapDefinition framemap = loader.load(0, contents); - Files.write(gson.toJson(framemap), new File(outDir, archive.getArchiveId() + ".json"), Charset.defaultCharset()); + Files.asCharSink(new File(outDir, archive.getArchiveId() + ".json"), Charset.defaultCharset()).write(gson.toJson(framemap)); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/InventoryDumper.java b/cache/src/test/java/net/runelite/cache/InventoryDumper.java index 4caf464141..f74c4ce188 100644 --- a/cache/src/test/java/net/runelite/cache/InventoryDumper.java +++ b/cache/src/test/java/net/runelite/cache/InventoryDumper.java @@ -77,7 +77,7 @@ public class InventoryDumper InventoryLoader loader = new InventoryLoader(); InventoryDefinition inv = loader.load(file.getFileId(), file.getContents()); - Files.write(gson.toJson(inv), new File(outDir, inv.id + ".json"), Charset.defaultCharset()); + Files.asCharSink(new File(outDir, inv.id + ".json"), Charset.defaultCharset()).write(gson.toJson(inv)); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/KitDumperTest.java b/cache/src/test/java/net/runelite/cache/KitDumperTest.java index 286ca6ea8e..4db1267506 100644 --- a/cache/src/test/java/net/runelite/cache/KitDumperTest.java +++ b/cache/src/test/java/net/runelite/cache/KitDumperTest.java @@ -78,7 +78,7 @@ public class KitDumperTest KitDefinition def = loader.load(file.getFileId(), b); - Files.write(gson.toJson(def), new File(dumpDir, file.getFileId() + ".json"), Charset.defaultCharset()); + Files.asCharSink(new File(dumpDir, file.getFileId() + ".json"), Charset.defaultCharset()).write(gson.toJson(def)); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/OverlayDumper.java b/cache/src/test/java/net/runelite/cache/OverlayDumper.java index 4ac4b53a7c..51457192b7 100644 --- a/cache/src/test/java/net/runelite/cache/OverlayDumper.java +++ b/cache/src/test/java/net/runelite/cache/OverlayDumper.java @@ -77,7 +77,7 @@ public class OverlayDumper OverlayLoader loader = new OverlayLoader(); OverlayDefinition overlay = loader.load(file.getFileId(), file.getContents()); - Files.write(gson.toJson(overlay), new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()); + Files.asCharSink(new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()).write(gson.toJson(overlay)); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/SequenceDumper.java b/cache/src/test/java/net/runelite/cache/SequenceDumper.java index 94dd175bbb..485bd3d84f 100644 --- a/cache/src/test/java/net/runelite/cache/SequenceDumper.java +++ b/cache/src/test/java/net/runelite/cache/SequenceDumper.java @@ -77,7 +77,7 @@ public class SequenceDumper SequenceLoader loader = new SequenceLoader(); SequenceDefinition seq = loader.load(file.getFileId(), file.getContents()); - Files.write(gson.toJson(seq), new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()); + Files.asCharSink(new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()).write(gson.toJson(seq)); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/SoundEffectsDumperTest.java b/cache/src/test/java/net/runelite/cache/SoundEffectsDumperTest.java index c2a420c0de..5ac0c9e1c5 100644 --- a/cache/src/test/java/net/runelite/cache/SoundEffectsDumperTest.java +++ b/cache/src/test/java/net/runelite/cache/SoundEffectsDumperTest.java @@ -71,7 +71,7 @@ public class SoundEffectsDumperTest SoundEffectLoader soundEffectLoader = new SoundEffectLoader(); SoundEffectDefinition soundEffect = soundEffectLoader.load(contents); - Files.write(gson.toJson(soundEffect), new File(dumpDir, archive.getArchiveId() + ".json"), Charset.defaultCharset()); + Files.asCharSink(new File(dumpDir, archive.getArchiveId() + ".json"), Charset.defaultCharset()).write(gson.toJson(soundEffect)); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/StructManagerTest.java b/cache/src/test/java/net/runelite/cache/StructManagerTest.java index 470df61bc0..f1a1fb22ca 100644 --- a/cache/src/test/java/net/runelite/cache/StructManagerTest.java +++ b/cache/src/test/java/net/runelite/cache/StructManagerTest.java @@ -64,7 +64,7 @@ public class StructManagerTest { StructDefinition def = struct.getValue(); - Files.write(gson.toJson(def), new File(dumpDir, struct.getKey() + ".json"), Charset.defaultCharset()); + Files.asCharSink(new File(dumpDir, struct.getKey() + ".json"), Charset.defaultCharset()).write(gson.toJson(def)); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/TextureDumper.java b/cache/src/test/java/net/runelite/cache/TextureDumper.java index cdcdbd9f6a..0aba683504 100644 --- a/cache/src/test/java/net/runelite/cache/TextureDumper.java +++ b/cache/src/test/java/net/runelite/cache/TextureDumper.java @@ -64,7 +64,7 @@ public class TextureDumper for (TextureDefinition texture : tm.getTextures()) { - Files.write(gson.toJson(texture), new File(outDir, texture.getId() + ".json"), Charset.defaultCharset()); + Files.asCharSink(new File(outDir, texture.getId() + ".json"), Charset.defaultCharset()).write(gson.toJson(texture)); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/UnderlayDumper.java b/cache/src/test/java/net/runelite/cache/UnderlayDumper.java index db735d40cf..04f2997530 100644 --- a/cache/src/test/java/net/runelite/cache/UnderlayDumper.java +++ b/cache/src/test/java/net/runelite/cache/UnderlayDumper.java @@ -77,7 +77,7 @@ public class UnderlayDumper UnderlayLoader loader = new UnderlayLoader(); UnderlayDefinition underlay = loader.load(file.getFileId(), file.getContents()); - Files.write(gson.toJson(underlay), new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()); + Files.asCharSink(new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()).write(gson.toJson(underlay)); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/VarbitDumper.java b/cache/src/test/java/net/runelite/cache/VarbitDumper.java index 5f75c7a157..9bcdcf9237 100644 --- a/cache/src/test/java/net/runelite/cache/VarbitDumper.java +++ b/cache/src/test/java/net/runelite/cache/VarbitDumper.java @@ -77,7 +77,7 @@ public class VarbitDumper VarbitLoader loader = new VarbitLoader(); VarbitDefinition varbit = loader.load(file.getFileId(), file.getContents()); - Files.write(gson.toJson(varbit), new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()); + Files.asCharSink(new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()).write(gson.toJson(varbit)); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/WorldMapDumperTest.java b/cache/src/test/java/net/runelite/cache/WorldMapDumperTest.java index 8d8dd956c4..92b2582a91 100644 --- a/cache/src/test/java/net/runelite/cache/WorldMapDumperTest.java +++ b/cache/src/test/java/net/runelite/cache/WorldMapDumperTest.java @@ -77,7 +77,7 @@ public class WorldMapDumperTest WorldMapLoader loader = new WorldMapLoader(); WorldMapDefinition def = loader.load(file.getContents(), file.getFileId()); - Files.write(gson.toJson(def), new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()); + Files.asCharSink(new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()).write(gson.toJson(def)); ++count; } } From a5d3e5de94997a0beb98af57fa8f70087d1bc89f Mon Sep 17 00:00:00 2001 From: ltvill <40988464+ltvill@users.noreply.github.com> Date: Wed, 1 Aug 2018 22:19:57 +0300 Subject: [PATCH 27/58] Change default examine chat color to green For better visibility --- .../main/java/net/runelite/client/config/ChatColorConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/config/ChatColorConfig.java b/runelite-client/src/main/java/net/runelite/client/config/ChatColorConfig.java index 0bcf67341c..c9a3e40d3d 100644 --- a/runelite-client/src/main/java/net/runelite/client/config/ChatColorConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/config/ChatColorConfig.java @@ -451,7 +451,7 @@ public interface ChatColorConfig extends Config ) default Color transparentExamineHighlight() { - return Color.decode("#0000FF"); + return Color.GREEN; } @ConfigItem( From 63664fbac735a84df493e22570dda7a4a91e19ad Mon Sep 17 00:00:00 2001 From: sdburns1998 Date: Sat, 29 Jun 2019 00:28:22 +0200 Subject: [PATCH 28/58] chat commands: add ba high gamble command --- .../runelite/http/api/chat/ChatClient.java | 8 +-- .../http/service/chat/ChatController.java | 2 +- .../http/service/chat/ChatService.java | 2 +- .../chatcommands/ChatCommandsPlugin.java | 70 +++++++++++++++++++ 4 files changed, 76 insertions(+), 6 deletions(-) diff --git a/http-api/src/main/java/net/runelite/http/api/chat/ChatClient.java b/http-api/src/main/java/net/runelite/http/api/chat/ChatClient.java index 3e9ffe3fd9..532b56d158 100644 --- a/http-api/src/main/java/net/runelite/http/api/chat/ChatClient.java +++ b/http-api/src/main/java/net/runelite/http/api/chat/ChatClient.java @@ -225,7 +225,7 @@ public class ChatClient public boolean submitGc(String username, int gc) throws IOException { - HttpUrl url = RuneLiteAPI.getPlusApiBase().newBuilder() + HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() .addPathSegment("chat") .addPathSegment("gc") .addQueryParameter("name", username) @@ -237,7 +237,7 @@ public class ChatClient .url(url) .build(); - try (Response response = RuneLiteAPI.RLP_CLIENT.newCall(request).execute()) + try (Response response = RuneLiteAPI.CLIENT.newCall(request).execute()) { return response.isSuccessful(); } @@ -245,7 +245,7 @@ public class ChatClient public int getGc(String username) throws IOException { - HttpUrl url = RuneLiteAPI.getPlusApiBase().newBuilder() + HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() .addPathSegment("chat") .addPathSegment("gc") .addQueryParameter("name", username) @@ -255,7 +255,7 @@ public class ChatClient .url(url) .build(); - try (Response response = RuneLiteAPI.RLP_CLIENT.newCall(request).execute()) + try (Response response = RuneLiteAPI.CLIENT.newCall(request).execute()) { if (!response.isSuccessful()) { diff --git a/http-service/src/main/java/net/runelite/http/service/chat/ChatController.java b/http-service/src/main/java/net/runelite/http/service/chat/ChatController.java index 5aa1b8144b..df287e6512 100644 --- a/http-service/src/main/java/net/runelite/http/service/chat/ChatController.java +++ b/http-service/src/main/java/net/runelite/http/service/chat/ChatController.java @@ -100,4 +100,4 @@ public class ChatController { return chatService.getHosts(world, location); } -} +} \ No newline at end of file diff --git a/http-service/src/main/java/net/runelite/http/service/chat/ChatService.java b/http-service/src/main/java/net/runelite/http/service/chat/ChatService.java index ebce4c49a0..aa23d3f18d 100644 --- a/http-service/src/main/java/net/runelite/http/service/chat/ChatService.java +++ b/http-service/src/main/java/net/runelite/http/service/chat/ChatService.java @@ -117,4 +117,4 @@ public class ChatService jedis.lrem(key, 0, json); } } -} +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java index 269c116c76..92bd2f588c 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java @@ -98,6 +98,7 @@ public class ChatCommandsPlugin extends Plugin private static final String QP_COMMAND_STRING = "!qp"; private static final String GC_COMMAND_STRING = "!gc"; private static final String PB_COMMAND = "!pb"; + private static final String GC_COMMAND_STRING = "!gc"; private final HiscoreClient hiscoreClient = new HiscoreClient(); private final ChatClient chatClient = new ChatClient(); @@ -148,6 +149,7 @@ public class ChatCommandsPlugin extends Plugin chatCommandManager.registerCommandAsync(QP_COMMAND_STRING, this::questPointsLookup, this::questPointsSubmit); chatCommandManager.registerCommandAsync(GC_COMMAND_STRING, this::gambleCountLookup, this::gambleCountSubmit); chatCommandManager.registerCommandAsync(PB_COMMAND, this::personalBestLookup, this::personalBestSubmit); + chatCommandManager.registerCommandAsync(GC_COMMAND_STRING, this::gambleCountLookup, this::gambleCountSubmit); } @Override @@ -647,6 +649,74 @@ public class ChatCommandsPlugin extends Plugin return true; } + private void gambleCountLookup(ChatMessage chatMessage, String message) + { + if (!config.gc()) + { + return; + } + + ChatMessageType type = chatMessage.getType(); + + final String player; + if (type == ChatMessageType.PRIVATECHATOUT) + { + player = client.getLocalPlayer().getName(); + } + else + { + player = sanitize(chatMessage.getName()); + } + + int gc; + try + { + gc = chatClient.getGc(player); + } + catch (IOException ex) + { + log.debug("unable to lookup gamble count", ex); + return; + } + + String response = new ChatMessageBuilder() + .append(ChatColorType.NORMAL) + .append("Barbarian Assault High-level gambles: ") + .append(ChatColorType.HIGHLIGHT) + .append(Integer.toString(gc)) + .build(); + + log.debug("Setting response {}", response); + final MessageNode messageNode = chatMessage.getMessageNode(); + messageNode.setRuneLiteFormatMessage(response); + chatMessageManager.update(messageNode); + client.refreshChat(); + } + + private boolean gambleCountSubmit(ChatInput chatInput, String value) + { + final int gc = client.getVar(Varbits.BA_GC); + final String playerName = client.getLocalPlayer().getName(); + + executor.execute(() -> + { + try + { + chatClient.submitGc(playerName, gc); + } + catch (Exception ex) + { + log.warn("unable to submit gamble count", ex); + } + finally + { + chatInput.resume(); + } + }); + + return true; + } + /** * Looks up the item price and changes the original message to the * response. From cfeab2017933fe4a0fc0886493f50cb4d73135d5 Mon Sep 17 00:00:00 2001 From: sdburns1998 Date: Sat, 29 Jun 2019 00:30:28 +0200 Subject: [PATCH 29/58] chat commands: add duel arena chat command --- .../runelite/http/api/chat/ChatClient.java | 172 +++++++++----- .../net/runelite/http/api/chat/Duels.java | 36 +++ .../chatcommands/ChatCommandsConfig.java | 11 + .../chatcommands/ChatCommandsPlugin.java | 209 ++++++++++++------ .../InterfaceStylesPlugin.java | 10 +- .../MenuEntrySwapperPlugin.java | 4 - .../chatcommands/ChatCommandsPluginTest.java | 37 +++- .../java/net/runelite/rs/api/RSClient.java | 2 +- 8 files changed, 338 insertions(+), 143 deletions(-) create mode 100644 http-api/src/main/java/net/runelite/http/api/chat/Duels.java diff --git a/http-api/src/main/java/net/runelite/http/api/chat/ChatClient.java b/http-api/src/main/java/net/runelite/http/api/chat/ChatClient.java index 532b56d158..bd8c83f5ef 100644 --- a/http-api/src/main/java/net/runelite/http/api/chat/ChatClient.java +++ b/http-api/src/main/java/net/runelite/http/api/chat/ChatClient.java @@ -39,8 +39,8 @@ import okhttp3.Response; public class ChatClient { private static final Predicate LAYOUT_VALIDATOR = Pattern - .compile("\\[[A-Z]+]:(\\s*\\w+\\s*(\\([A-Za-z]+\\))?,?)+") - .asPredicate(); + .compile("\\[[A-Z]+]:(\\s*\\w+\\s*(\\([A-Za-z]+\\))?,?)+") + .asPredicate(); public boolean submitKc(String username, String boss, int kc) throws IOException { @@ -225,7 +225,7 @@ public class ChatClient public boolean submitGc(String username, int gc) throws IOException { - HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() + HttpUrl url = RuneLiteAPI.getPlusApiBase().newBuilder() .addPathSegment("chat") .addPathSegment("gc") .addQueryParameter("name", username) @@ -245,7 +245,7 @@ public class ChatClient public int getGc(String username) throws IOException { - HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() + HttpUrl url = RuneLiteAPI.getPlusApiBase().newBuilder() .addPathSegment("chat") .addPathSegment("gc") .addQueryParameter("name", username) @@ -255,7 +255,7 @@ public class ChatClient .url(url) .build(); - try (Response response = RuneLiteAPI.CLIENT.newCall(request).execute()) + try (Response response = RuneLiteAPI.RLP_CLIENT.newCall(request).execute()) { if (!response.isSuccessful()) { @@ -273,16 +273,16 @@ public class ChatClient } HttpUrl url = RuneLiteAPI.getPlusApiBase().newBuilder() - .addPathSegment("chat") - .addPathSegment("layout") - .addQueryParameter("name", username) - .addQueryParameter("layout", layout) - .build(); + .addPathSegment("chat") + .addPathSegment("layout") + .addQueryParameter("name", username) + .addQueryParameter("layout", layout) + .build(); Request request = new Request.Builder() - .post(RequestBody.create(null, new byte[0])) - .url(url) - .build(); + .post(RequestBody.create(null, new byte[0])) + .url(url) + .build(); try (Response response = RuneLiteAPI.RLP_CLIENT.newCall(request).execute()) { @@ -290,17 +290,40 @@ public class ChatClient } } + public boolean submitDuels(String username, int wins, int losses, int winningStreak, int losingStreak) throws IOException + { + HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() + .addPathSegment("chat") + .addPathSegment("duels") + .addQueryParameter("name", username) + .addQueryParameter("wins", Integer.toString(wins)) + .addQueryParameter("losses", Integer.toString(losses)) + .addQueryParameter("winningStreak", Integer.toString(winningStreak)) + .addQueryParameter("losingStreak", Integer.toString(losingStreak)) + .build(); + + Request request = new Request.Builder() + .post(RequestBody.create(null, new byte[0])) + .url(url) + .build(); + + try (Response response = RuneLiteAPI.CLIENT.newCall(request).execute()) + { + return response.isSuccessful(); + } + } + public String getLayout(String username) throws IOException { HttpUrl url = RuneLiteAPI.getPlusApiBase().newBuilder() - .addPathSegment("chat") - .addPathSegment("layout") - .addQueryParameter("name", username) - .build(); + .addPathSegment("chat") + .addPathSegment("layout") + .addQueryParameter("name", username) + .build(); Request request = new Request.Builder() - .url(url) - .build(); + .url(url) + .build(); try (Response response = RuneLiteAPI.RLP_CLIENT.newCall(request).execute()) { @@ -328,15 +351,15 @@ public class ChatClient public House[] getHosts(int world, String location) throws IOException { HttpUrl url = RuneLiteAPI.getPlusApiBase().newBuilder() - .addPathSegment("chat") - .addPathSegment("hosts") - .addQueryParameter("world", Integer.toString(world)) - .addQueryParameter("location", location) - .build(); + .addPathSegment("chat") + .addPathSegment("hosts") + .addQueryParameter("world", Integer.toString(world)) + .addQueryParameter("location", location) + .build(); Request request = new Request.Builder() - .url(url) - .build(); + .url(url) + .build(); try (Response response = RuneLiteAPI.RLP_CLIENT.newCall(request).execute()) { @@ -347,6 +370,35 @@ public class ChatClient InputStream in = response.body().byteStream(); return RuneLiteAPI.GSON.fromJson(new InputStreamReader(in), House[].class); + + } + catch (JsonParseException ex) + { + throw new IOException(ex); + } + } + + public Duels getDuels(String username) throws IOException + { + HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() + .addPathSegment("chat") + .addPathSegment("duels") + .addQueryParameter("name", username) + .build(); + + Request request = new Request.Builder() + .url(url) + .build(); + + try (Response response = RuneLiteAPI.CLIENT.newCall(request).execute()) + { + if (!response.isSuccessful()) + { + throw new IOException("Unable to look up duels!"); + } + + InputStream in = response.body().byteStream(); + return RuneLiteAPI.GSON.fromJson(new InputStreamReader(in), Duels.class); } catch (JsonParseException ex) { @@ -357,24 +409,24 @@ public class ChatClient public boolean submitHost(int world, String location, House house) throws IOException { HttpUrl url = RuneLiteAPI.getPlusApiBase().newBuilder() - .addPathSegment("chat") - .addPathSegment("hosts") - .addQueryParameter("world", Integer.toString(world)) - .addQueryParameter("location", location) - .addQueryParameter("owner", house.getOwner()) - .addQueryParameter("guildedAltar", Boolean.toString(house.isGuildedAltarPresent())) - .addQueryParameter("occultAltar", Boolean.toString(house.isOccultAltarPresent())) - .addQueryParameter("spiritTree", Boolean.toString(house.isSpiritTreePresent())) - .addQueryParameter("fairyRing", Boolean.toString(house.isFairyRingPresent())) - .addQueryParameter("wildernessObelisk", Boolean.toString(house.isWildernessObeliskPresent())) - .addQueryParameter("repairStand", Boolean.toString(house.isRepairStandPresent())) - .addQueryParameter("combatDummy", Boolean.toString(house.isCombatDummyPresent())) - .build(); + .addPathSegment("chat") + .addPathSegment("hosts") + .addQueryParameter("world", Integer.toString(world)) + .addQueryParameter("location", location) + .addQueryParameter("owner", house.getOwner()) + .addQueryParameter("guildedAltar", Boolean.toString(house.isGuildedAltarPresent())) + .addQueryParameter("occultAltar", Boolean.toString(house.isOccultAltarPresent())) + .addQueryParameter("spiritTree", Boolean.toString(house.isSpiritTreePresent())) + .addQueryParameter("fairyRing", Boolean.toString(house.isFairyRingPresent())) + .addQueryParameter("wildernessObelisk", Boolean.toString(house.isWildernessObeliskPresent())) + .addQueryParameter("repairStand", Boolean.toString(house.isRepairStandPresent())) + .addQueryParameter("combatDummy", Boolean.toString(house.isCombatDummyPresent())) + .build(); Request request = new Request.Builder() - .post(RequestBody.create(null, new byte[0])) - .url(url) - .build(); + .post(RequestBody.create(null, new byte[0])) + .url(url) + .build(); try (Response response = RuneLiteAPI.RLP_CLIENT.newCall(request).execute()) { @@ -385,29 +437,29 @@ public class ChatClient public boolean removeHost(int world, String location, House house) throws IOException { HttpUrl url = RuneLiteAPI.getPlusApiBase().newBuilder() - .addPathSegment("chat") - .addPathSegment("hosts") - .addQueryParameter("world", Integer.toString(world)) - .addQueryParameter("location", location) - .addQueryParameter("owner", house.getOwner()) - .addQueryParameter("guildedAltar", Boolean.toString(house.isGuildedAltarPresent())) - .addQueryParameter("occultAltar", Boolean.toString(house.isOccultAltarPresent())) - .addQueryParameter("spiritTree", Boolean.toString(house.isSpiritTreePresent())) - .addQueryParameter("fairyRing", Boolean.toString(house.isFairyRingPresent())) - .addQueryParameter("wildernessObelisk", Boolean.toString(house.isWildernessObeliskPresent())) - .addQueryParameter("repairStand", Boolean.toString(house.isRepairStandPresent())) - .addQueryParameter("combatDummy", Boolean.toString(house.isCombatDummyPresent())) - .addQueryParameter("remove", Boolean.toString(true)) - .build(); + .addPathSegment("chat") + .addPathSegment("hosts") + .addQueryParameter("world", Integer.toString(world)) + .addQueryParameter("location", location) + .addQueryParameter("owner", house.getOwner()) + .addQueryParameter("guildedAltar", Boolean.toString(house.isGuildedAltarPresent())) + .addQueryParameter("occultAltar", Boolean.toString(house.isOccultAltarPresent())) + .addQueryParameter("spiritTree", Boolean.toString(house.isSpiritTreePresent())) + .addQueryParameter("fairyRing", Boolean.toString(house.isFairyRingPresent())) + .addQueryParameter("wildernessObelisk", Boolean.toString(house.isWildernessObeliskPresent())) + .addQueryParameter("repairStand", Boolean.toString(house.isRepairStandPresent())) + .addQueryParameter("combatDummy", Boolean.toString(house.isCombatDummyPresent())) + .addQueryParameter("remove", Boolean.toString(true)) + .build(); Request request = new Request.Builder() - .post(RequestBody.create(null, new byte[0])) - .url(url) - .build(); + .post(RequestBody.create(null, new byte[0])) + .url(url) + .build(); try (Response response = RuneLiteAPI.RLP_CLIENT.newCall(request).execute()) { return response.isSuccessful(); } } -} +} \ No newline at end of file diff --git a/http-api/src/main/java/net/runelite/http/api/chat/Duels.java b/http-api/src/main/java/net/runelite/http/api/chat/Duels.java new file mode 100644 index 0000000000..ba117a526a --- /dev/null +++ b/http-api/src/main/java/net/runelite/http/api/chat/Duels.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2019, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.http.api.chat; + +import lombok.Data; + +@Data +public class Duels +{ + private int wins; + private int losses; + private int winningStreak; + private int losingStreak; +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsConfig.java index 92987467d0..5a08937345 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsConfig.java @@ -110,6 +110,17 @@ public interface ChatCommandsConfig extends Config @ConfigItem( position = 7, + keyName = "duels", + name = "Duels Command", + description = "Configures whether the duel arena command is enabled
    !duels" + ) + default boolean duels() + { + return true; + } + + @ConfigItem( + position = 8, keyName = "clearShortcuts", name = "Clear shortcuts", description = "Enable shortcuts (ctrl+w and backspace) for clearing the chatbox" diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java index 92bd2f588c..079f1cdba6 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java @@ -64,6 +64,7 @@ import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.util.StackFormatter; import static net.runelite.client.util.Text.sanitize; import net.runelite.http.api.chat.ChatClient; +import net.runelite.http.api.chat.Duels; import net.runelite.http.api.hiscore.HiscoreClient; import net.runelite.http.api.hiscore.HiscoreEndpoint; import net.runelite.http.api.hiscore.HiscoreResult; @@ -89,6 +90,8 @@ public class ChatCommandsPlugin extends Plugin private static final Pattern BARROWS_PATTERN = Pattern.compile("Your Barrows chest count is: (\\d+)"); private static final Pattern KILL_DURATION_PATTERN = Pattern.compile("Fight duration: [0-9:]+. Personal best: ([0-9:]+)"); private static final Pattern NEW_PB_PATTERN = Pattern.compile("Fight duration: ([0-9:]+) \\(new personal best\\)"); + private static final Pattern DUEL_ARENA_WINS_PATTERN = Pattern.compile("You (were defeated|won)! You have(?: now)? won (\\d+) duels?"); + private static final Pattern DUEL_ARENA_LOSSES_PATTERN = Pattern.compile("You have(?: now)? lost (\\d+) duels?"); private static final String TOTAL_LEVEL_COMMAND_STRING = "!total"; private static final String PRICE_COMMAND_STRING = "!price"; private static final String LEVEL_COMMAND_STRING = "!lvl"; @@ -98,7 +101,7 @@ public class ChatCommandsPlugin extends Plugin private static final String QP_COMMAND_STRING = "!qp"; private static final String GC_COMMAND_STRING = "!gc"; private static final String PB_COMMAND = "!pb"; - private static final String GC_COMMAND_STRING = "!gc"; + private static final String DUEL_ARENA_COMMAND = "!duels"; private final HiscoreClient hiscoreClient = new HiscoreClient(); private final ChatClient chatClient = new ChatClient(); @@ -149,7 +152,7 @@ public class ChatCommandsPlugin extends Plugin chatCommandManager.registerCommandAsync(QP_COMMAND_STRING, this::questPointsLookup, this::questPointsSubmit); chatCommandManager.registerCommandAsync(GC_COMMAND_STRING, this::gambleCountLookup, this::gambleCountSubmit); chatCommandManager.registerCommandAsync(PB_COMMAND, this::personalBestLookup, this::personalBestSubmit); - chatCommandManager.registerCommandAsync(GC_COMMAND_STRING, this::gambleCountLookup, this::gambleCountSubmit); + chatCommandManager.registerCommandAsync(DUEL_ARENA_COMMAND, this::duelArenaLookup, this::duelArenaSubmit); } @Override @@ -168,6 +171,7 @@ public class ChatCommandsPlugin extends Plugin chatCommandManager.unregisterCommand(QP_COMMAND_STRING); chatCommandManager.unregisterCommand(PB_COMMAND); chatCommandManager.unregisterCommand(GC_COMMAND_STRING); + chatCommandManager.unregisterCommand(DUEL_ARENA_COMMAND); } @Provides @@ -205,7 +209,9 @@ public class ChatCommandsPlugin extends Plugin @Subscribe public void onChatMessage(ChatMessage chatMessage) { - if (chatMessage.getType() != ChatMessageType.GAMEMESSAGE && chatMessage.getType() != ChatMessageType.SPAM) + if (chatMessage.getType() != ChatMessageType.TRADE + && chatMessage.getType() != ChatMessageType.GAMEMESSAGE + && chatMessage.getType() != ChatMessageType.SPAM) { return; } @@ -241,6 +247,43 @@ public class ChatCommandsPlugin extends Plugin return; } + matcher = DUEL_ARENA_WINS_PATTERN.matcher(message); + if (matcher.find()) + { + final int oldWins = getKc("Duel Arena Wins"); + final int wins = Integer.parseInt(matcher.group(2)); + final String result = matcher.group(1); + int winningStreak = getKc("Duel Arena Win Streak"); + int losingStreak = getKc("Duel Arena Lose Streak"); + + if (result.equals("won") && wins > oldWins) + { + losingStreak = 0; + winningStreak += 1; + } + else if (result.equals("were defeated")) + { + losingStreak += 1; + winningStreak = 0; + } + else + { + log.warn("unrecognized duel streak chat message: {}", message); + } + + setKc("Duel Arena Wins", wins); + setKc("Duel Arena Win Streak", winningStreak); + setKc("Duel Arena Lose Streak", losingStreak); + } + + matcher = DUEL_ARENA_LOSSES_PATTERN.matcher(message); + if (matcher.find()) + { + int losses = Integer.parseInt(matcher.group(1)); + + setKc("Duel Arena Losses", losses); + } + matcher = BARROWS_PATTERN.matcher(message); if (matcher.find()) { @@ -421,6 +464,96 @@ public class ChatCommandsPlugin extends Plugin client.refreshChat(); } + private boolean duelArenaSubmit(ChatInput chatInput, String value) + { + final int wins = getKc("Duel Arena Wins"); + final int losses = getKc("Duel Arena Losses"); + final int winningStreak = getKc("Duel Arena Win Streak"); + final int losingStreak = getKc("Duel Arena Lose Streak"); + + if (wins <= 0 && losses <= 0 && winningStreak <= 0 && losingStreak <= 0) + { + return false; + } + + final String playerName = client.getLocalPlayer().getName(); + + executor.execute(() -> + { + try + { + chatClient.submitDuels(playerName, wins, losses, winningStreak, losingStreak); + } + catch (Exception ex) + { + log.warn("unable to submit duels", ex); + } + finally + { + chatInput.resume(); + } + }); + + return true; + } + + private void duelArenaLookup(ChatMessage chatMessage, String message) + { + if (!config.duels()) + { + return; + } + + ChatMessageType type = chatMessage.getType(); + + final String player; + if (type == ChatMessageType.PRIVATECHATOUT) + { + player = client.getLocalPlayer().getName(); + } + else + { + player = sanitize(chatMessage.getName()); + } + + Duels duels; + try + { + duels = chatClient.getDuels(player); + } + catch (IOException ex) + { + log.debug("unable to lookup duels", ex); + return; + } + + final int wins = duels.getWins(); + final int losses = duels.getLosses(); + final int winningStreak = duels.getWinningStreak(); + final int losingStreak = duels.getLosingStreak(); + + String response = new ChatMessageBuilder() + .append(ChatColorType.NORMAL) + .append("Duel Arena wins: ") + .append(ChatColorType.HIGHLIGHT) + .append(Integer.toString(wins)) + .append(ChatColorType.NORMAL) + .append(" losses: ") + .append(ChatColorType.HIGHLIGHT) + .append(Integer.toString(losses)) + .append(ChatColorType.NORMAL) + .append(" streak: ") + .append(ChatColorType.HIGHLIGHT) + .append(Integer.toString((winningStreak != 0 ? winningStreak : -losingStreak))) + .build(); + + log.debug("Setting response {}", response); + final MessageNode messageNode = chatMessage.getMessageNode(); + messageNode.setRuneLiteFormatMessage(response); + chatMessageManager.update(messageNode); + client.refreshChat(); + } + private void questPointsLookup(ChatMessage chatMessage, String message) { if (!config.qp()) @@ -649,74 +782,6 @@ public class ChatCommandsPlugin extends Plugin return true; } - private void gambleCountLookup(ChatMessage chatMessage, String message) - { - if (!config.gc()) - { - return; - } - - ChatMessageType type = chatMessage.getType(); - - final String player; - if (type == ChatMessageType.PRIVATECHATOUT) - { - player = client.getLocalPlayer().getName(); - } - else - { - player = sanitize(chatMessage.getName()); - } - - int gc; - try - { - gc = chatClient.getGc(player); - } - catch (IOException ex) - { - log.debug("unable to lookup gamble count", ex); - return; - } - - String response = new ChatMessageBuilder() - .append(ChatColorType.NORMAL) - .append("Barbarian Assault High-level gambles: ") - .append(ChatColorType.HIGHLIGHT) - .append(Integer.toString(gc)) - .build(); - - log.debug("Setting response {}", response); - final MessageNode messageNode = chatMessage.getMessageNode(); - messageNode.setRuneLiteFormatMessage(response); - chatMessageManager.update(messageNode); - client.refreshChat(); - } - - private boolean gambleCountSubmit(ChatInput chatInput, String value) - { - final int gc = client.getVar(Varbits.BA_GC); - final String playerName = client.getLocalPlayer().getName(); - - executor.execute(() -> - { - try - { - chatClient.submitGc(playerName, gc); - } - catch (Exception ex) - { - log.warn("unable to submit gamble count", ex); - } - finally - { - chatInput.resume(); - } - }); - - return true; - } - /** * Looks up the item price and changes the original message to the * response. @@ -1301,4 +1366,4 @@ public class ChatCommandsPlugin extends Plugin return WordUtils.capitalize(boss); } } -} +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesPlugin.java index 17093f237e..6944a982d7 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesPlugin.java @@ -71,7 +71,7 @@ public class InterfaceStylesPlugin extends Plugin @Inject private SpriteManager spriteManager; - private SpritePixels[] defaultCrossSprites; + private Sprite[] defaultCrossSprites; @Provides InterfaceStylesConfig provideConfig(ConfigManager configManager) @@ -316,19 +316,19 @@ public class InterfaceStylesPlugin extends Plugin return; } - SpritePixels[] crossSprites = client.getCrossSprites(); + Sprite[] crossSprites = client.getCrossSprites(); if (crossSprites == null) { return; } - defaultCrossSprites = new SpritePixels[crossSprites.length]; + defaultCrossSprites = new Sprite[crossSprites.length]; System.arraycopy(crossSprites, 0, defaultCrossSprites, 0, defaultCrossSprites.length); for (int i = 0; i < crossSprites.length; i++) { - SpritePixels newSprite = getFileSpritePixels("rs3/cross_sprites/" + i + ".png"); + Sprite newSprite = getFileSpritePixels("rs3/cross_sprites/" + i + ".png"); if (newSprite == null) { @@ -351,7 +351,7 @@ public class InterfaceStylesPlugin extends Plugin return; } - SpritePixels[] crossSprites = client.getCrossSprites(); + Sprite[] crossSprites = client.getCrossSprites(); if (crossSprites != null && defaultCrossSprites.length == crossSprites.length) { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java index 236ef2cdd7..c6eb0a7947 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java @@ -1181,10 +1181,6 @@ public class MenuEntrySwapperPlugin extends Plugin { swap(client, "quick-leave", option, target, true); } - else if (config.swapQuick() && option.equals("climb-down")) - { - swap("quick-start", option, target, true); - } else if (config.swapAdmire() && option.equals("admire")) { swap(client, "teleport", option, target, true); diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java index b6af13221d..de4e89299c 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java @@ -30,6 +30,7 @@ import com.google.inject.testing.fieldbinder.BoundFieldModule; import java.util.concurrent.ScheduledExecutorService; import javax.inject.Inject; import static net.runelite.api.ChatMessageType.GAMEMESSAGE; +import static net.runelite.api.ChatMessageType.TRADE; import net.runelite.api.Client; import net.runelite.api.events.ChatMessage; import net.runelite.client.config.ChatColorConfig; @@ -191,4 +192,38 @@ public class ChatCommandsPluginTest verify(configManager).setConfiguration(eq("personalbest.adam"), eq("kree'arra"), eq(181)); } -} \ No newline at end of file + + @Test + public void testDuelArenaWin() + { + when(client.getUsername()).thenReturn("Adam"); + + ChatMessage chatMessageEvent = new ChatMessage(null, TRADE, "", "You won! You have now won 27 duels.", null, 0); + chatCommandsPlugin.onChatMessage(chatMessageEvent); + + verify(configManager).setConfiguration("killcount.adam", "duel arena wins", 27); + verify(configManager).setConfiguration("killcount.adam", "duel arena win streak", 1); + } + + @Test + public void testDuelArenaWin2() + { + when(client.getUsername()).thenReturn("Adam"); + + ChatMessage chatMessageEvent = new ChatMessage(null, TRADE, "", "You were defeated! You have won 22 duels.", null, 0); + chatCommandsPlugin.onChatMessage(chatMessageEvent); + + verify(configManager).setConfiguration("killcount.adam", "duel arena wins", 22); + } + + @Test + public void testDuelArenaLose() + { + when(client.getUsername()).thenReturn("Adam"); + + ChatMessage chatMessageEvent = new ChatMessage(null, TRADE, "", "You have now lost 999 duels.", null, 0); + chatCommandsPlugin.onChatMessage(chatMessageEvent); + + verify(configManager).setConfiguration("killcount.adam", "duel arena losses", 999); + } +} diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java b/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java index 17a61f3b48..17f88f3eb3 100644 --- a/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java +++ b/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java @@ -1037,5 +1037,5 @@ public interface RSClient extends RSGameShell, Client @Import("crossSprites") @Override - RSSpritePixels[] getCrossSprites(); + RSSprite[] getCrossSprites(); } From ab4cc921647155c730f4bcf4ef391746bfd96da2 Mon Sep 17 00:00:00 2001 From: Ganom Date: Fri, 28 Jun 2019 18:44:26 -0400 Subject: [PATCH 30/58] Rework and Improve Fight Caves (#801) --- .../java/net/runelite/api/AnimationID.java | 11 +- .../plugins/fightcave/FightCaveConfig.java | 101 ++++- .../plugins/fightcave/FightCaveContainer.java | 138 +++++++ .../plugins/fightcave/FightCaveOverlay.java | 201 ++++++++++ .../plugins/fightcave/FightCavePlugin.java | 347 +++++++++--------- .../client/plugins/fightcave/JadAttack.java | 53 --- .../client/plugins/fightcave/JadOverlay.java | 87 ----- .../plugins/fightcave/NPCContainer.java | 77 ---- .../plugins/fightcave/TimersOverlay.java | 184 ---------- .../client/plugins/fightcave/WaveMonster.java | 12 +- .../client/plugins/fightcave/WaveOverlay.java | 46 ++- 11 files changed, 652 insertions(+), 605 deletions(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/fightcave/FightCaveContainer.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/fightcave/FightCaveOverlay.java delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/fightcave/JadAttack.java delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/fightcave/JadOverlay.java delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/fightcave/NPCContainer.java delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/fightcave/TimersOverlay.java diff --git a/runelite-api/src/main/java/net/runelite/api/AnimationID.java b/runelite-api/src/main/java/net/runelite/api/AnimationID.java index 8ff7fcd3cc..45ce683b6e 100644 --- a/runelite-api/src/main/java/net/runelite/api/AnimationID.java +++ b/runelite-api/src/main/java/net/runelite/api/AnimationID.java @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.runelite.api;; +package net.runelite.api; /** * Utility class used for mapping animation IDs. @@ -166,8 +166,15 @@ public final class AnimationID public static final int BLOCK_UNARMED = 424; // Same Animation as failed pickpocked // NPC animations - public static final int TZTOK_JAD_MAGIC_ATTACK = 2656; public static final int TZTOK_JAD_RANGE_ATTACK = 2652; + public static final int TZTOK_JAD_MELEE_ATTACK = 2655; + public static final int TZTOK_JAD_MAGIC_ATTACK = 2656; + public static final int TOK_XIL_RANGE_ATTACK = 2633; + public static final int TOK_XIL_MELEE_ATTACK = 2628; + public static final int KET_ZEK_MELEE_ATTACK = 2644; + public static final int KET_ZEK_MAGE_ATTACK = 2647; + public static final int MEJ_KOT_MELEE_ATTACK = 2637; + public static final int MEJ_KOT_HEAL_ATTACK = 2639; public static final int HELLHOUND_DEFENCE = 6566; public static final int VORKATH_WAKE_UP = 7950; public static final int VORKATH_DEATH = 7949; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/FightCaveConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/FightCaveConfig.java index f1e5457f7a..72c21243c5 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/FightCaveConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/FightCaveConfig.java @@ -24,20 +24,119 @@ */ package net.runelite.client.plugins.fightcave; +import java.awt.Font; +import lombok.AllArgsConstructor; +import lombok.Getter; import net.runelite.client.config.Config; import net.runelite.client.config.ConfigGroup; import net.runelite.client.config.ConfigItem; +import net.runelite.client.config.Range; +import net.runelite.client.config.Stub; @ConfigGroup("fightcave") public interface FightCaveConfig extends Config { @ConfigItem( + position = 0, + keyName = "mainConfig", + name = "Main Config", + description = "" + ) + default Stub mainConfig() + { + return new Stub(); + } + + @ConfigItem( + position = 1, keyName = "waveDisplay", name = "Wave display", - description = "Shows monsters that will spawn on the selected wave(s)." + description = "Shows monsters that will spawn on the selected wave(s).", + parent = "mainConfig" ) default WaveDisplayMode waveDisplay() { return WaveDisplayMode.BOTH; } + + @ConfigItem( + position = 2, + keyName = "tickTimersWidget", + name = "Tick Timers in Prayer", + description = "Adds an overlay to the Praayer Interface with the ticks until next attack for that prayer.", + parent = "mainConfig" + ) + default boolean tickTimersWidget() + { + return true; + } + + @ConfigItem( + position = 3, + keyName = "text", + name = "Text", + description = "" + ) + default Stub text() + { + return new Stub(); + } + + @ConfigItem( + position = 4, + keyName = "fontStyle", + name = "Font Style", + description = "Plain | Bold | Italics", + parent = "text" + ) + default FontStyle fontStyle() + { + return FontStyle.BOLD; + } + + @Range( + min = 14, + max = 40 + ) + @ConfigItem( + position = 5, + keyName = "textSize", + name = "Text Size", + description = "Text Size for Timers.", + parent = "text" + ) + default int textSize() + { + return 32; + } + + @ConfigItem( + position = 6, + keyName = "shadows", + name = "Shadows", + description = "Adds Shadows to text.", + parent = "text" + ) + default boolean shadows() + { + return false; + } + + @Getter + @AllArgsConstructor + enum FontStyle + { + BOLD("Bold", Font.BOLD), + ITALIC("Italic", Font.ITALIC), + PLAIN("Plain", Font.PLAIN); + + private String name; + private int font; + + @Override + public String toString() + { + return getName(); + } + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/FightCaveContainer.java b/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/FightCaveContainer.java new file mode 100644 index 0000000000..cc0f1a523c --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/FightCaveContainer.java @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2019, Ganom + * Copyright (c) 2019, Lucas + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.fightcave; + +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import java.awt.Color; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import lombok.Setter; +import net.runelite.api.Actor; +import net.runelite.api.AnimationID; +import net.runelite.api.NPC; +import net.runelite.api.NPCDefinition; +import net.runelite.api.NpcID; +import net.runelite.api.Prayer; + +@Getter +class FightCaveContainer +{ + private NPC npc; + private String npcName; + private int npcIndex; + private int npcSize; + private int attackSpeed; + private int priority; + private ImmutableSet animations; + @Setter + private int ticksUntilAttack; + @Setter + private Actor npcInteracting; + @Setter + private AttackStyle attackStyle; + + FightCaveContainer(NPC npc, int attackSpeed) + { + this.npc = npc; + this.npcName = npc.getName(); + this.npcIndex = npc.getIndex(); + this.npcInteracting = npc.getInteracting(); + this.attackStyle = AttackStyle.UNKNOWN; + this.attackSpeed = attackSpeed; + this.ticksUntilAttack = -1; + final NPCDefinition composition = npc.getTransformedDefinition(); + + BossMonsters monster = BossMonsters.of(npc.getId()); + + if (monster == null) + { + throw new IllegalStateException(); + } + + this.animations = monster.animations; + this.attackStyle = monster.attackStyle; + this.priority = monster.priority; + + if (composition != null) + { + this.npcSize = composition.getSize(); + } + } + + @RequiredArgsConstructor + enum BossMonsters + { + TOK_XIL1(NpcID.TOKXIL_3121, AttackStyle.RANGE, ImmutableSet.of(AnimationID.TOK_XIL_RANGE_ATTACK, AnimationID.TOK_XIL_MELEE_ATTACK), 1), + TOK_XIL2(NpcID.TOKXIL_3122, AttackStyle.RANGE, ImmutableSet.of(AnimationID.TOK_XIL_RANGE_ATTACK, AnimationID.TOK_XIL_MELEE_ATTACK), 1), + KETZEK1(NpcID.KETZEK, AttackStyle.MAGE, ImmutableSet.of(AnimationID.KET_ZEK_MAGE_ATTACK, AnimationID.KET_ZEK_MELEE_ATTACK), 0), + KETZEK2(NpcID.KETZEK_3126, AttackStyle.MAGE, ImmutableSet.of(AnimationID.KET_ZEK_MAGE_ATTACK, AnimationID.KET_ZEK_MELEE_ATTACK), 0), + YTMEJKOT1(NpcID.YTMEJKOT, AttackStyle.MELEE, ImmutableSet.of(AnimationID.MEJ_KOT_HEAL_ATTACK, AnimationID.MEJ_KOT_MELEE_ATTACK), 2), + YTMEJKOT2(NpcID.YTMEJKOT_3124, AttackStyle.MELEE, ImmutableSet.of(AnimationID.MEJ_KOT_HEAL_ATTACK, AnimationID.MEJ_KOT_MELEE_ATTACK), 2), + TZTOKJAD1(NpcID.TZTOKJAD, AttackStyle.UNKNOWN, ImmutableSet.of(AnimationID.TZTOK_JAD_MAGIC_ATTACK, AnimationID.TZTOK_JAD_RANGE_ATTACK, AnimationID.TZTOK_JAD_MELEE_ATTACK), 0), + TZTOKJAD2(NpcID.TZTOKJAD_6506, AttackStyle.UNKNOWN, ImmutableSet.of(AnimationID.TZTOK_JAD_MAGIC_ATTACK, AnimationID.TZTOK_JAD_RANGE_ATTACK, AnimationID.TZTOK_JAD_MELEE_ATTACK), 0); + + private static ImmutableMap idMap; + + static + { + ImmutableMap.Builder builder = ImmutableMap.builder(); + + for (BossMonsters monster : values()) + { + builder.put(monster.npcID, monster); + } + + idMap = builder.build(); + } + + private final int npcID; + private final AttackStyle attackStyle; + private final ImmutableSet animations; + private final int priority; + + static BossMonsters of(int npcID) + { + return idMap.get(npcID); + } + } + + @Getter(AccessLevel.PACKAGE) + @AllArgsConstructor + enum AttackStyle + { + MAGE("Mage", Color.CYAN, Prayer.PROTECT_FROM_MAGIC), + RANGE("Range", Color.GREEN, Prayer.PROTECT_FROM_MISSILES), + MELEE("Melee", Color.RED, Prayer.PROTECT_FROM_MELEE), + UNKNOWN("Unknown", Color.WHITE, null); + + private String name; + private Color color; + private Prayer prayer; + } +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/FightCaveOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/FightCaveOverlay.java new file mode 100644 index 0000000000..68569157d5 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/FightCaveOverlay.java @@ -0,0 +1,201 @@ +/* + * Copyright (c) 2019, Ganom + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.runelite.client.plugins.fightcave; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.Graphics2D; +import java.awt.Rectangle; +import java.awt.image.BufferedImage; +import javax.inject.Inject; +import net.runelite.api.Client; +import net.runelite.api.Point; +import net.runelite.api.Prayer; +import net.runelite.api.SpriteID; +import net.runelite.client.game.SpriteManager; +import net.runelite.client.ui.overlay.Overlay; +import net.runelite.client.ui.overlay.OverlayLayer; +import net.runelite.client.ui.overlay.OverlayPosition; +import net.runelite.client.ui.overlay.OverlayPriority; +import net.runelite.client.ui.overlay.OverlayUtil; +import net.runelite.client.util.ImageUtil; + +public class FightCaveOverlay extends Overlay +{ + private FightCavePlugin plugin; + private FightCaveConfig config; + private Client client; + private SpriteManager spriteManager; + + @Inject + FightCaveOverlay(Client client, FightCavePlugin plugin, FightCaveConfig config, SpriteManager spriteManager) + { + this.client = client; + this.plugin = plugin; + this.config = config; + this.spriteManager = spriteManager; + setPosition(OverlayPosition.DYNAMIC); + setPriority(OverlayPriority.HIGHEST); + setLayer(OverlayLayer.ALWAYS_ON_TOP); + } + + @Override + public Dimension render(Graphics2D graphics) + { + for (FightCaveContainer npc : plugin.getFightCaveContainer()) + { + if (npc.getNpc() == null) + { + continue; + } + + final int ticksLeft = npc.getTicksUntilAttack(); + final FightCaveContainer.AttackStyle attackStyle = npc.getAttackStyle(); + + if (ticksLeft <= 0) + { + continue; + } + + final String ticksLeftStr = String.valueOf(ticksLeft); + final int font = config.fontStyle().getFont(); + final boolean shadows = config.shadows(); + Color color = (ticksLeft <= 1 ? Color.WHITE : attackStyle.getColor()); + final Point canvasPoint = npc.getNpc().getCanvasTextLocation(graphics, Integer.toString(ticksLeft), 0); + + if (npc.getNpcName().equals("TzTok-Jad")) + { + color = (ticksLeft <= 1 || ticksLeft == 8 ? attackStyle.getColor() : Color.WHITE); + + BufferedImage pray = getPrayerImage(npc.getAttackStyle()); + + if (pray == null) + { + continue; + } + + renderImageLocation(graphics, npc.getNpc().getCanvasImageLocation(ImageUtil.resizeImage(pray, 36, 36), 0), pray, 12, 30); + } + + OverlayUtil.renderTextLocation(graphics, ticksLeftStr, config.textSize(), font, color, canvasPoint, shadows, 0); + } + + if (config.tickTimersWidget()) + { + + if (!plugin.getMageTicks().isEmpty()) + { + widgetHandler(graphics, + Prayer.PROTECT_FROM_MAGIC, + plugin.getMageTicks().get(0) == 1 ? Color.WHITE : Color.CYAN, + Integer.toString(plugin.getMageTicks().get(0)), + config.shadows() + ); + } + if (!plugin.getRangedTicks().isEmpty()) + { + widgetHandler(graphics, + Prayer.PROTECT_FROM_MISSILES, + plugin.getRangedTicks().get(0) == 1 ? Color.WHITE : Color.GREEN, + Integer.toString(plugin.getRangedTicks().get(0)), + config.shadows() + ); + } + if (!plugin.getMeleeTicks().isEmpty()) + { + widgetHandler(graphics, + Prayer.PROTECT_FROM_MELEE, + plugin.getMeleeTicks().get(0) == 1 ? Color.WHITE : Color.RED, + Integer.toString(plugin.getMeleeTicks().get(0)), + config.shadows() + ); + } + } + return null; + } + + private void widgetHandler(Graphics2D graphics, Prayer prayer, Color color, String ticks, boolean shadows) + { + if (prayer != null) + { + Rectangle bounds = OverlayUtil.renderPrayerOverlay(graphics, client, prayer, color); + + if (bounds != null) + { + renderTextLocation(graphics, ticks, 16, config.fontStyle().getFont(), color, centerPoint(bounds), shadows); + } + } + } + + private BufferedImage getPrayerImage(FightCaveContainer.AttackStyle attackStyle) + { + switch (attackStyle) + { + case MAGE: + return spriteManager.getSprite(SpriteID.PRAYER_PROTECT_FROM_MAGIC, 0); + case MELEE: + return spriteManager.getSprite(SpriteID.PRAYER_PROTECT_FROM_MELEE, 0); + case RANGE: + return spriteManager.getSprite(SpriteID.PRAYER_PROTECT_FROM_MISSILES, 0); + } + return null; + } + + private void renderImageLocation(Graphics2D graphics, Point imgLoc, BufferedImage image, int xOffset, int yOffset) + { + int x = imgLoc.getX() + xOffset; + int y = imgLoc.getY() - yOffset; + + graphics.drawImage(image, x, y, null); + } + + private void renderTextLocation(Graphics2D graphics, String txtString, int fontSize, int fontStyle, Color fontColor, Point canvasPoint, boolean shadows) + { + graphics.setFont(new Font("Arial", fontStyle, fontSize)); + if (canvasPoint != null) + { + final Point canvasCenterPoint = new Point( + canvasPoint.getX() - 3, + canvasPoint.getY() + 6); + final Point canvasCenterPoint_shadow = new Point( + canvasPoint.getX() - 2, + canvasPoint.getY() + 7); + if (shadows) + { + OverlayUtil.renderTextLocation(graphics, canvasCenterPoint_shadow, txtString, Color.BLACK); + } + OverlayUtil.renderTextLocation(graphics, canvasCenterPoint, txtString, fontColor); + } + } + + private Point centerPoint(Rectangle rect) + { + int x = (int) (rect.getX() + rect.getWidth() / 2); + int y = (int) (rect.getY() + rect.getHeight() / 2); + return new Point(x, y); + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/FightCavePlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/FightCavePlugin.java index 7b8281becf..c694aae2f2 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/FightCavePlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/FightCavePlugin.java @@ -27,22 +27,23 @@ package net.runelite.client.plugins.fightcave; import com.google.inject.Provides; import java.util.ArrayList; +import java.util.Collections; import java.util.EnumMap; -import java.util.HashMap; +import java.util.HashSet; import java.util.List; -import java.util.Map; +import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; -import javax.annotation.Nullable; import javax.inject.Inject; import lombok.AccessLevel; import lombok.Getter; +import lombok.extern.slf4j.Slf4j; +import net.runelite.api.AnimationID; import net.runelite.api.ChatMessageType; import net.runelite.api.Client; import net.runelite.api.GameState; import net.runelite.api.NPC; import net.runelite.api.NpcID; -import net.runelite.api.events.AnimationChanged; import net.runelite.api.events.ChatMessage; import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameTick; @@ -50,6 +51,7 @@ import net.runelite.api.events.NpcDespawned; import net.runelite.api.events.NpcSpawned; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; +import net.runelite.client.game.NPCManager; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginType; @@ -64,59 +66,16 @@ import org.apache.commons.lang3.ArrayUtils; enabledByDefault = false ) +@Slf4j public class FightCavePlugin extends Plugin { + static final int MAX_WAVE = 63; + @Getter(AccessLevel.PACKAGE) + static final List> WAVES = new ArrayList<>(); private static final Pattern WAVE_PATTERN = Pattern.compile(".*Wave: (\\d+).*"); private static final int FIGHT_CAVE_REGION = 9551; private static final int MAX_MONSTERS_OF_TYPE_PER_WAVE = 2; - static final int MAX_WAVE = 63; - - @Getter - static final List> WAVES = new ArrayList<>(); - - @Getter - private int currentWave = -1; - - @Inject - private Client client; - - @Inject - private OverlayManager overlayManager; - - @Inject - private WaveOverlay waveOverlay; - - @Inject - private JadOverlay jadOverlay; - - @Inject - private TimersOverlay timersOverlay; - - @Inject - private ConfigManager externalConfig; - - @Getter(AccessLevel.PACKAGE) - private Map Rangers = new HashMap<>(); - - @Getter(AccessLevel.PACKAGE) - private Map Magers = new HashMap<>(); - - @Getter(AccessLevel.PACKAGE) - private Map Meleers = new HashMap<>(); - - @Getter(AccessLevel.PACKAGE) - private Map Drainers = new HashMap<>(); - - @Getter(AccessLevel.PACKAGE) - private Map Ignore = new HashMap<>(); - - @Getter(AccessLevel.PACKAGE) - @Nullable - private JadAttack attack; - - private NPC jad; - static { final WaveMonster[] waveMonsters = WaveMonster.values(); @@ -157,6 +116,36 @@ public class FightCavePlugin extends Plugin } } + @Inject + private Client client; + @Inject + private NPCManager npcManager; + @Inject + private OverlayManager overlayManager; + @Inject + private WaveOverlay waveOverlay; + @Inject + private FightCaveOverlay fightCaveOverlay; + @Inject + private FightCaveConfig config; + @Getter(AccessLevel.PACKAGE) + private Set fightCaveContainer = new HashSet<>(); + @Getter(AccessLevel.PACKAGE) + private int currentWave = -1; + @Getter(AccessLevel.PACKAGE) + private boolean validRegion; + @Getter(AccessLevel.PACKAGE) + private List mageTicks = new ArrayList<>(); + @Getter(AccessLevel.PACKAGE) + private List rangedTicks = new ArrayList<>(); + @Getter(AccessLevel.PACKAGE) + private List meleeTicks = new ArrayList<>(); + + static String formatMonsterQuantity(final WaveMonster monster, final int quantity) + { + return String.format("%dx %s", quantity, monster); + } + @Provides FightCaveConfig provideConfig(ConfigManager configManager) { @@ -166,21 +155,41 @@ public class FightCavePlugin extends Plugin @Override public void startUp() { - overlayManager.add(waveOverlay); - overlayManager.add(jadOverlay); - overlayManager.add(timersOverlay); + if (client.getGameState() == GameState.LOGGED_IN) + { + if (regionCheck()) + { + validRegion = true; + overlayManager.add(waveOverlay); + overlayManager.add(fightCaveOverlay); + } + } } @Override public void shutDown() { overlayManager.remove(waveOverlay); + overlayManager.remove(fightCaveOverlay); currentWave = -1; - overlayManager.remove(timersOverlay); - overlayManager.remove(jadOverlay); - jad = null; - attack = null; + } + @Subscribe + public void onChatMessage(ChatMessage event) + { + if (!validRegion) + { + return; + } + + final Matcher waveMatcher = WAVE_PATTERN.matcher(event.getMessage()); + + if (event.getType() != ChatMessageType.GAMEMESSAGE || !waveMatcher.matches()) + { + return; + } + + currentWave = Integer.parseInt(waveMatcher.group(1)); } @Subscribe @@ -191,98 +200,43 @@ public class FightCavePlugin extends Plugin return; } - if (!inFightCave()) + if (regionCheck()) { - currentWave = -1; + validRegion = true; + overlayManager.add(waveOverlay); + overlayManager.add(fightCaveOverlay); } + else + { + validRegion = false; + overlayManager.remove(fightCaveOverlay); + overlayManager.remove(fightCaveOverlay); + } + + fightCaveContainer.clear(); } - @Subscribe - public void onGameTick(GameTick Event) - { - for (NPCContainer ranger : getRangers().values()) - { - ranger.setTicksUntilAttack(ranger.getTicksUntilAttack() - 1); - if (ranger.getNpc().getAnimation() == 2633) - { - if (ranger.getTicksUntilAttack() < 1) - { - ranger.setTicksUntilAttack(4); - } - } - } - - for (NPCContainer meleer : getMeleers().values()) - { - meleer.setTicksUntilAttack(meleer.getTicksUntilAttack() - 1); - if (meleer.getNpc().getAnimation() == 2637 || meleer.getNpc().getAnimation() == 2639) - { - if (meleer.getTicksUntilAttack() < 1) - { - meleer.setTicksUntilAttack(4); - } - } - } - - for (NPCContainer mager : getMagers().values()) - { - mager.setTicksUntilAttack(mager.getTicksUntilAttack() - 1); - if (mager.getNpc().getAnimation() == 2647) - { - if (mager.getTicksUntilAttack() < 1) - { - mager.setTicksUntilAttack(4); - } - } - } - } - - @Subscribe - public void onChatMessage(ChatMessage event) - { - final Matcher waveMatcher = WAVE_PATTERN.matcher(event.getMessage()); - - if (event.getType() != ChatMessageType.GAMEMESSAGE - || !inFightCave() - || !waveMatcher.matches()) - { - return; - } - - currentWave = Integer.parseInt(waveMatcher.group(1)); - } - - @Subscribe public void onNpcSpawned(NpcSpawned event) { + if (!validRegion) + { + return; + } + NPC npc = event.getNpc(); + switch (npc.getId()) { - case NpcID.TZKIH_3116: - case NpcID.TZKIH_3117: - Drainers.put(npc, new NPCContainer(npc)); - break; - case NpcID.TZKEK_3118: - case NpcID.TZKEK_3119: - case NpcID.TZKEK_3120: - Ignore.put(npc, new NPCContainer(npc)); - break; case NpcID.TOKXIL_3121: case NpcID.TOKXIL_3122: - Rangers.put(npc, new NPCContainer(npc)); - break; case NpcID.YTMEJKOT: case NpcID.YTMEJKOT_3124: - Meleers.put(npc, new NPCContainer(npc)); - break; case NpcID.KETZEK: case NpcID.KETZEK_3126: - Magers.put(npc, new NPCContainer(npc)); - break; case NpcID.TZTOKJAD: case NpcID.TZTOKJAD_6506: - jad = npc; + fightCaveContainer.add(new FightCaveContainer(npc, npcManager.getAttackSpeed(npc.getId()))); break; } } @@ -290,55 +244,106 @@ public class FightCavePlugin extends Plugin @Subscribe public void onNpcDespawned(NpcDespawned event) { - if (Rangers.remove(event.getNpc()) != null && Rangers.isEmpty()) - { - Rangers.clear(); - } - if (Meleers.remove(event.getNpc()) != null && Meleers.isEmpty()) - { - Meleers.clear(); - } - if (Magers.remove(event.getNpc()) != null && Magers.isEmpty()) - { - Magers.clear(); - } - if (Drainers.remove(event.getNpc()) != null && Drainers.isEmpty()) - { - Drainers.clear(); - } - if (Ignore.remove(event.getNpc()) != null && Ignore.isEmpty()) - { - Ignore.clear(); - } - - } - - @Subscribe - public void onAnimationChanged(AnimationChanged event) - { - if (event.getActor() != jad) + if (!validRegion) { return; } - if (jad.getAnimation() == JadAttack.MAGIC.getAnimation()) - { - attack = JadAttack.MAGIC; - } + NPC npc = event.getNpc(); - else if (jad.getAnimation() == JadAttack.RANGE.getAnimation()) + switch (npc.getId()) { - attack = JadAttack.RANGE; + case NpcID.TOKXIL_3121: + case NpcID.TOKXIL_3122: + case NpcID.YTMEJKOT: + case NpcID.YTMEJKOT_3124: + case NpcID.KETZEK: + case NpcID.KETZEK_3126: + case NpcID.TZTOKJAD: + case NpcID.TZTOKJAD_6506: + fightCaveContainer.removeIf(c -> c.getNpc() == npc); + break; } } - boolean inFightCave() + @Subscribe + public void onGameTick(GameTick Event) + { + if (!validRegion) + { + return; + } + + mageTicks.clear(); + rangedTicks.clear(); + meleeTicks.clear(); + + for (FightCaveContainer npc : fightCaveContainer) + { + if (npc.getTicksUntilAttack() >= 0) + { + npc.setTicksUntilAttack(npc.getTicksUntilAttack() - 1); + } + + for (int anims : npc.getAnimations()) + { + if (anims == npc.getNpc().getAnimation()) + { + if (npc.getTicksUntilAttack() < 1) + { + npc.setTicksUntilAttack(npc.getAttackSpeed()); + } + + switch (anims) + { + case AnimationID.TZTOK_JAD_RANGE_ATTACK: + npc.setAttackStyle(FightCaveContainer.AttackStyle.RANGE); + break; + case AnimationID.TZTOK_JAD_MAGIC_ATTACK: + npc.setAttackStyle(FightCaveContainer.AttackStyle.MAGE); + break; + case AnimationID.TZTOK_JAD_MELEE_ATTACK: + npc.setAttackStyle(FightCaveContainer.AttackStyle.MELEE); + break; + } + } + } + + if (npc.getNpcName().equals("TzTok-Jad")) + { + continue; + } + + switch (npc.getAttackStyle()) + { + case RANGE: + if (npc.getTicksUntilAttack() > 0) + { + rangedTicks.add(npc.getTicksUntilAttack()); + } + break; + case MELEE: + if (npc.getTicksUntilAttack() > 0) + { + meleeTicks.add(npc.getTicksUntilAttack()); + } + break; + case MAGE: + if (npc.getTicksUntilAttack() > 0) + { + mageTicks.add(npc.getTicksUntilAttack()); + } + break; + } + } + + Collections.sort(mageTicks); + Collections.sort(rangedTicks); + Collections.sort(meleeTicks); + } + + private boolean regionCheck() { return ArrayUtils.contains(client.getMapRegions(), FIGHT_CAVE_REGION); } - - static String formatMonsterQuantity(final WaveMonster monster, final int quantity) - { - return String.format("%dx %s", quantity, monster); - } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/JadAttack.java b/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/JadAttack.java deleted file mode 100644 index ae752e015a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/JadAttack.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2017, Devin French - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.fightcave; - -import net.runelite.api.AnimationID; -import net.runelite.api.Prayer; - -public enum JadAttack -{ - MAGIC(AnimationID.TZTOK_JAD_MAGIC_ATTACK, Prayer.PROTECT_FROM_MAGIC), - RANGE(AnimationID.TZTOK_JAD_RANGE_ATTACK, Prayer.PROTECT_FROM_MISSILES); - - private final int animation; - private final Prayer prayer; - - JadAttack(int animation, Prayer prayer) - { - this.animation = animation; - this.prayer = prayer; - } - - public int getAnimation() - { - return animation; - } - - public Prayer getPrayer() - { - return prayer; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/JadOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/JadOverlay.java deleted file mode 100644 index 25ca70820d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/JadOverlay.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2017, Devin French - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.fightcave; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; -import javax.inject.Inject; -import net.runelite.api.Client; -import net.runelite.api.SpriteID; -import net.runelite.client.game.SpriteManager; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayPosition; -import net.runelite.client.ui.overlay.OverlayPriority; -import net.runelite.client.ui.overlay.components.ComponentConstants; -import net.runelite.client.ui.overlay.components.ImageComponent; -import net.runelite.client.ui.overlay.components.PanelComponent; - -public class JadOverlay extends Overlay -{ - private static final Color NOT_ACTIVATED_BACKGROUND_COLOR = new Color(150, 0, 0, 150); - - private final Client client; - private final FightCavePlugin plugin; - private final SpriteManager spriteManager; - private final PanelComponent imagePanelComponent = new PanelComponent(); - - @Inject - private JadOverlay(Client client, FightCavePlugin plugin, SpriteManager spriteManager) - { - setPosition(OverlayPosition.BOTTOM_RIGHT); - setPriority(OverlayPriority.HIGH); - this.client = client; - this.plugin = plugin; - this.spriteManager = spriteManager; - } - - @Override - public Dimension render(Graphics2D graphics) - { - final JadAttack attack = plugin.getAttack(); - - if (attack == null) - { - return null; - } - - final BufferedImage prayerImage = getPrayerImage(attack); - - imagePanelComponent.getChildren().clear(); - imagePanelComponent.getChildren().add(new ImageComponent(prayerImage)); - imagePanelComponent.setBackgroundColor(client.isPrayerActive(attack.getPrayer()) - ? ComponentConstants.STANDARD_BACKGROUND_COLOR - : NOT_ACTIVATED_BACKGROUND_COLOR); - - return imagePanelComponent.render(graphics); - } - - private BufferedImage getPrayerImage(JadAttack attack) - { - final int prayerSpriteID = attack == JadAttack.MAGIC ? SpriteID.PRAYER_PROTECT_FROM_MAGIC : SpriteID.PRAYER_PROTECT_FROM_MISSILES; - return spriteManager.getSprite(prayerSpriteID, 0); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/NPCContainer.java b/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/NPCContainer.java deleted file mode 100644 index 9ad21108f4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/NPCContainer.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2018, Woox - * Copyright (c) 2019, Ganom - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.fightcave; - -import lombok.Getter; -import lombok.Setter; -import net.runelite.api.Actor; -import net.runelite.api.NPC; -import net.runelite.api.NPCDefinition; - -class NPCContainer -{ - - @Getter - private NPC npc; - - @Getter - private int npcIndex; - - @Getter - private String npcName; - - @Getter - private int npcSize; - - @Setter - @Getter - private int TicksUntilAttack; - - @Setter - @Getter - private int npcSpeed; - - @Setter - @Getter - private Actor npcInteracting; - - - NPCContainer(NPC npc) - { - this.npc = npc; - this.npcName = npc.getName(); - this.npcIndex = npc.getIndex(); - this.npcInteracting = npc.getInteracting(); - this.npcSpeed = 0; - this.TicksUntilAttack = 0; - final NPCDefinition composition = npc.getTransformedDefinition(); - - if (composition != null) - { - this.npcSize = composition.getSize(); - } - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/TimersOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/TimersOverlay.java deleted file mode 100644 index 88998a3841..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/TimersOverlay.java +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright (c) 2019, Ganom - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package net.runelite.client.plugins.fightcave; - -import java.awt.BasicStroke; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.Graphics2D; -import java.awt.Polygon; -import javax.inject.Inject; -import net.runelite.api.Client; -import net.runelite.api.NPC; -import net.runelite.api.NPCDefinition; -import net.runelite.api.Perspective; -import net.runelite.api.Point; -import net.runelite.api.coords.LocalPoint; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayLayer; -import net.runelite.client.ui.overlay.OverlayPosition; -import net.runelite.client.ui.overlay.OverlayPriority; -import net.runelite.client.ui.overlay.OverlayUtil; - -public class TimersOverlay extends Overlay -{ - private FightCavePlugin plugin; - private Client client; - - @Inject - TimersOverlay(FightCavePlugin plugin, Client client) - { - this.plugin = plugin; - this.client = client; - setPosition(OverlayPosition.DYNAMIC); - setPriority(OverlayPriority.HIGHEST); - setLayer(OverlayLayer.ALWAYS_ON_TOP); - } - - @Override - public Dimension render(Graphics2D graphics) - { - for (NPCContainer npc : plugin.getDrainers().values()) - { - renderNpcOverlay(graphics, npc.getNpc(), Color.RED, 255, 20); - String str = "drainer"; - Point canvasPoint = npc.getNpc().getCanvasTextLocation(graphics, str, 0); - renderTextLocation(graphics, str, 12, Color.WHITE, canvasPoint); - } - - for (NPCContainer npc : plugin.getIgnore().values()) - { - renderNpcOverlay(graphics, npc.getNpc(), Color.BLACK, 50, 5); - String str = "ignore"; - Point canvasPoint = npc.getNpc().getCanvasTextLocation(graphics, str, 0); - renderTextLocation(graphics, str, 10, Color.WHITE, canvasPoint); - } - - Color tickcolor; - - for (NPCContainer npc : plugin.getRangers().values()) - { - renderNpcOverlay(graphics, npc.getNpc(), Color.GREEN, 100, 10); - final int ticksLeft = npc.getTicksUntilAttack(); - if (ticksLeft > 0) - { - if (ticksLeft == 1) - { - tickcolor = Color.GREEN; - } - else - { - tickcolor = Color.WHITE; - } - final String ticksLeftStr = String.valueOf(ticksLeft); - Point canvasPoint = npc.getNpc().getCanvasTextLocation(graphics, ticksLeftStr, 0); - renderTextLocation(graphics, ticksLeftStr, 32, tickcolor, canvasPoint); - } - } - - for (NPCContainer npc : plugin.getMagers().values()) - { - renderNpcOverlay(graphics, npc.getNpc(), Color.CYAN, 100, 10); - final int ticksLeft = npc.getTicksUntilAttack(); - if (ticksLeft > 0) - { - if (ticksLeft == 1) - { - tickcolor = Color.CYAN; - } - else - { - - tickcolor = Color.WHITE; - } - final String ticksLeftStr = String.valueOf(ticksLeft); - Point canvasPoint = npc.getNpc().getCanvasTextLocation(graphics, ticksLeftStr, 0); - renderTextLocation(graphics, ticksLeftStr, 32, tickcolor, canvasPoint); - } - } - - for (NPCContainer npc : plugin.getMeleers().values()) - { - renderNpcOverlay(graphics, npc.getNpc(), Color.RED, 100, 10); - final int ticksLeft = npc.getTicksUntilAttack(); - if (ticksLeft > 0) - { - if (ticksLeft == 1) - { - tickcolor = Color.RED; - } - else - { - - tickcolor = Color.WHITE; - } - final String ticksLeftStr = String.valueOf(ticksLeft); - Point canvasPoint = npc.getNpc().getCanvasTextLocation(graphics, ticksLeftStr, 0); - renderTextLocation(graphics, ticksLeftStr, 32, tickcolor, canvasPoint); - } - } - - return null; - } - - private void renderNpcOverlay(Graphics2D graphics, NPC actor, Color color, int outlineAlpha, int fillAlpha) - { - int size = 1; - NPCDefinition composition = actor.getTransformedDefinition(); - if (composition != null) - { - size = composition.getSize(); - } - LocalPoint lp = actor.getLocalLocation(); - Polygon tilePoly = Perspective.getCanvasTileAreaPoly(client, lp, size); - - if (tilePoly != null) - { - graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), outlineAlpha)); - graphics.setStroke(new BasicStroke(2)); - graphics.draw(tilePoly); - graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), fillAlpha)); - graphics.fill(tilePoly); - } - } - - private void renderTextLocation(Graphics2D graphics, String txtString, int fontSize, Color fontColor, Point canvasPoint) - { - graphics.setFont(new Font("Arial", Font.BOLD, fontSize)); - if (canvasPoint != null) - { - final Point canvasCenterPoint = new Point( - canvasPoint.getX(), - canvasPoint.getY()); - final Point canvasCenterPoint_shadow = new Point( - canvasPoint.getX() + 1, - canvasPoint.getY() + 1); - OverlayUtil.renderTextLocation(graphics, canvasCenterPoint_shadow, txtString, Color.BLACK); - OverlayUtil.renderTextLocation(graphics, canvasCenterPoint, txtString, fontColor); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/WaveMonster.java b/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/WaveMonster.java index 9919623124..399cd1947b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/WaveMonster.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/WaveMonster.java @@ -29,12 +29,12 @@ import lombok.AllArgsConstructor; @AllArgsConstructor enum WaveMonster { - TZ_KIH("Tz-Kih", 22), - TZ_KEK("Tz-Kek", 45), - TOK_XIL("Tok-Xil", 90), - YT_MEJKOT("Yt-MejKot", 180), - KET_ZEK("Ket-Zek", 360), - TZKOK_JAD("TzTok-Jad", 702); + TZ_KIH("Drainer", 22), + TZ_KEK("Blob", 45), + TOK_XIL("Range", 90), + YT_MEJKOT("Melee", 180), + KET_ZEK("Mage", 360), + TZKOK_JAD("Jad", 702); private final String name; private final int level; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/WaveOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/WaveOverlay.java index 2b5fdf370b..f1d81816f6 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/WaveOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/WaveOverlay.java @@ -37,8 +37,8 @@ import net.runelite.client.ui.overlay.Overlay; import net.runelite.client.ui.overlay.OverlayPosition; import net.runelite.client.ui.overlay.components.PanelComponent; import net.runelite.client.ui.overlay.components.TitleComponent; -import net.runelite.client.ui.overlay.components.table.TableComponent; import net.runelite.client.ui.overlay.components.table.TableAlignment; +import net.runelite.client.ui.overlay.components.table.TableComponent; class WaveOverlay extends Overlay { @@ -46,22 +46,38 @@ class WaveOverlay extends Overlay private final FightCaveConfig config; private final FightCavePlugin plugin; - private final PanelComponent panelComponent = new PanelComponent(); @Inject private WaveOverlay(FightCaveConfig config, FightCavePlugin plugin) { - setPosition(OverlayPosition.TOP_RIGHT); this.config = config; this.plugin = plugin; + setPosition(OverlayPosition.TOP_RIGHT); + } + + private static Collection buildWaveLines(final Map wave) + { + final List> monsters = new ArrayList<>(wave.entrySet()); + monsters.sort(Map.Entry.comparingByKey()); + final List outputLines = new ArrayList<>(); + + for (Map.Entry monsterEntry : monsters) + { + final WaveMonster monster = monsterEntry.getKey(); + final int quantity = monsterEntry.getValue(); + final String line = FightCavePlugin.formatMonsterQuantity(monster, quantity); + + outputLines.add(line); + } + + return outputLines; } @Override public Dimension render(Graphics2D graphics) { - if (!plugin.inFightCave() - || plugin.getCurrentWave() < 0) + if (!plugin.isValidRegion() || plugin.getCurrentWave() < 0) { return null; } @@ -108,26 +124,8 @@ class WaveOverlay extends Overlay } if (!tableComponent.isEmpty()) - { - panelComponent.getChildren().add(tableComponent); - } - } - - private static Collection buildWaveLines(final Map wave) - { - final List> monsters = new ArrayList<>(wave.entrySet()); - monsters.sort(Map.Entry.comparingByKey()); - final List outputLines = new ArrayList<>(); - - for (Map.Entry monsterEntry : monsters) { - final WaveMonster monster = monsterEntry.getKey(); - final int quantity = monsterEntry.getValue(); - final String line = FightCavePlugin.formatMonsterQuantity(monster, quantity); - - outputLines.add(line); + panelComponent.getChildren().add(tableComponent); } - - return outputLines; } } From c2f405cf8fe3ad0f226316e7b9616b5ead0e5dd3 Mon Sep 17 00:00:00 2001 From: Kyleeld <48519776+Kyleeld@users.noreply.github.com> Date: Fri, 28 Jun 2019 23:58:38 +0100 Subject: [PATCH 31/58] Revert "Upstreamyboy" --- .../java/net/runelite/cache/AreaDumper.java | 2 +- .../net/runelite/cache/EnumDumperTest.java | 2 +- .../java/net/runelite/cache/FrameDumper.java | 2 +- .../net/runelite/cache/FramemapDumper.java | 2 +- .../net/runelite/cache/InventoryDumper.java | 2 +- .../net/runelite/cache/KitDumperTest.java | 2 +- .../net/runelite/cache/OverlayDumper.java | 2 +- .../net/runelite/cache/SequenceDumper.java | 2 +- .../cache/SoundEffectsDumperTest.java | 2 +- .../net/runelite/cache/StructManagerTest.java | 2 +- .../net/runelite/cache/TextureDumper.java | 2 +- .../net/runelite/cache/UnderlayDumper.java | 2 +- .../java/net/runelite/cache/VarbitDumper.java | 2 +- .../runelite/cache/WorldMapDumperTest.java | 2 +- .../runelite/http/api/chat/ChatClient.java | 168 ++++++------------ .../net/runelite/http/api/chat/Duels.java | 36 ---- .../http/service/chat/ChatController.java | 2 +- .../http/service/chat/ChatService.java | 2 +- .../main/java/net/runelite/api/Client.java | 4 - .../client/config/ChatColorConfig.java | 2 +- .../chatcommands/ChatCommandsConfig.java | 11 -- .../chatcommands/ChatCommandsPlugin.java | 139 +-------------- .../plugins/devtools/DevToolsButton.java | 1 - .../InterfaceStylesConfig.java | 10 -- .../InterfaceStylesPlugin.java | 78 -------- .../plugins/interfacestyles/WidgetOffset.java | 24 +-- .../loottracker/LootTrackerPlugin.java | 7 +- .../plugins/worldmap/RareTreeLocation.java | 13 +- .../plugins/interfacestyles/2005/900.png | Bin 8357 -> 924 bytes .../interfacestyles/rs3/cross_sprites/0.png | Bin 15717 -> 0 bytes .../interfacestyles/rs3/cross_sprites/1.png | Bin 15729 -> 0 bytes .../interfacestyles/rs3/cross_sprites/2.png | Bin 15819 -> 0 bytes .../interfacestyles/rs3/cross_sprites/3.png | Bin 15896 -> 0 bytes .../interfacestyles/rs3/cross_sprites/4.png | Bin 15689 -> 0 bytes .../interfacestyles/rs3/cross_sprites/5.png | Bin 15691 -> 0 bytes .../interfacestyles/rs3/cross_sprites/6.png | Bin 15701 -> 0 bytes .../interfacestyles/rs3/cross_sprites/7.png | Bin 15684 -> 0 bytes .../chatcommands/ChatCommandsPluginTest.java | 37 +--- .../java/net/runelite/rs/api/RSClient.java | 4 - 39 files changed, 96 insertions(+), 470 deletions(-) delete mode 100644 http-api/src/main/java/net/runelite/http/api/chat/Duels.java delete mode 100644 runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/0.png delete mode 100644 runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/1.png delete mode 100644 runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/2.png delete mode 100644 runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/3.png delete mode 100644 runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/4.png delete mode 100644 runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/5.png delete mode 100644 runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/6.png delete mode 100644 runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/7.png diff --git a/cache/src/test/java/net/runelite/cache/AreaDumper.java b/cache/src/test/java/net/runelite/cache/AreaDumper.java index 2aab1db48b..b789d78a0d 100644 --- a/cache/src/test/java/net/runelite/cache/AreaDumper.java +++ b/cache/src/test/java/net/runelite/cache/AreaDumper.java @@ -64,7 +64,7 @@ public class AreaDumper for (AreaDefinition area : areaManager.getAreas()) { - Files.asCharSink(new File(outDir, area.id + ".json"), Charset.defaultCharset()).write(gson.toJson(area)); + Files.write(gson.toJson(area), new File(outDir, area.id + ".json"), Charset.defaultCharset()); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/EnumDumperTest.java b/cache/src/test/java/net/runelite/cache/EnumDumperTest.java index 705356b0b5..a094b9fc24 100644 --- a/cache/src/test/java/net/runelite/cache/EnumDumperTest.java +++ b/cache/src/test/java/net/runelite/cache/EnumDumperTest.java @@ -80,7 +80,7 @@ public class EnumDumperTest if (def != null) { - Files.asCharSink(new File(dumpDir, file.getFileId() + ".json"), Charset.defaultCharset()).write(gson.toJson(def)); + Files.write(gson.toJson(def), new File(dumpDir, file.getFileId() + ".json"), Charset.defaultCharset()); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/FrameDumper.java b/cache/src/test/java/net/runelite/cache/FrameDumper.java index 8e856cd2f8..2bd7e2ca17 100644 --- a/cache/src/test/java/net/runelite/cache/FrameDumper.java +++ b/cache/src/test/java/net/runelite/cache/FrameDumper.java @@ -101,7 +101,7 @@ public class FrameDumper frames.add(frame); } - Files.asCharSink(new File(outDir, archive.getArchiveId() + ".json"), Charset.defaultCharset()).write(gson.toJson(frames)); + Files.write(gson.toJson(frames), new File(outDir, archive.getArchiveId() + ".json"), Charset.defaultCharset()); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/FramemapDumper.java b/cache/src/test/java/net/runelite/cache/FramemapDumper.java index f95e92c9fa..4513bf3dfb 100644 --- a/cache/src/test/java/net/runelite/cache/FramemapDumper.java +++ b/cache/src/test/java/net/runelite/cache/FramemapDumper.java @@ -74,7 +74,7 @@ public class FramemapDumper FramemapLoader loader = new FramemapLoader(); FramemapDefinition framemap = loader.load(0, contents); - Files.asCharSink(new File(outDir, archive.getArchiveId() + ".json"), Charset.defaultCharset()).write(gson.toJson(framemap)); + Files.write(gson.toJson(framemap), new File(outDir, archive.getArchiveId() + ".json"), Charset.defaultCharset()); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/InventoryDumper.java b/cache/src/test/java/net/runelite/cache/InventoryDumper.java index f74c4ce188..4caf464141 100644 --- a/cache/src/test/java/net/runelite/cache/InventoryDumper.java +++ b/cache/src/test/java/net/runelite/cache/InventoryDumper.java @@ -77,7 +77,7 @@ public class InventoryDumper InventoryLoader loader = new InventoryLoader(); InventoryDefinition inv = loader.load(file.getFileId(), file.getContents()); - Files.asCharSink(new File(outDir, inv.id + ".json"), Charset.defaultCharset()).write(gson.toJson(inv)); + Files.write(gson.toJson(inv), new File(outDir, inv.id + ".json"), Charset.defaultCharset()); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/KitDumperTest.java b/cache/src/test/java/net/runelite/cache/KitDumperTest.java index 4db1267506..286ca6ea8e 100644 --- a/cache/src/test/java/net/runelite/cache/KitDumperTest.java +++ b/cache/src/test/java/net/runelite/cache/KitDumperTest.java @@ -78,7 +78,7 @@ public class KitDumperTest KitDefinition def = loader.load(file.getFileId(), b); - Files.asCharSink(new File(dumpDir, file.getFileId() + ".json"), Charset.defaultCharset()).write(gson.toJson(def)); + Files.write(gson.toJson(def), new File(dumpDir, file.getFileId() + ".json"), Charset.defaultCharset()); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/OverlayDumper.java b/cache/src/test/java/net/runelite/cache/OverlayDumper.java index 51457192b7..4ac4b53a7c 100644 --- a/cache/src/test/java/net/runelite/cache/OverlayDumper.java +++ b/cache/src/test/java/net/runelite/cache/OverlayDumper.java @@ -77,7 +77,7 @@ public class OverlayDumper OverlayLoader loader = new OverlayLoader(); OverlayDefinition overlay = loader.load(file.getFileId(), file.getContents()); - Files.asCharSink(new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()).write(gson.toJson(overlay)); + Files.write(gson.toJson(overlay), new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/SequenceDumper.java b/cache/src/test/java/net/runelite/cache/SequenceDumper.java index 485bd3d84f..94dd175bbb 100644 --- a/cache/src/test/java/net/runelite/cache/SequenceDumper.java +++ b/cache/src/test/java/net/runelite/cache/SequenceDumper.java @@ -77,7 +77,7 @@ public class SequenceDumper SequenceLoader loader = new SequenceLoader(); SequenceDefinition seq = loader.load(file.getFileId(), file.getContents()); - Files.asCharSink(new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()).write(gson.toJson(seq)); + Files.write(gson.toJson(seq), new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/SoundEffectsDumperTest.java b/cache/src/test/java/net/runelite/cache/SoundEffectsDumperTest.java index 5ac0c9e1c5..c2a420c0de 100644 --- a/cache/src/test/java/net/runelite/cache/SoundEffectsDumperTest.java +++ b/cache/src/test/java/net/runelite/cache/SoundEffectsDumperTest.java @@ -71,7 +71,7 @@ public class SoundEffectsDumperTest SoundEffectLoader soundEffectLoader = new SoundEffectLoader(); SoundEffectDefinition soundEffect = soundEffectLoader.load(contents); - Files.asCharSink(new File(dumpDir, archive.getArchiveId() + ".json"), Charset.defaultCharset()).write(gson.toJson(soundEffect)); + Files.write(gson.toJson(soundEffect), new File(dumpDir, archive.getArchiveId() + ".json"), Charset.defaultCharset()); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/StructManagerTest.java b/cache/src/test/java/net/runelite/cache/StructManagerTest.java index f1a1fb22ca..470df61bc0 100644 --- a/cache/src/test/java/net/runelite/cache/StructManagerTest.java +++ b/cache/src/test/java/net/runelite/cache/StructManagerTest.java @@ -64,7 +64,7 @@ public class StructManagerTest { StructDefinition def = struct.getValue(); - Files.asCharSink(new File(dumpDir, struct.getKey() + ".json"), Charset.defaultCharset()).write(gson.toJson(def)); + Files.write(gson.toJson(def), new File(dumpDir, struct.getKey() + ".json"), Charset.defaultCharset()); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/TextureDumper.java b/cache/src/test/java/net/runelite/cache/TextureDumper.java index 0aba683504..cdcdbd9f6a 100644 --- a/cache/src/test/java/net/runelite/cache/TextureDumper.java +++ b/cache/src/test/java/net/runelite/cache/TextureDumper.java @@ -64,7 +64,7 @@ public class TextureDumper for (TextureDefinition texture : tm.getTextures()) { - Files.asCharSink(new File(outDir, texture.getId() + ".json"), Charset.defaultCharset()).write(gson.toJson(texture)); + Files.write(gson.toJson(texture), new File(outDir, texture.getId() + ".json"), Charset.defaultCharset()); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/UnderlayDumper.java b/cache/src/test/java/net/runelite/cache/UnderlayDumper.java index 04f2997530..db735d40cf 100644 --- a/cache/src/test/java/net/runelite/cache/UnderlayDumper.java +++ b/cache/src/test/java/net/runelite/cache/UnderlayDumper.java @@ -77,7 +77,7 @@ public class UnderlayDumper UnderlayLoader loader = new UnderlayLoader(); UnderlayDefinition underlay = loader.load(file.getFileId(), file.getContents()); - Files.asCharSink(new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()).write(gson.toJson(underlay)); + Files.write(gson.toJson(underlay), new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/VarbitDumper.java b/cache/src/test/java/net/runelite/cache/VarbitDumper.java index 9bcdcf9237..5f75c7a157 100644 --- a/cache/src/test/java/net/runelite/cache/VarbitDumper.java +++ b/cache/src/test/java/net/runelite/cache/VarbitDumper.java @@ -77,7 +77,7 @@ public class VarbitDumper VarbitLoader loader = new VarbitLoader(); VarbitDefinition varbit = loader.load(file.getFileId(), file.getContents()); - Files.asCharSink(new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()).write(gson.toJson(varbit)); + Files.write(gson.toJson(varbit), new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/WorldMapDumperTest.java b/cache/src/test/java/net/runelite/cache/WorldMapDumperTest.java index 92b2582a91..8d8dd956c4 100644 --- a/cache/src/test/java/net/runelite/cache/WorldMapDumperTest.java +++ b/cache/src/test/java/net/runelite/cache/WorldMapDumperTest.java @@ -77,7 +77,7 @@ public class WorldMapDumperTest WorldMapLoader loader = new WorldMapLoader(); WorldMapDefinition def = loader.load(file.getContents(), file.getFileId()); - Files.asCharSink(new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()).write(gson.toJson(def)); + Files.write(gson.toJson(def), new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()); ++count; } } diff --git a/http-api/src/main/java/net/runelite/http/api/chat/ChatClient.java b/http-api/src/main/java/net/runelite/http/api/chat/ChatClient.java index bd8c83f5ef..3e9ffe3fd9 100644 --- a/http-api/src/main/java/net/runelite/http/api/chat/ChatClient.java +++ b/http-api/src/main/java/net/runelite/http/api/chat/ChatClient.java @@ -39,8 +39,8 @@ import okhttp3.Response; public class ChatClient { private static final Predicate LAYOUT_VALIDATOR = Pattern - .compile("\\[[A-Z]+]:(\\s*\\w+\\s*(\\([A-Za-z]+\\))?,?)+") - .asPredicate(); + .compile("\\[[A-Z]+]:(\\s*\\w+\\s*(\\([A-Za-z]+\\))?,?)+") + .asPredicate(); public boolean submitKc(String username, String boss, int kc) throws IOException { @@ -237,7 +237,7 @@ public class ChatClient .url(url) .build(); - try (Response response = RuneLiteAPI.CLIENT.newCall(request).execute()) + try (Response response = RuneLiteAPI.RLP_CLIENT.newCall(request).execute()) { return response.isSuccessful(); } @@ -273,16 +273,16 @@ public class ChatClient } HttpUrl url = RuneLiteAPI.getPlusApiBase().newBuilder() - .addPathSegment("chat") - .addPathSegment("layout") - .addQueryParameter("name", username) - .addQueryParameter("layout", layout) - .build(); + .addPathSegment("chat") + .addPathSegment("layout") + .addQueryParameter("name", username) + .addQueryParameter("layout", layout) + .build(); Request request = new Request.Builder() - .post(RequestBody.create(null, new byte[0])) - .url(url) - .build(); + .post(RequestBody.create(null, new byte[0])) + .url(url) + .build(); try (Response response = RuneLiteAPI.RLP_CLIENT.newCall(request).execute()) { @@ -290,40 +290,17 @@ public class ChatClient } } - public boolean submitDuels(String username, int wins, int losses, int winningStreak, int losingStreak) throws IOException - { - HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() - .addPathSegment("chat") - .addPathSegment("duels") - .addQueryParameter("name", username) - .addQueryParameter("wins", Integer.toString(wins)) - .addQueryParameter("losses", Integer.toString(losses)) - .addQueryParameter("winningStreak", Integer.toString(winningStreak)) - .addQueryParameter("losingStreak", Integer.toString(losingStreak)) - .build(); - - Request request = new Request.Builder() - .post(RequestBody.create(null, new byte[0])) - .url(url) - .build(); - - try (Response response = RuneLiteAPI.CLIENT.newCall(request).execute()) - { - return response.isSuccessful(); - } - } - public String getLayout(String username) throws IOException { HttpUrl url = RuneLiteAPI.getPlusApiBase().newBuilder() - .addPathSegment("chat") - .addPathSegment("layout") - .addQueryParameter("name", username) - .build(); + .addPathSegment("chat") + .addPathSegment("layout") + .addQueryParameter("name", username) + .build(); Request request = new Request.Builder() - .url(url) - .build(); + .url(url) + .build(); try (Response response = RuneLiteAPI.RLP_CLIENT.newCall(request).execute()) { @@ -351,15 +328,15 @@ public class ChatClient public House[] getHosts(int world, String location) throws IOException { HttpUrl url = RuneLiteAPI.getPlusApiBase().newBuilder() - .addPathSegment("chat") - .addPathSegment("hosts") - .addQueryParameter("world", Integer.toString(world)) - .addQueryParameter("location", location) - .build(); + .addPathSegment("chat") + .addPathSegment("hosts") + .addQueryParameter("world", Integer.toString(world)) + .addQueryParameter("location", location) + .build(); Request request = new Request.Builder() - .url(url) - .build(); + .url(url) + .build(); try (Response response = RuneLiteAPI.RLP_CLIENT.newCall(request).execute()) { @@ -370,35 +347,6 @@ public class ChatClient InputStream in = response.body().byteStream(); return RuneLiteAPI.GSON.fromJson(new InputStreamReader(in), House[].class); - - } - catch (JsonParseException ex) - { - throw new IOException(ex); - } - } - - public Duels getDuels(String username) throws IOException - { - HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() - .addPathSegment("chat") - .addPathSegment("duels") - .addQueryParameter("name", username) - .build(); - - Request request = new Request.Builder() - .url(url) - .build(); - - try (Response response = RuneLiteAPI.CLIENT.newCall(request).execute()) - { - if (!response.isSuccessful()) - { - throw new IOException("Unable to look up duels!"); - } - - InputStream in = response.body().byteStream(); - return RuneLiteAPI.GSON.fromJson(new InputStreamReader(in), Duels.class); } catch (JsonParseException ex) { @@ -409,24 +357,24 @@ public class ChatClient public boolean submitHost(int world, String location, House house) throws IOException { HttpUrl url = RuneLiteAPI.getPlusApiBase().newBuilder() - .addPathSegment("chat") - .addPathSegment("hosts") - .addQueryParameter("world", Integer.toString(world)) - .addQueryParameter("location", location) - .addQueryParameter("owner", house.getOwner()) - .addQueryParameter("guildedAltar", Boolean.toString(house.isGuildedAltarPresent())) - .addQueryParameter("occultAltar", Boolean.toString(house.isOccultAltarPresent())) - .addQueryParameter("spiritTree", Boolean.toString(house.isSpiritTreePresent())) - .addQueryParameter("fairyRing", Boolean.toString(house.isFairyRingPresent())) - .addQueryParameter("wildernessObelisk", Boolean.toString(house.isWildernessObeliskPresent())) - .addQueryParameter("repairStand", Boolean.toString(house.isRepairStandPresent())) - .addQueryParameter("combatDummy", Boolean.toString(house.isCombatDummyPresent())) - .build(); + .addPathSegment("chat") + .addPathSegment("hosts") + .addQueryParameter("world", Integer.toString(world)) + .addQueryParameter("location", location) + .addQueryParameter("owner", house.getOwner()) + .addQueryParameter("guildedAltar", Boolean.toString(house.isGuildedAltarPresent())) + .addQueryParameter("occultAltar", Boolean.toString(house.isOccultAltarPresent())) + .addQueryParameter("spiritTree", Boolean.toString(house.isSpiritTreePresent())) + .addQueryParameter("fairyRing", Boolean.toString(house.isFairyRingPresent())) + .addQueryParameter("wildernessObelisk", Boolean.toString(house.isWildernessObeliskPresent())) + .addQueryParameter("repairStand", Boolean.toString(house.isRepairStandPresent())) + .addQueryParameter("combatDummy", Boolean.toString(house.isCombatDummyPresent())) + .build(); Request request = new Request.Builder() - .post(RequestBody.create(null, new byte[0])) - .url(url) - .build(); + .post(RequestBody.create(null, new byte[0])) + .url(url) + .build(); try (Response response = RuneLiteAPI.RLP_CLIENT.newCall(request).execute()) { @@ -437,29 +385,29 @@ public class ChatClient public boolean removeHost(int world, String location, House house) throws IOException { HttpUrl url = RuneLiteAPI.getPlusApiBase().newBuilder() - .addPathSegment("chat") - .addPathSegment("hosts") - .addQueryParameter("world", Integer.toString(world)) - .addQueryParameter("location", location) - .addQueryParameter("owner", house.getOwner()) - .addQueryParameter("guildedAltar", Boolean.toString(house.isGuildedAltarPresent())) - .addQueryParameter("occultAltar", Boolean.toString(house.isOccultAltarPresent())) - .addQueryParameter("spiritTree", Boolean.toString(house.isSpiritTreePresent())) - .addQueryParameter("fairyRing", Boolean.toString(house.isFairyRingPresent())) - .addQueryParameter("wildernessObelisk", Boolean.toString(house.isWildernessObeliskPresent())) - .addQueryParameter("repairStand", Boolean.toString(house.isRepairStandPresent())) - .addQueryParameter("combatDummy", Boolean.toString(house.isCombatDummyPresent())) - .addQueryParameter("remove", Boolean.toString(true)) - .build(); + .addPathSegment("chat") + .addPathSegment("hosts") + .addQueryParameter("world", Integer.toString(world)) + .addQueryParameter("location", location) + .addQueryParameter("owner", house.getOwner()) + .addQueryParameter("guildedAltar", Boolean.toString(house.isGuildedAltarPresent())) + .addQueryParameter("occultAltar", Boolean.toString(house.isOccultAltarPresent())) + .addQueryParameter("spiritTree", Boolean.toString(house.isSpiritTreePresent())) + .addQueryParameter("fairyRing", Boolean.toString(house.isFairyRingPresent())) + .addQueryParameter("wildernessObelisk", Boolean.toString(house.isWildernessObeliskPresent())) + .addQueryParameter("repairStand", Boolean.toString(house.isRepairStandPresent())) + .addQueryParameter("combatDummy", Boolean.toString(house.isCombatDummyPresent())) + .addQueryParameter("remove", Boolean.toString(true)) + .build(); Request request = new Request.Builder() - .post(RequestBody.create(null, new byte[0])) - .url(url) - .build(); + .post(RequestBody.create(null, new byte[0])) + .url(url) + .build(); try (Response response = RuneLiteAPI.RLP_CLIENT.newCall(request).execute()) { return response.isSuccessful(); } } -} \ No newline at end of file +} diff --git a/http-api/src/main/java/net/runelite/http/api/chat/Duels.java b/http-api/src/main/java/net/runelite/http/api/chat/Duels.java deleted file mode 100644 index ba117a526a..0000000000 --- a/http-api/src/main/java/net/runelite/http/api/chat/Duels.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2019, Adam - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.http.api.chat; - -import lombok.Data; - -@Data -public class Duels -{ - private int wins; - private int losses; - private int winningStreak; - private int losingStreak; -} diff --git a/http-service/src/main/java/net/runelite/http/service/chat/ChatController.java b/http-service/src/main/java/net/runelite/http/service/chat/ChatController.java index df287e6512..5aa1b8144b 100644 --- a/http-service/src/main/java/net/runelite/http/service/chat/ChatController.java +++ b/http-service/src/main/java/net/runelite/http/service/chat/ChatController.java @@ -100,4 +100,4 @@ public class ChatController { return chatService.getHosts(world, location); } -} \ No newline at end of file +} diff --git a/http-service/src/main/java/net/runelite/http/service/chat/ChatService.java b/http-service/src/main/java/net/runelite/http/service/chat/ChatService.java index aa23d3f18d..ebce4c49a0 100644 --- a/http-service/src/main/java/net/runelite/http/service/chat/ChatService.java +++ b/http-service/src/main/java/net/runelite/http/service/chat/ChatService.java @@ -117,4 +117,4 @@ public class ChatService jedis.lrem(key, 0, json); } } -} \ No newline at end of file +} diff --git a/runelite-api/src/main/java/net/runelite/api/Client.java b/runelite-api/src/main/java/net/runelite/api/Client.java index d03116c58d..604478d6f3 100644 --- a/runelite-api/src/main/java/net/runelite/api/Client.java +++ b/runelite-api/src/main/java/net/runelite/api/Client.java @@ -1626,10 +1626,6 @@ public interface Client extends GameShell * Returns client item composition cache */ NodeCache getItemDefinitionCache(); - /** - * Returns the array of cross sprites that appear and animate when left-clicking - */ - Sprite[] getCrossSprites(); EnumDefinition getEnum(int id); diff --git a/runelite-client/src/main/java/net/runelite/client/config/ChatColorConfig.java b/runelite-client/src/main/java/net/runelite/client/config/ChatColorConfig.java index c9a3e40d3d..0bcf67341c 100644 --- a/runelite-client/src/main/java/net/runelite/client/config/ChatColorConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/config/ChatColorConfig.java @@ -451,7 +451,7 @@ public interface ChatColorConfig extends Config ) default Color transparentExamineHighlight() { - return Color.GREEN; + return Color.decode("#0000FF"); } @ConfigItem( diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsConfig.java index 5a08937345..92987467d0 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsConfig.java @@ -110,17 +110,6 @@ public interface ChatCommandsConfig extends Config @ConfigItem( position = 7, - keyName = "duels", - name = "Duels Command", - description = "Configures whether the duel arena command is enabled
    !duels" - ) - default boolean duels() - { - return true; - } - - @ConfigItem( - position = 8, keyName = "clearShortcuts", name = "Clear shortcuts", description = "Enable shortcuts (ctrl+w and backspace) for clearing the chatbox" diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java index 079f1cdba6..269c116c76 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java @@ -64,7 +64,6 @@ import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.util.StackFormatter; import static net.runelite.client.util.Text.sanitize; import net.runelite.http.api.chat.ChatClient; -import net.runelite.http.api.chat.Duels; import net.runelite.http.api.hiscore.HiscoreClient; import net.runelite.http.api.hiscore.HiscoreEndpoint; import net.runelite.http.api.hiscore.HiscoreResult; @@ -90,8 +89,6 @@ public class ChatCommandsPlugin extends Plugin private static final Pattern BARROWS_PATTERN = Pattern.compile("Your Barrows chest count is: (\\d+)"); private static final Pattern KILL_DURATION_PATTERN = Pattern.compile("Fight duration: [0-9:]+. Personal best: ([0-9:]+)"); private static final Pattern NEW_PB_PATTERN = Pattern.compile("Fight duration: ([0-9:]+) \\(new personal best\\)"); - private static final Pattern DUEL_ARENA_WINS_PATTERN = Pattern.compile("You (were defeated|won)! You have(?: now)? won (\\d+) duels?"); - private static final Pattern DUEL_ARENA_LOSSES_PATTERN = Pattern.compile("You have(?: now)? lost (\\d+) duels?"); private static final String TOTAL_LEVEL_COMMAND_STRING = "!total"; private static final String PRICE_COMMAND_STRING = "!price"; private static final String LEVEL_COMMAND_STRING = "!lvl"; @@ -101,7 +98,6 @@ public class ChatCommandsPlugin extends Plugin private static final String QP_COMMAND_STRING = "!qp"; private static final String GC_COMMAND_STRING = "!gc"; private static final String PB_COMMAND = "!pb"; - private static final String DUEL_ARENA_COMMAND = "!duels"; private final HiscoreClient hiscoreClient = new HiscoreClient(); private final ChatClient chatClient = new ChatClient(); @@ -152,7 +148,6 @@ public class ChatCommandsPlugin extends Plugin chatCommandManager.registerCommandAsync(QP_COMMAND_STRING, this::questPointsLookup, this::questPointsSubmit); chatCommandManager.registerCommandAsync(GC_COMMAND_STRING, this::gambleCountLookup, this::gambleCountSubmit); chatCommandManager.registerCommandAsync(PB_COMMAND, this::personalBestLookup, this::personalBestSubmit); - chatCommandManager.registerCommandAsync(DUEL_ARENA_COMMAND, this::duelArenaLookup, this::duelArenaSubmit); } @Override @@ -171,7 +166,6 @@ public class ChatCommandsPlugin extends Plugin chatCommandManager.unregisterCommand(QP_COMMAND_STRING); chatCommandManager.unregisterCommand(PB_COMMAND); chatCommandManager.unregisterCommand(GC_COMMAND_STRING); - chatCommandManager.unregisterCommand(DUEL_ARENA_COMMAND); } @Provides @@ -209,9 +203,7 @@ public class ChatCommandsPlugin extends Plugin @Subscribe public void onChatMessage(ChatMessage chatMessage) { - if (chatMessage.getType() != ChatMessageType.TRADE - && chatMessage.getType() != ChatMessageType.GAMEMESSAGE - && chatMessage.getType() != ChatMessageType.SPAM) + if (chatMessage.getType() != ChatMessageType.GAMEMESSAGE && chatMessage.getType() != ChatMessageType.SPAM) { return; } @@ -247,43 +239,6 @@ public class ChatCommandsPlugin extends Plugin return; } - matcher = DUEL_ARENA_WINS_PATTERN.matcher(message); - if (matcher.find()) - { - final int oldWins = getKc("Duel Arena Wins"); - final int wins = Integer.parseInt(matcher.group(2)); - final String result = matcher.group(1); - int winningStreak = getKc("Duel Arena Win Streak"); - int losingStreak = getKc("Duel Arena Lose Streak"); - - if (result.equals("won") && wins > oldWins) - { - losingStreak = 0; - winningStreak += 1; - } - else if (result.equals("were defeated")) - { - losingStreak += 1; - winningStreak = 0; - } - else - { - log.warn("unrecognized duel streak chat message: {}", message); - } - - setKc("Duel Arena Wins", wins); - setKc("Duel Arena Win Streak", winningStreak); - setKc("Duel Arena Lose Streak", losingStreak); - } - - matcher = DUEL_ARENA_LOSSES_PATTERN.matcher(message); - if (matcher.find()) - { - int losses = Integer.parseInt(matcher.group(1)); - - setKc("Duel Arena Losses", losses); - } - matcher = BARROWS_PATTERN.matcher(message); if (matcher.find()) { @@ -464,96 +419,6 @@ public class ChatCommandsPlugin extends Plugin client.refreshChat(); } - private boolean duelArenaSubmit(ChatInput chatInput, String value) - { - final int wins = getKc("Duel Arena Wins"); - final int losses = getKc("Duel Arena Losses"); - final int winningStreak = getKc("Duel Arena Win Streak"); - final int losingStreak = getKc("Duel Arena Lose Streak"); - - if (wins <= 0 && losses <= 0 && winningStreak <= 0 && losingStreak <= 0) - { - return false; - } - - final String playerName = client.getLocalPlayer().getName(); - - executor.execute(() -> - { - try - { - chatClient.submitDuels(playerName, wins, losses, winningStreak, losingStreak); - } - catch (Exception ex) - { - log.warn("unable to submit duels", ex); - } - finally - { - chatInput.resume(); - } - }); - - return true; - } - - private void duelArenaLookup(ChatMessage chatMessage, String message) - { - if (!config.duels()) - { - return; - } - - ChatMessageType type = chatMessage.getType(); - - final String player; - if (type == ChatMessageType.PRIVATECHATOUT) - { - player = client.getLocalPlayer().getName(); - } - else - { - player = sanitize(chatMessage.getName()); - } - - Duels duels; - try - { - duels = chatClient.getDuels(player); - } - catch (IOException ex) - { - log.debug("unable to lookup duels", ex); - return; - } - - final int wins = duels.getWins(); - final int losses = duels.getLosses(); - final int winningStreak = duels.getWinningStreak(); - final int losingStreak = duels.getLosingStreak(); - - String response = new ChatMessageBuilder() - .append(ChatColorType.NORMAL) - .append("Duel Arena wins: ") - .append(ChatColorType.HIGHLIGHT) - .append(Integer.toString(wins)) - .append(ChatColorType.NORMAL) - .append(" losses: ") - .append(ChatColorType.HIGHLIGHT) - .append(Integer.toString(losses)) - .append(ChatColorType.NORMAL) - .append(" streak: ") - .append(ChatColorType.HIGHLIGHT) - .append(Integer.toString((winningStreak != 0 ? winningStreak : -losingStreak))) - .build(); - - log.debug("Setting response {}", response); - final MessageNode messageNode = chatMessage.getMessageNode(); - messageNode.setRuneLiteFormatMessage(response); - chatMessageManager.update(messageNode); - client.refreshChat(); - } - private void questPointsLookup(ChatMessage chatMessage, String message) { if (!config.qp()) @@ -1366,4 +1231,4 @@ public class ChatCommandsPlugin extends Plugin return WordUtils.capitalize(boss); } } -} \ No newline at end of file +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsButton.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsButton.java index e21af75f5a..52de0309a9 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsButton.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsButton.java @@ -37,7 +37,6 @@ class DevToolsButton extends JButton { super(title); addActionListener((ev) -> setActive(!active)); - this.setToolTipText(title); } void setActive(boolean active) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesConfig.java index 3f64778e52..540186558c 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesConfig.java @@ -62,14 +62,4 @@ public interface InterfaceStylesConfig extends Config { return false; } - - @ConfigItem( - keyName = "rsCrossSprites", - name = "RuneScape cross sprites", - description = "Replaces left-click cross sprites with the ones in RuneScape" - ) - default boolean rsCrossSprites() - { - return false; - } } \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesPlugin.java index 6944a982d7..fa70dff0fc 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesPlugin.java @@ -31,13 +31,11 @@ import java.awt.image.BufferedImage; import javax.inject.Inject; import lombok.extern.slf4j.Slf4j; import net.runelite.api.Client; -import net.runelite.api.GameState; import net.runelite.api.HealthBar; import net.runelite.api.SpriteID; import net.runelite.api.Sprite; import net.runelite.api.events.BeforeMenuRender; import net.runelite.api.events.ConfigChanged; -import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.PostHealthBar; import net.runelite.api.events.WidgetPositioned; import net.runelite.api.widgets.Widget; @@ -71,8 +69,6 @@ public class InterfaceStylesPlugin extends Plugin @Inject private SpriteManager spriteManager; - private Sprite[] defaultCrossSprites; - @Provides InterfaceStylesConfig provideConfig(ConfigManager configManager) { @@ -93,7 +89,6 @@ public class InterfaceStylesPlugin extends Plugin restoreWidgetDimensions(); removeGameframe(); restoreHealthBars(); - restoreCrossSprites(); }); } @@ -131,22 +126,6 @@ public class InterfaceStylesPlugin extends Plugin } } - @Subscribe - public void onGameStateChanged(GameStateChanged gameStateChanged) - { - if (gameStateChanged.getGameState() != GameState.LOGIN_SCREEN) - { - return; - } - - /* - * The cross sprites aren't loaded yet when the initial config change event is received. - * So run the overriding for cross sprites when we reach the login screen, - * at which point the cross sprites will have been loaded. - */ - overrideCrossSprites(); - } - private void updateAllOverrides() { removeGameframe(); @@ -155,7 +134,6 @@ public class InterfaceStylesPlugin extends Plugin restoreWidgetDimensions(); adjustWidgetDimensions(); overrideHealthBars(); - overrideCrossSprites(); } @Subscribe @@ -305,62 +283,6 @@ public class InterfaceStylesPlugin extends Plugin clientThread.invokeLater(client::resetHealthBarCaches); } - private void overrideCrossSprites() - { - if (config.rsCrossSprites()) - { - // If we've already replaced them, - // we don't need to replace them again - if (defaultCrossSprites != null) - { - return; - } - - Sprite[] crossSprites = client.getCrossSprites(); - - if (crossSprites == null) - { - return; - } - - defaultCrossSprites = new Sprite[crossSprites.length]; - System.arraycopy(crossSprites, 0, defaultCrossSprites, 0, defaultCrossSprites.length); - - for (int i = 0; i < crossSprites.length; i++) - { - Sprite newSprite = getFileSpritePixels("rs3/cross_sprites/" + i + ".png"); - - if (newSprite == null) - { - continue; - } - - crossSprites[i] = newSprite; - } - } - else - { - restoreCrossSprites(); - } - } - - private void restoreCrossSprites() - { - if (defaultCrossSprites == null) - { - return; - } - - Sprite[] crossSprites = client.getCrossSprites(); - - if (crossSprites != null && defaultCrossSprites.length == crossSprites.length) - { - System.arraycopy(defaultCrossSprites, 0, crossSprites, 0, defaultCrossSprites.length); - } - - defaultCrossSprites = null; - } - private void restoreWidgetDimensions() { for (WidgetOffset widgetOffset : WidgetOffset.values()) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/WidgetOffset.java b/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/WidgetOffset.java index 9edf17165e..fe61af1af7 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/WidgetOffset.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/WidgetOffset.java @@ -118,33 +118,33 @@ enum WidgetOffset FIXED_2005_INTERFACE_CONTAINER(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_INTERFACE_CONTAINER, 7, null, null, null), FIXED_2005_BANK_CONTAINER(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_BANK_CONTAINER, 7, null, null, null), FIXED_2005_COMBAT_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_COMBAT_TAB, 19, 2, null, null), - FIXED_2005_COMBAT_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_COMBAT_ICON, 28, 1, null, null), + FIXED_2005_COMBAT_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_COMBAT_ICON, 26, null, null, null), FIXED_2005_STATS_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_STATS_TAB, 55, null, 30, null), - FIXED_2005_STATS_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_STATS_ICON, 51, null, null, null), + FIXED_2005_STATS_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_STATS_ICON, 53, null, null, null), FIXED_2005_QUESTS_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_QUESTS_TAB, 82, 1, 30, null), - FIXED_2005_QUESTS_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_QUESTS_ICON, 80, null, null, null), + FIXED_2005_QUESTS_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_QUESTS_ICON, 81, null, null, null), FIXED_2005_INVENTORY_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_INVENTORY_TAB, null, null, 45, null), - FIXED_2005_INVENTORY_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_INVENTORY_ICON, 113, 1, null, null), + FIXED_2005_INVENTORY_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_INVENTORY_ICON, 115, null, null, null), FIXED_2005_EQUIPMENT_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_EQUIPMENT_TAB, 153, 1, 30, null), - FIXED_2005_EQUIPMENT_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_EQUIPMENT_ICON, 151, 4, null, null), + FIXED_2005_EQUIPMENT_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_EQUIPMENT_ICON, 152, 4, null, null), FIXED_2005_PRAYER_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_PRAYER_TAB, 180, null, 32, null), - FIXED_2005_PRAYER_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_PRAYER_ICON, 178, null, null, null), + FIXED_2005_PRAYER_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_PRAYER_ICON, 180, null, null, null), FIXED_2005_MAGIC_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_MAGIC_TAB, 209, 1, 30, null), - FIXED_2005_MAGIC_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_MAGIC_ICON, 206, 2, null, null), + FIXED_2005_MAGIC_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_MAGIC_ICON, 206, 3, null, null), FIXED_2005_CLAN_CHAT_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_CLAN_CHAT_TAB, 15, null, null, null), FIXED_2005_CLAN_CHAT_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_CLAN_CHAT_ICON, 22, 0, null, null), FIXED_2005_FRIENDS_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_FRIENDS_TAB, 51, null, 30, null), - FIXED_2005_FRIENDS_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_FRIENDS_ICON, 49, -1, null, null), + FIXED_2005_FRIENDS_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_FRIENDS_ICON, 50, null, null, null), FIXED_2005_IGNORES_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_IGNORES_TAB, 79, null, 30, null), FIXED_2005_IGNORES_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_IGNORES_ICON, 78, null, null, null), FIXED_2005_LOGOUT_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_LOGOUT_TAB, 107, 1, 45, null), - FIXED_2005_LOGOUT_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_LOGOUT_ICON, 112, null, null, null), + FIXED_2005_LOGOUT_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_LOGOUT_ICON, 114, 1, null, null), FIXED_2005_OPTIONS_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_OPTIONS_TAB, 150, null, 30, null), - FIXED_2005_OPTIONS_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_OPTIONS_ICON, 148, -1, null, null), + FIXED_2005_OPTIONS_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_OPTIONS_ICON, 149, null, null, null), FIXED_2005_EMOTES_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_EMOTES_TAB, 178, null, 30, null), - FIXED_2005_EMOTES_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_EMOTES_ICON, 178, 1, null, null), + FIXED_2005_EMOTES_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_EMOTES_ICON, 179, null, null, null), FIXED_2005_MUSIC_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_MUSIC_TAB, 206, null, 30, null), - FIXED_2005_MUSIC_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_MUSIC_ICON, 202, 2, null, null); + FIXED_2005_MUSIC_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_MUSIC_ICON, 202, 5, null, null); private Skin skin; private WidgetInfo widgetInfo; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java index bea6d2d477..7c21c9f7dc 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java @@ -129,12 +129,9 @@ public class LootTrackerPlugin extends Plugin // Chest loot handling private static final String CHEST_LOOTED_MESSAGE = "You find some treasure in the chest!"; - private static final Pattern LARRAN_LOOTED_PATTERN = Pattern.compile("You have opened Larran's (big|small) chest .*"); private static final Map CHEST_EVENT_TYPES = ImmutableMap.of( 5179, "Brimstone Chest", - 11573, "Crystal Chest", - 12093, "Larran's big chest", - 13113, "Larran's small chest" + 11573, "Crystal Chest" ); private static final File LOOT_RECORDS_FILE = new File(RuneLite.RUNELITE_DIR, "lootRecords.json"); private static final Set RESPAWN_REGIONS = ImmutableSet.of( @@ -541,7 +538,7 @@ public class LootTrackerPlugin extends Plugin final String message = event.getMessage(); - if (message.equals(CHEST_LOOTED_MESSAGE) || LARRAN_LOOTED_PATTERN.matcher(message).matches()) + if (message.equals(CHEST_LOOTED_MESSAGE)) { final int regionID = client.getLocalPlayer().getWorldLocation().getRegionID(); if (!CHEST_EVENT_TYPES.containsKey(regionID)) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/RareTreeLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/RareTreeLocation.java index 843d6eb645..d32dee4c32 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/RareTreeLocation.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/RareTreeLocation.java @@ -67,7 +67,6 @@ enum RareTreeLocation new WorldPoint(1640, 3496, 0), new WorldPoint(1613, 3494, 0), new WorldPoint(1560, 3636, 0), - new WorldPoint(1646, 3590, 0), // Miscellania new WorldPoint(2550, 3869, 0), @@ -110,8 +109,9 @@ enum RareTreeLocation new WorldPoint(1353, 3731, 0), new WorldPoint(1529, 3452, 0), new WorldPoint(1591, 3421, 0), - new WorldPoint(1647, 3508, 0), - new WorldPoint(1621, 3512, 0), + new WorldPoint(1647, 3510, 0), + new WorldPoint(1632, 3509, 0), + new WorldPoint(1623, 3512, 0), new WorldPoint(1593, 3491, 0), new WorldPoint(1583, 3499, 0), new WorldPoint(1696, 3554, 0), @@ -119,9 +119,6 @@ enum RareTreeLocation new WorldPoint(1625, 3669, 0), new WorldPoint(1642, 3683, 0), new WorldPoint(1642, 3663, 0), - new WorldPoint(1642, 3533, 0), - new WorldPoint(1671, 3657, 0), - new WorldPoint(1680, 3657, 0), // Tirannwn new WorldPoint(2217, 3141, 0), @@ -190,10 +187,8 @@ enum RareTreeLocation new WorldPoint(1389, 3821, 0), new WorldPoint(1610, 3443, 0), new WorldPoint(1578, 3488, 0), + new WorldPoint(1772, 3510, 0), new WorldPoint(1685, 3740, 0), - new WorldPoint(1681, 3689, 0), - new WorldPoint(1751, 3564, 0), - new WorldPoint(1796, 3600, 0), // Misthalin new WorldPoint(3355, 3312, 0), diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/900.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/900.png index 80c3b83fc8bcc414459bcfe200b709d6ff07a72c..407e476c549bcba6b12b4add6e3e356e33881326 100644 GIT binary patch delta 902 zcmV;119|+VL7WGWBYyx1a7bBm000XU000XU0RWnu7ytkRPDw;TR9J=WmQQOFQ5400 z$rzA8(-5#^$Rh4a2)gQ`D_4S0-1!Mys7w6>f-cT;qR7<9}}id2-jwM!vGv)(0>- zXz}_my)wri5g2#KhCLW`JVw4^eW2G*0(+m3c=tW!ICAH@@v8|}+R(eHlM1Bj$w3Q% z)9iBTw{AaWIEUlN9s8#Qwr-P2QoqpzV1J$h5adAzolE>iv-rK+Ppue(j>ov8GM5TY z0^<&u`LF~wD}M|ZS`i>`gRb}_fQy+{WHKWsnzGUc94gd$V6#saCoolQhF-$32lv-0 z`dv+Snq6{qu80#5e*}>#{)Y>Q6PCQ-RAB42R^V&g=H9J@aG}>fp1`+Lud-XK;y0SG z20^5X?*XbHv9YREJU+DB({xpC8cmoB2{VC-YJ0>dW`8VmPb~rIE5Oi8h!c<#Ai)Jf zqK?$YYO6R6`}33_QkK7*1WXKj%WEdVD!ToY`|EIL&13ha{(doQ6&?Uxj0vX)q#{9_ z*vW%P;jcF7_EWk5lrq0~vqj@@kEd_Fe6McBoi*8G$95737x3k*!FZ)qD^AQH8ge2o zX3aeL1AiVq+RJ^TifT>OrlFn7YJs?49+)ayFHt6l6#Mg($w7;&FL9L zYUvmj1UCDnIrgS{&%IlTMI>C#ik79ereSiFx2-LyspJ~ED$IJh8h1&6Y_y{g$ zt$ZHnwb-r$a2!K(aDX;VoY+J}%8{=a`HEN1wfttK;u9enE|$lzlK^13-|WATtImS$ zoieFeh%E|sS@qTuxGt#bfVoQYDryyw0Chx6h{WR#&iB5n@LQW*WPUf{ cHU2sL0B!!8K&}`MeE zaB^>EX>4U6ba`-PAZ2)IW&i+q+O3=Cu^hRQh5y5fH32#Sb08zugEfD@gKly->cvyM zLtfQgg-UTm0^`pA{qJ@E!=Ku`cez-ry;jek+;fkEFPi`S`FsvOzklDK`27{%|L*55 zX8+?A!6!ba&$sn_UqASH`Rxt%eSMg}|GBgEy-xdH==+Nw7fiadmhpXE`(7x;&(Fj6 zd)L438~K;V`TkAzd6FM5{^R%A2*xh_Fhv(n3d!@Y-WU@rNIeZcSN;vD#LrLlb$mb1 ze;qq_(q9Mf=U0D-ogd$yr{9Od`TBi9{X>ktKM&=vWA`HT>x#l}cmCZkY=rKA{qsxg z?%nO)^Le_FE0L=1`%pg~<$c8qC!tL5ZIut>Z{cfuADxfJBQAoz$>!u^xzIx-+Bf8| z!w5H=_j!fI5_3G!_#ESk>HVxFi#@KFl&p_%qmiENQX?CStR;RNf379G`}TLg6&iQm zfmg=B#gxB4eYn5+;lK0o^FsHkbVKm%6DP`obww2*%TVU@FRvmY;eKOUUVPt&`=xID zFNsZLu)Hug9&q^ixx_5tx7tcC&xzL+pPm1dd$9ez03qVug~fzK27INwLk-?yv=E46 zBR_+c$CTqF1EG|-gS+G=rAl&I)V+C+h4`E!MSZSq~QB%#e)LN|yqlP8RR;-#?vu>lMmRo7HS!=Dg(PK|QSn0K!>#g@b1~(mC zdhqVSE5?{{rkQ7%b=qvR&#@?DVQuoc=pY!$?S=-|=N_q)W7b>PcU4V@joHk+`;-r83v-?jk@K0Z;pD^vF;%7aJ zoSk0kNjusiM#=hZ>(!tLIRP-NPEo_TinBp#BYhXI;oh zu-$$0Rv&C?ybn))OT9B61D}4bq@OzDjg%>mn|RRO$n7Y-yEQI%2WM|Cm3;0JmbbgW zwbA%|>#P@Oou^NIZhib%#P8PN^h+(H&RhZ|GZz2GkqySbEzFYo_A_!piGy~^=6YPM zoqT<*gn~j3qq(V;Y!VpybIxRyXG?t*P&D&gYb?@KZE^`ZDYSMfC0)aG z3&K(tCxlzQr8L-!n|ce^;N?a~6C1tit_>_x>tRkVS=Z^Egw58p2-k9f#yh{iF_?Z- z4vX@;owm;9ze?UZaL_^>`>Y<;Eu^cAop`cD_K&aT2E9KBbcS}@O{ah#dwnXh>hTF3 zkoEVU70^7E0{|oK9;n4$;G9h}^ZcvFy+)(YXN_a{z0Lp>LiDBVJR@!1JSpG_z>+zG zJ3UkiaM+^PHwt2z0@DT&@S`taDcuxQd}|k4J)CBxBr5c9qn3Ayp;pugFBJah+J4OB zd0pL+#+r+Zj_|HAdMHG5w!7990F~0IMqrizO-pCG!b(=o^hO#Zv;zFpwq8k0Yu)OY zYZ7+jO_Zq`i3UM57r%B3XViX;MY%@94e7#MjWV;dBk(j!r&muI6BLfC(x9MlgrZv` z6K3h|O&ChyKi{AOhX7A3n|7tI^plva@uTfuLvYz!3AtUk|1MS5=E|e(+^Y(7pcH1g zo66SJS5ueYgI-v7%)Myx8G8l;q%Q6aW5F)46Xo9z^ig9s)))C_QiRDxI7|1gx7(eg zUmz)+O$x7-#MLRRUdd1$wMD{P_J#;7fN*)|KqJ9BYa+DPo|!7;TS^1WAe5392KG$2 z4$+diaauf#GQ)GgYB0;FO8_u<6151t1)zW;KpV&h2CW~z{r-whi*43U)eW*6Rwlxb zm+qefXquzl?0D5U^U%a4Q9Fp%eT~QN#Eykc03{@}+3w+JF}(?z2YG|zs7ABA>AdFD zQ)j0Bw*NrSEy0juwH*iIemc;?5mqZWm(r$&sDO1pM0k6WUGU%$_ zr}NfNnwv@}4Xm_ta!EU(B33Q&6r@PK4?F2ZpgngS4ELQN*xqOyI6ol%9Pe!bBwq>s z8@xX!Gz~f5bEyQDrxc`LPUFHPo$&U~U%+b*N_7+}XU`9dTu+M}NF&c%MKBkp4&oV- z2eFK^0{>ALRZ7QFlCrzLD9j}B?(Ps#_onsGI-J*THRmJ|*cxpH9Ib{hrc)}Fjus9e zq6ZL=TmmLA<8Uiy5wxzNOwt1aldBaWez8d|4eI~UiI4ywoELCHyWMz5k|bQ6z3(n7 z+DC@o_XbHpC>FktRaIKqKoYXfR;Kb%0E5~?bv3p3zQe1#L)1--7$I8=8WUc>0{FbC zfLL+3yZJkIJ&3@XDa~#!B4g%7ee>P}7I_fnEH=g(eOaxRD@%k)ULl zmY9OX-iVbOX~}?gTJvr=jfbTpKwP3Q zTIJ%<6|Zlk#JZP@Nh$IboxSg z1_ud*vK9}+BSGb zaSQ(`6+$^662E}se9a`YJV+89uNw+6zyiyT&~x;($wOb1#zrYE#HnE!A8w+u#uJDS z*)w`8zW#QK7!ZycCJ+;B6*BORw?nUN;ue51Cw%l_VRdIPdW;K zs99j7JhkGusQ|Q!7L8me4%12H9sJl#Ytf2GEz}*>T#Sv?f~0@4_{3F%r&kaf04@O^ zJ&EA?c#-(J?BGl{=0{IW2cqmSTZkdL70~w&{P0=(o3+=Ap!-Fb0nBblLvR6Ll|t{} zC3YBnkCvkNp)K+PHQc4rVr`UK5uennU|==?8rr(Kyo7;xI=+Xf2Rx37#FHUMD?z37 z@I@A_i73llD~O&t)dAyeDQ4CO(^AA8!F4P+;Gn>%)Rd^_ zi6fY0n3N~-1a_bZ&#Y6{#`k+Rm7PwW`qG2Q&>rfHmN*Bq;;BU(I+p43zH`mgUj%*?1XbALc`Fd6a-=S~$DQVu)?Tq75Uy2aT*rZWT|{Niy{u}@7=#5mn(VvTG0p7s*} z><-(dmlzUN@tPYPgF&d`eXfh5Q877v9Deh{ucQCm&;$o1@|^7Z_u`zSrHeUgWhR9V z8wqP54`EWwjTJQqZV1VoY6kaf5{6}~r7q&2N|Tj``M~YrFc%10Q9t~r!JEYSMpR1% z5(LRz_&p0HZDBnqPMprVJ=#`hvK)M1a*vxciC93|b5aB2iGbo6Sf2PA%JVz282Vm` zpNj7U5djFV21hqFc?3d;YCt^QEl`=$RS> zflC|ir{>Y;{S5yr8@gak`{ z=L#E0!%*OXDgwQ)PXAed$a*&#LUP`8pPR~wWaw~l_sR_DH_f3igvTE(e;7EnqaopC zsoUf-JVwwaNTKUkQ{Mx+DW}2)^CH*}zAJ%45rbk+%U6QFho^fH__(|#YitdPP*LF& ztay*RA<5A6c{RVXLjrUJSdv0R>UrLAF}S&Bd~mQ}^MMS+2}K|@E+Py4b^O}ei^(QA zacgpO_IU7g1OZKpRa1l!D`XmlxGquP--_);)Ik8)feCFdMBjsbWb6D4q7<`T0(f`8 zX3dV#UKjh9E@H8*xrrFXQbGC~(Od`tAQPR*1EK~s=Ajgvp9y`J(OsuRS{;KirJ!Y7 zKnGZyDi8QQDnldnLmNXC0$8LtJm9hCP^iN6KXV9aAd`E{oWTnW|%V`MKdfkTZRneIP!qAu=m&#&RkG6UfOarh|!0cnN}Jx%i&iWecDcj;aQ-+&t$%E4!l8ZaM_8DdIc;v;-6 zd5UQPj5v(0DJG>pNAimnVu81HP<)EN-aLC!Ch18a;5`8tNZ-&rbq<(tF?1x@g5kkS z(6y7e!(TuRDiws6bs>Mzp~Derln^EZ?!9FX2p)s5Ni^??LO20rlPPAQ5WYdtFeBQq zSDXQeTc{)K6O04xkFvb>7Ls_%sF9Rs&@d8?+Q6_k1yKH+6`)50vY9S8s2S|8+ox$% z$}L3ZML=lr%F?I+NQFX@?gmvlYL2GqD710F^xfUac(W8SA7FB%t`Tk^8oG4PDJ|4N+ZtEQ z8tKp<5e4PRqY>nJ(~yn|v%86)E)t9whpBD%Cbty;>9wUm*Ziz^Dg+t3_$CfKBz6JS zrXeqlrjx=O#2o{fG0ykr7JOhM;)k8Zw<)rNaaI>9iTw+ z9g)EU;kAzk3IKkx*Tt{t85Cp<+_k7|rF&>YwO2iJY;@xRx z)>B!JAP$dFa15s{hq-=|`2!awShMf zBpsCnf8G$#_*P*ZNC}wRq0pmb%ZG#|5p)4z1mV(E#D7j#U#R`FPP_{iyCD``2gXDu z!1vhXa;S?v0Z4c4!p1sVl6?#dDB*s zCUI!14&d@FRYdkNlg%l-qn3tV4FKo@f|IaI=0FmNd%T$y0!Af1(17i$;l`UlZ6xzZ z$eN-Vs`jyb$N&Y;fDKJNLX9HfrulDDCuU$FtbmT^jTP8~E< zyp2^qdI(RVz%^($YDco=uHx={Vol^rI-c61YaxPI#)nf9oWzPz7QCM}FEZ`+T<8Ke ziFs`*X9uqF)<*l-iW>gSk1~1z{=hEeP;eFkMI?pSoa&UO{l&?p5qlYD<1!|xXm+v? zj7bBjrF{!~21B}D8;b4CV1wSPF<2nzTt$Q^pFsclC_0L>@&pku)L2FP%>q>oj`0o= z-!99$H3UHelFG`|Q%oui3VTavef-K+YB%i5;OP}gs4B;{~qX-4R< z`Q5DOmN&lKTPmJ=C$GBzgxcLi7`?D}2?F$rwrV={iDrgb&BypfbcfpCYEg;`m8LBz zZyMfA4FiGXiFO#QnM~J(!_06MZF;}fZj6p_L(8!@JWuDE}w!t5oVW??ZkQ83)nsVWHHd^RT zh)2GJ@CA(}G&8mNCUX@_K~xa4bWEuMVMbZ&Cv4cw*??R;-0&T%557Xb{YV%kVZHcTRsgnXX zz<@PUgtHBr)eQ1OBHBXE>l?qNYwDQOHfCwc&MggtvgyM$l%LqB_-&M<-XkcNpt z-^HtMzzgb{oLa;TPrg~K7`vmtULMS2h?<&_284KmV5~Gdq}S#`grFAT$c&&Kv0ykHnq~y4yS}cXeCjGs~(*|NRii3_oN=gqpJ*Y(KUIvQ{=t*Nh0^J&8+=@1H(4~HcbD=MbBg(C!%DIm0C^{??a>xDBO zbB>^a7-*{l7m?~W9ke4=Vq};!2+ojtF3IU>a-M+|4UP*2`G6h~WsEHwn3QT*uabQa zN3%sF!)Mc4==8QKKyq+>ZyywsE1K0y^A*yvuaZw-x7fThB(Qpj{BAVba*!Bb}c70>gOxwp%2O}sd*g~6)D8bAb8)A&ZPVJ5uJ{t(G0 zi|J2r2zO0o9atd3{ThBG&Ck(|WEE&`CXdzqXJb^rjIls@PRSa)2ziy?m#ts3dL4aC z*>y$t?@mr}+l6~AFAg>o+-qJ(E5O;O!zuH(9fB7*M}u_GS<{paG3y+jA#Q;BOpHNW zq~uPbzBY97d?_mEmHIszCYFp2bv9!dUbJHU=j4KnXeK3}QsvGd<4fzNj$}Z|1rNT! z3VfeO-?U2) zb~JmO3nh82MhRh_hmsL*5l<^LMr9gSTsWBec zq9)$cGDPKmeJwWv)cagh-3tV1KNn+>PD5sayOi!tI&b=Rle2J(Ks}gfxm>0(SU9?}uEq!g87Y~@> z2}d*`_@n;`0q8j5-2n^W6GDFHZ*?A0FJ99AIy9?%Yx}kT<9hh>XYeS#uUK_x+Il2F zM&&oJ!PIh!kQf=W22?uVLq^OxH4Rnl z_Z+KyzIaDu+;3-P{`|KWu+)$H#70nT_=nyy{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2jd1101N~u zh3cjN00ZqwL_t(o!|hj1YZE~jekSXJuFW+QIMb8@PT&M z#_O*fy)Yf~!tVquJ3#fK3QB{rZg*_}z(CG&?*O1u{9x$MZg6@xMb z0FRXb0G$a300g0$>$@{}tfb#pYCN}|?^M99N3!52^riu~Dw&4q1 zhVjtW^V&nq!E%%xU`06c^n1(}YJljDVs&p)@3B&0cBFxJ*G_>9LZQFwOgQ=@^}H7` zKuT7~KwmhxhFD)C0_t%LK%m)31ZQU39x8SYPdK6&nmOOK5QGA7lVm8dg(bLkMa}pW zIUo&;rt00>BjEGE%6u_P^s%P0rh8(8nAliVrR;yPar!+*DI0vV25G9CY8}N12s3~= zvicyQk^qb5{uWHmp}w;Ilwx zN2SJby8*1PS=fCB+`Pe2sd0>lHiA%S@U(8B1}GZ}7R8BhD0mPGc&n--Dgc0l;-@dS zzz+8C=#_sP7J^WfV||V0iNyd$Q{dw#8y!n%Eaks%1=ef>59{;b?d5Tt95&|R)(Vn0@ zL1-;4^noH1>W|b%CJ>^r=?OGFf#*+n&SZj6U?6AcOt=O+nkMC3=mV{?%;60ZFo8(-F-8K`7Al)V1n$psmOZR*>FeO9nN2j9vd4MrV29)&x6Nsr5+Vz4^XoE5B zwt7(k{uDV0{c`|$Cp6kGJJNuRQXt8&2yCwQ%bp2~HmB?sO-z-Yd{C1OP5m;*aypDI z10>s)X2yNtq!gdc{_Ot(#^j1~2}MAP0KEI==rcrN;DX@G{g^N&0bs?slscqjeWEbn vf}nr?XOsc+r$PVz*K7{tZvvl>^FiY$Co~SMPqcfG00000NkvXXu0mjf#ZHoP diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/0.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/0.png deleted file mode 100644 index b817c474c04ce529e239bb864c3c823625600dca..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15717 zcmeI3Ply{;7{Es>i`~-VpF&wC%)DfWCNtBS zNt0a=sy%2yPz1q)BB%(Wh!-z<&|)ii(TfN1B!UOMco0FotZ!zL%;atISlWUpFOWaq z``-6`@B4l4eKT{&_0@Av9-Mz@o?)1SE6cSt^!-5mzJCsVKJxnxKwta)<&BVG4&993 z_q=xU&{2jlpLH7R(R%%?VR_vmu)QWM4!S;?jdZ65KCmvqh;72Q<5mj4efD{Qb?i#v zf>Iai{vzCTmbU|Ve*0X*+P-AzcHvZY-W(XnK^I1V9dtWxXbdWa#IJ#V$HRPqO{PSb zDusnOAiG{)Wf#2wvPx0qEU{E(HN7Y*dRdYmXC*;Yc|qqznG-}q&<#Okhp$3)9{n-{ zyJf7^&J4pLsZ!XCBH!Toe!pMrmx^A{=0#oCc|qbOi9<8EaLbLrfOErRsgseP8Vs$# z@gv7`+1M{=dcCMpD8zxruVG$Ye;mjShwKnVegJ%4EDHQIBikC=_`RT$EX}rf*nwT> zMj^5jr`q|OUgU+F-i(lA^~}JiCiVI__SE%uyHi7l(b5%!V2E_8W!TvAA-@JguNPQw z=?Y5a*tF~;rgx}Xht-)){IubzRyEJ+#oKzpwP1*f5$1}7N|hYk)1W;$I#P6;YT7nz&vI-d3u?7Q z0Cl;og|*F zGv{nqpr--{wR6zP&53idQ7%A$s-|for>kYaK`3jSu9PKC)Krv+CIC?_k8+vfW>=_X zC$9SzR))AX=i%ka(X8%CY;7&6QkL( za5HCjIroMj^`A4J9izVqT~gObT_v+-I|;p3)CU1vXruGAmxh*loixMUPd_DyQF1an z&K(pY1Xu2?3?{5KHWLxDFL6$fmwVIp-T6(DjEd_}3sLZ!f2Gn>3LzE0@+<5=J zGQ_~s=+-81+t9A^qs&GF|E0?9tskZd-(KagOXmNea_LE&?1`g3ySs;)@!gVv`Y-AQ zAnALe$?qD=_Dni|J?^8OUNT=-1@z*@_;YBQSL3D|WYfGFH_a@ccAcmy4WnVhIji`V zF1_D4kDfkYRaKOdV)FPfZn5eNU}wGNp!NSS>3yodz$(yFE^E&Yu64GUk1#l_nw}+ zIC$=R|BDmfKJm%=krQ*PhhIFrbnMpt>p#7F_Hyg(`}WN-_B$WEaNzSdkDzGG%F?;o JN2f17{|_DZ1xWw^ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/1.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/1.png deleted file mode 100644 index a6add2616dc8bf19a883048ea72f95258e1beedc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15729 zcmeI3O^6&t6o6YJYqBIEO2FU`HnYSZVo(3iOgA%=Y<4#8f)kg`YIeOOHPzL#ZDzXL z?w+051xYj@21F#FD4r#^oIC_Pgh+Dprl5Eb!IM$&;6*R4)zkCSQ#(^Ei6BZf%yhqc z_1>%cUe)XFLtj}s{o;Y?$EP`tJFvJ=S;pr>@o(=G{(t)SZGcbv{DrlU;||`Ae-C_k z?BEj|SA5f1S&de!FPYG5W`X6^P`1W*8={PxAo4DVQ_%vrrE zRsA`%?ksEt=*-sX6}WW)8dm0bdAis!v4bXx0N-gg+|cZlGF`tWzK)y44Bzb%T_|N{ ztatoB(CDz~_yutQ!SIdx2LZIVVbnC~JZwo04HlGT%EgitTng+g7t)P#0yxFhofa6-B^3gmBZ1Ku2)HnZ!xoPX&cAaQw*e zTt4;-YF;ZUWioM~!O@#n(;ozK!yY?KQS1O;l(UjJ&d7oT8^0Aaxn~6-HW_%-J1|{pq>~Q=cHO4#2!1|W^-)lFq+@M2zp4zT81l|J`$Hv=(Pff<~Q(E zX2#7va_nJpMm)uuiDO3{XM$O*NzA%SA<0k?&()j@5Qw~B#q%2FWR)%T5%P0$@v6%6 z&z*H#%WH?v7e&%!nD3!CQ~?nxV@pGja)P9-D5@zJOkFxADW)W)oFqL7A63tC?9EXh z`U+mtvS#Y}w2xFz(g)r@7Kp&Eyrlc4{8-Smy`TxAveN{0B>HZ>C=MG_JqN4Gobwu9 zfQN<3YEc~5Jl3k>!B)JiXI+RwoQyD)B%G@5#ytt@qpf{K!zm|a!}6eGnZuyamH{#} zRVd_TU65sD2nMpC0CN!P(8>cvs};p~^I{jnam9YSt)mgs)1i$wUIx{wx#)%wz|&c* zlyO7W!6Vaw4WWjRP%GGZ!N_TfP{qsfo zYBGJ|$v9Kab_9AkaBw*XjZ~j_E*74PhUA(8bE=@p$QBG$s|f{320}r#Gzm%uuywt= z&hcEvxY-eE!HM&}Nu(jp%^CE@XzMWV-NNgGAVhIlDP{U~Wl*Vc*TGTjmM0UyxMY`M zyz7xw6h~Tz!y?U`o$1^ig2aEyd~%HTI&x`MBXQO3HQ7n%*-;w=Xts{`({2h{;&s%F zbU%KVU`E}Y*>LV75h2*Pzche?1#C^O394iPA#Z8A0JMT4KsBGYRof~k7VM|_9@2md zuVl)qsSb+wzn6v>coH411GkQ>ve=(lzu~`>x!u*nWWx8BIpUW2Kge9N6Gv-ezs~Ng zp~d)VDXzb`7JzQulZ)bxw&9vd`me@yw9)GJH*yj_L^=NNnWojG=^EWMttL%}man)@ zR91S?h~|`4{79EPZ=AtzAE=zubrs)p$Y#=F$?2fRYQ@3N8)1AWkaIm7QZd$WZIWS1 z(KAd^m3mL;-o}zv{1$>=fW*NY(2hIY;QsSZUJPgSPkJSMu^Ld$RwKTdbp=G!TAas%8qVplN3>N`} zE;3wnK7^LxB7o3EhKtUJ&@x;E5W2{4(fJTshKm3~7a1-(A41D;5kTl7!$s#qXc;a7 z2wh~j=zIt*!$kn0iwqZ?520na2q1Kk;iB^)vIv+yIa1lW0BEv=JLueT;0tj8C;+h_QQ;b~vA#odjF+6YH zJ&3u~UJ74_ZwzD_eI`Zgu z`)^&Fy7pkS$6vej^_3g@Pqd%<;m|Xu-hXT9^GCk?M!%F1mkz&scz)*2zALXUe)8*A d6=!2=KX>aUd={NMdICr07Uxe_uAe;r_TPdo2FU;b diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/2.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/2.png deleted file mode 100644 index 015b85e5a0ea4be8083f5c65d9ed379a045694bb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15819 zcmeI3&5zqe6u`}g+Oo7&)k;tmP_0x*t%_qiwv*UOvfABj*_B9HZ9}`|0G-&AthI@4 zY-f|*OM!|?tvFPb_!5_15aQAUCn^q5sqhCNAqpoXxImFW;sP94#&!}rlVn(E4+u@9 ze7t${-kbTo=Qs8tmzGXGy=Uss6vHrk78lCP=zCxA-n9dL9{zO;ps$CVg|i;R?7bDd z?|b9;-p3fGaNDe|_$!rXG~I5cfnnERy4!NlY^0m+IzV58K3jtg(<-KZ{`iv=YZ}GW z8KojroH@8^E^NB+)aJ>mzPYBWMryh=Rp@HSK@0kT?Y5ehr*(^|(65Gm2g7`d4X5~P z#nem?kX@-Pv2(TyStXt2bWzH)IW;XRYCa=B#byLC%L^(m%A6o-f~pB3+k2%-Q|MR0 zHR{@O`9v=ql8UKS-*+^g?{qrpj+D0D1~00r$_p7jli|<|&fBnj(B&-eNaUpNrwl#a zH67oyEjI8AYIfT%rcyzm!K=5gmNN)sc|CTBBHslLFQx^4oROgqY@D{+43}o;JZ!=i zw0sZQiDT`YRol0{ReM6nfqG(Kl#@zj5PR%;TdlF7J%4^3A?P6;Yw1-t9LO(2&u+Uq zoL@&< zoZYltv@BSX3jDa?u~ubUZwF;PW9iUC$?y_MLa7Qb+*!~V9_=fdW+`eLhOL{176;Yq zB7mwaarvC6aH0rRPKAcf=~-P@bR!2ca;?Az7cX)Vud7!Zz47s`>k7=|Yc=toyN&`5 zZzf5Kgd(W0N<~|=JRcxZi{%m;NSkQWVjT*o{mC2vvcbtUS>S3AN}MDMl9U5#R#fz` z?1s(bP4`^)qa)YjH?Asb#xM+(yzywA31=gLo^?%hQh;V+POujP?FHm(0@URk2c^8q zLNvh~P3QIyjF?Z3(OHESsUbzK!da7@ zcy`_I02j_Q(51SaUKx2EHpAWj-353TiSWSs-K9Z=*?LxyM9z>=0}%vSA|!bGRq=`|M~BEd)1W8tT8O7l5$ui3NUSEUuYo z{z}kCo9%GEnibHC7lY59X;O`wo+XVor!L$??281jUaZSa4SB4h)k8%h78Tr#2Z(T=!WM=h+Kl_NV@59%w-1+5? z15fA=AKo$h%KTC1gEeOUg={&ZRGY+I^7u{?O^2r$0Y@2?b^r M=TDZe&z^hrFCj}I8~^|S diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/3.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/3.png deleted file mode 100644 index e62c91b16c78c4fdc4d2c8218852925f6a6b35b4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15896 zcmeI3Ply{;7{Es=wXSUOP_$amA*Euellec%3`xrFrgaxgUAB>Kq0qj}d&!PXW~MW< zO?DBiRjYy*g+h+$=( z%ZGOFje!_HceBM6j4zGJVOXK+z508H{72%>H8_8&<-3w zay*xh{eqge9u+g0IMCqL+gHmU1aiY3J4{jR0AG}|k~ql-+5;PZJ!p2925k{FQ46_I zi0$NwcK(_ddEuHjCFDRoH89Rer80;;alNh9#L!`MGJjI%+YeyYtidn2l%(|tJWT=4mYApl^L|#z!yk;q>vgJNPeqkZ5 zsvQ6H3CD$AJ3LqrNt0o|hu%;bM5u%iHFZ;g z5Sl_hC+mVNBU3ODv<2I+ZQX`BplG#%82@;&i{ZL@wb2`&?Aor&0GXQlFSxGjNXge~ z^51uz>}8ZwItet&aq(6v){+}W04HIoT*3oc2lG@gH@%LaVA`f3Xqtwv|yT8w>P&;NU|DG*ffpy+FJd&8R76 z&Q=6NRZYRb%NOz*)C7oB4L}v<>In4rGQrJQs6{8P){W8P=~nA;bZ&HXSgqaT!UsW! z;$~RP^t<8Ud`SwhSBBlDY5_YwXi9e6s}L-RBcsD*4J-@E1ZO;*+e0vBK0QWz4Y{;l zm$>TAn(id@>QNg6Xs&^~z;@bj;&s%FbpKbs?Yl@s2+rSK8Vm^m3FQnySCE4154RFi zlk0*}134Q?xw@fh{WPbtNNzE%subYCk%Ny5$&xiomios@BKU)&2ox9`aX zacpc@Gs*nbxQ{m1yYo#$!Y@&dKYONWHEDX1Zkkq;rbEjYTqi0iy=cU6$}0XNn*2*T zj_;XJ$N`}E;3wnK7^LxB7o3EhKtUJ z&@x;E5W2{4(fJTshKm3~7a1-(A41D;5kTl7!$s#qXc;a72wh~j=zIt*!$kn0iwqZ? z520na2q1Kk;iB^)v zIv+yIa1lW0BEv=JLueT;0tj7XxafQcEyG0sp^FR`oe!a9xCkJ0k>R5AA+!t^0fa6x zTy#E!mf<3R&_#xe&WF%4Tm%rhNX0cXd=eVD`0?j9e$M&!jo+`~XQX+1aizj>n+G`V z!mAv2XA6J-#Bu8q$NhYU|#Z|J^S8Q5AAs%bMyUoetE5YZsm!OzuUE!`|QS>w?4SO?`s^2TRL*A{L%cGi+=*y CQ#i%| diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/4.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/4.png deleted file mode 100644 index 695cc03088eeab56a7bee600787fed85b0640821..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15689 zcmeI3&5zqe6u{kXSzy&xy;0f&Zc0T_>)4L-Wh+U$-E6xnk+R(`>Xr)~+mpoI#5T6K z$*wrGaN>#pRpr1R0OEjLlS16sy*KAe|iw6v8FXuQfMZ{EE3 zW`1wxjeYRjD;F;um^(7ZaomCBrRpmAJ`{eQnkE0A`+WzIuczImt3Jma{3iVDdGFN0 zqa0U4*4lcoUVBM1oOT+Sj*ipawo7^w-I=b7j13&{I&N5YIrZz8U!{1$Mer!SOJkOXmecR*HNV1kywBx9k9Q1=~L!JL&tWV&CvAH?SO= z5B(zD*$m35R2XP*_2$)f2Z3zA$Bs}GyT}#gv?NY4GL3o*3E>7H<#)J){#Y{k1I@i>ugoHa!C`-XK#s zK56!WRUam2#8ar5I(FQ(rkI7A*eqHKafV7{uG)f!QQ&xMj?=2dt8Ar@kY88`S5<*O zdBw6#r{lj^5~0a3-$QS>iUM3AmZ~7-1u3@{u17^v3a6xuCP@h=aZli*=9pG}Ys`nD zNd>a3lRgqXp%1cuOcbD9c}ez7_%RKw?s#n!RID~?V9~W3C2`o8=s8$b+Je(^JTfd? zQA*;Z=80BS$Jh*)^}KChpCrRiB#ERd+PLRXW3;ueXjv7Kl(cD?nyIT;sTXuXmsLej za5gWXtZoX$dOa%@idjR!g_0Oc0y`VIf3%fg|}_-J;i16gn=vhTu#ZAMA!^1R;(^=tye8_PvM6rft>HzK*dDE ztJ4eHKEbd1HVu3>Tdb&@x;A2wh~j=zM^d;Q~PDBEv=J1GEem z074fTE;=8eWw-zky2xR5A0a}I& z0HKQv7o88#GF$)%U1YfEe1MkW0zl{@!$s!Iv=2AxBw8k$Z*m504>7> zfY3#Ti_QmV87=^XE;3wnK0wQG0U&gd;iB^aT80Y%p^H>pbHn$Bu}xkU?vS^FKmS%1 z$Q#AHv9wy_xa|`hck?Zd`*VkU|IBfl636{=jpMZ29QTa#&TIG2lfL?Lb$+e;z5d6} z&Y77Lw{KmaUBB+i1$n_Q$(l>_01; z_hyzqZoPqSes`#K=fShTeW=fze6aWat)(BD&%bc&();f|dAhK7mOJ{{k?q4zTzHj4 P zJ56@g11&w!QxW3pz#o8wgb)%Z4zv;+IB@F)BqYQI0S6>FfrQG~&WAHeMoU`>fyPok z-n@D5&HUcX8~fnvtEZovpF1?iFwFeQa%~O$J{EuWJdD1d{QV9e>tK<^D8u}kM^Eo!@5?!d| z7UF>HMtzlC^a98#`66eEQkgBOc~Mcz1^F0T5X2%csJtk1f~X0qCWvhR%2nskKRvK) zZLM~)9}Y>C+-4N{8qasT-F#QddqI;IRaNDM0$(U_s0SBrxe@4bZg@C#GVoJ_p&2-S z%%P3n30ld}ER%;V*oJNt zB0F)aoxkZtUbyMa2su>G42*J8uMcBS9dElmHFOv)T|x-@NT*tcjV&MYYcTXWfeDu` zp{X36Hv7o2N68uU6l-RV9rm0VX0awUOO`^KAsx+CTMQtGyrAKEt!lc;RtE^##l?74 zmDnR^9M|%?;WIjqn~d^3@&;=lf>mUxazc?4lt#QBB~6x(3I$CNGEUN-n2)+=Iri3s z4@nbBnlR=g(-ZfB_KyW3up=+oz8OE3so7r822s^%gC^vCx2f}^#!S!Qs?rv{mKUI5 z!K$S5)0(GR)jYEkFY5)@gds{sm`M^!RkCqUfaZAXK+$rlC@Fc%u{6t2p=6f~&Jb0J zlb~GWfNWS?*|ue&RF+K%mUKSeuE=OKlGszyIvyiC0n!NL#MkTEiW^1%O<<*#jK@La zfj|_BWm`eZKu|at$bd7-io_|B1Xa<5iXs)0)i7>88d=}&3Em&ovjOJF7 zxe}TtrwTyeM9EOgielTQZ46vz%qLvG5ICr0gI1=`faX65F~!Y9sAVV4?G^?;&c-^t zINmzSZBkr)5QH!;9hKamb_}aA>N>piqy%ZejLUM>jCVG)bbhRLG%VcAnM~l$5TyPy z=CfmTH=#?a45_Q6*K8-DXGdKSz=bB-Gdn3-sn>Bc-2L=@ffyybujSlBB0_NK-qN5N zA}H9F$O&rMY@-O;82}`rk`K3_Oi)ZUVOnttvm5 z*`VRSl)0T%z;wcQmpSZM{2yd4-HGEhaZt)9Yp5RI5oxIYqFMlwx+m)VMB8Z1r2RMI zI@;auC#s@7n+z0d&RE5_ZRtJ5I(ou@)gn4E z6`jYMaf?-_2U{C82i;SI@kt<}Q#P@|6;ln*&N9p>`i5z$GS33ZF_yNXCk^zF!w;Ww zCQi8F`Ex)2jAnE{y<)y-5DW-eq`1g@FfGM}0U?VN7nu*HrMNI4WRc<`^TD(f7Y2kZ zQe0#{n3m$gfRIIsi_8bpQd}4ivPf}}`CwX#3j;zHDK0V}OiOWLK*%D+MdpKPDJ~2M zS){ngd@wD=g#jUp6c?Efrlq(rAY_r^BJ;tt6c+}BEK*!#KA4u`!hn!Pii^w#(^6a* z5VA;dk@;X+iVFim7AY<=A52SeVL-?t#YN_WX(=uY2w9}K$b2v@#f1SOixd}`52mHK zFd$@+;v)0Gv=kQxge($q&5hn0hAw(pxQpHj{tgt2=#665Twbd)%=Xg^^Xh91^T!?Z z`xC=-1cv$fJi}=3G0fxMo3DI%67{uKY733tx5me}zmGqE-ne#f&-wkIKJw0?b9a99 zKe;9DS`=;@dwvjif2i%hKL6-b7Y|-tpI>t7Q~P1_CL_H3Y(vt)4HS=ASvp<&=*0P}e*pO!hE;wquxk&wCe-w9E?~Kt~qWw_s5stIC9rQ5lqmFZH~Kn~h40&KV4azmqA&Lw^gbR9SIIX3AMoh#>N z z*N*qXA*q~eMv-sue5cdNcci=*tns3*>%36l3k44K;KEHe0$t7x52sH0erhnZ0>_UW z&t+r3!1UImaxNDK8XUcOwf#XLH|()P6!|Xjc`+~WAn#lseCLpKVM zojBIcZ+ejzHoXZU2kMD|QBLahLF}>PZMVmU4x_mZgrJ9XtYx^e=|g@QhTeK$!MP1I zmBZs^A32R-az;GGnu%kFU1x$>tVzw1rI2Q*gyw2g0|+87Sn<48C0%7peS~ba8n3D% z`@|{7wY^UGWQoU3hWQ?PgEbJr3bNEWLFEKxC0>uRA*e@$f*}YQCuvX2N8PiX#^yF3 z5^`WDde%p#C+-979~(qqM_#ghGk$E#Xm~*zL=~qE)*$b@YbAcznCUrKRYuioc>x+0 ztVkt(T=Q6~nrE%Y%X-$eV2F|tW|D+bm2BK&U~ROuuV^_Hl$5;f*oJNDP-+xS&J=Zt zlc20}KsIeoYcyn`sL7TDizPnZuE=OOlGszyIvOK80n!NL#MkS_f*VEvO<kf24N$Z-wICGiWHpSM4@cH>-H+aL9Zyx(G*gvTjgvH` zz(GmY(4-}WlSIK%HAw|U*yy{?m~V6aT;QOR4O*E#eVYFy#27c*Ld`pIZZ|RTaW+oE zmquHMxlM|z4}uWJrK6nd*N#CoMqLL-DJek)u;Q{@vErQ#5#W*5;jnNsXG{WjL^<`J zF`pcx(}XUmGNi7OUXz`KUL)#&0M4$VJ+qUdm3kdD!`+YH7l=`^`&!OzBq9VGx0eRV zv@H_=le28S$SJ05a=HpsPEr~o)CAjBbhV%6TTVmKD2V;y`tPM72A)Q@n!sIyc7^ZH ztl#io%G}N>U^?Mj%N%xF{2yd4-HD?$v0uu!*U(b@L}Z})i)sN#>YiBQx3vw|Oxk}n zuA{B>q`$5T=-|cpzh|0NwCIHNo174t=dU_i(s#YN_WX(=uY2w9}K$b2v@#f1SOixd}`52mHKFd$@+ z;v)0Gv=kQxge+2AWImXd;=+KCMT(2e2h&nq7!a~Zagq68T8aw;LKZ15G9OG!abZBn zBE?1KgJ~%)3Vor!L$??281k9Tx33&mg2&I zkVT4%%m>p_To@3tNO6(*U|Na`140%lE;1iXOL1X9$Rfo>=7VV|E({1+q`1g@FfGM} z0U?VN7nu*HrMNI4WRZw#didQibkWDc9rRW3%=LpGp)ZPAYks-TFk6o^%*(GZ%wIRr z`5MEl3k>u7S%xv*XPEoFcV4`59QAbni>g<8fXWlz>=H_qy zXWxpus>0Rpb{9);KW0yzdHCb|t}xNX#?+#s-MhcQ=rjI}OAqK@J$kYF(A-<+UvGZ@ z<|i)m^<8s6-E&}fZtmy#7mi)neC@`<2Os`eJF&56hB@)YzNZgg`|~`C%q+|;);>LU G_QKysfA?ts diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/7.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/7.png deleted file mode 100644 index c17114ae828d3f89b6b216099a54c12ce1abad53..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15684 zcmeI3O^n+_6o9>gqOxi$Zis@wN+~KTj>qv&Vk=3t-E7%KWC`1?x|Kk5Y>yMu#16K% z$?l1^5)wCr09AquTq|+p!T~Da!ig)KsF0B0!T}+{DU9v>IFn?ww3QHOEG71vH}Acf z@69~h2fy9eeE#V2@nw$Vj&7{iw($9p_;>gr{QuPN1Bg!#ch@h49Cz&N__y@_>0^&` zTp7CCJJC-4MZ@wtd1(74%J(~6+#Bo8^t;fyf+F5TP1mdBe*6539Piqd+(oqx>fKe; za@Y3*bbfzx+uFZk>2~f+b-CO(u!9bYAm8t_z0l}aa*1C9U&qa2j!(KoS1P%cI3T}M zZ}6*rfOs{p36><6_@bVdRJ~MCp5qHZ(nO$(k|F@f0J;Gret6`n%lN7s*p9JPJ2wo6 zrAn?9MO{M_d%a%1C+Gd3DN4Goi=ZGD3IgsSgnM2D`+^sqNS%!Q)KF*zZZ~p$kB|LA z)8CCMxm+A*d<^H+>5c<=;gB7sDE47jl=48FXJlJro9=GVPKIV%B5I=!@}dyiNptPG zEkE+ZmcJn6SiLYX&PlyKjy-q0ozC3QVYGG?BN!r`YZ-3ub&b~tddow;{189aS zXMJRPl0NYMv0(%cb9rssH78LNKV5Ad*1RW6J3 zn&(>8d}}ve)+?TcLY#~+lO&v~WaFNN&FR*WqU~03Qu4NI8@8z<*(sWWDe1BxBSjOS zV%kEf2xPB>camj}5OrH_We-dJjo0(ASZk*da0(_i}^XQG~)=6%Y z;@X8lh~m;w$&G5qxEkZGHLssD`m;uyUa z@@SPIb(Qp5>?HJ^s0RbI(!_h_AVn+nI&DU}pT93Kqh$BB-Frwx2(R8-8dL~%$CP!! zv2{~`mSPJ!k`UhEvIbOHl7VWD(tOux&(xTz^ zQG2K6;%AC5z7t5=(1ujZHN3RQFrye6rm4!j3naI(v=zT;;Flb6{FXCwha2C2?&rm1 zM)%Vz;fnLd$RwKTdbp=G!TAas%8qVplN3>N`}E;3wnK7^LxB7o3EhKtUJ&@x;E z5W2{4(fJTshKm3~7a1-(A41D;5kTl7!$s#qXc;a72wh~j=zIt*!$kn0iwqZ?520na z2q1Kk;iB^)vIv+yI za1lW0A{E#2Yj zGj4L+qyD?EeRB@?eRZR@vfcl|{Btlk^T5fQcLsyOkq?f)68{Dt-@L}Xb!%1oaqz_E zXM?cx{o%*1e{$^BQvb;9#*I6N%%flae8~K2Y3<1mm!7@@U+31Yt-q{nee}+$&2QgB d&%6LGb3e5j5B_nXf#Y!8#@c4>)3cYa{|(ic^*I0l diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java index de4e89299c..b6af13221d 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java @@ -30,7 +30,6 @@ import com.google.inject.testing.fieldbinder.BoundFieldModule; import java.util.concurrent.ScheduledExecutorService; import javax.inject.Inject; import static net.runelite.api.ChatMessageType.GAMEMESSAGE; -import static net.runelite.api.ChatMessageType.TRADE; import net.runelite.api.Client; import net.runelite.api.events.ChatMessage; import net.runelite.client.config.ChatColorConfig; @@ -192,38 +191,4 @@ public class ChatCommandsPluginTest verify(configManager).setConfiguration(eq("personalbest.adam"), eq("kree'arra"), eq(181)); } - - @Test - public void testDuelArenaWin() - { - when(client.getUsername()).thenReturn("Adam"); - - ChatMessage chatMessageEvent = new ChatMessage(null, TRADE, "", "You won! You have now won 27 duels.", null, 0); - chatCommandsPlugin.onChatMessage(chatMessageEvent); - - verify(configManager).setConfiguration("killcount.adam", "duel arena wins", 27); - verify(configManager).setConfiguration("killcount.adam", "duel arena win streak", 1); - } - - @Test - public void testDuelArenaWin2() - { - when(client.getUsername()).thenReturn("Adam"); - - ChatMessage chatMessageEvent = new ChatMessage(null, TRADE, "", "You were defeated! You have won 22 duels.", null, 0); - chatCommandsPlugin.onChatMessage(chatMessageEvent); - - verify(configManager).setConfiguration("killcount.adam", "duel arena wins", 22); - } - - @Test - public void testDuelArenaLose() - { - when(client.getUsername()).thenReturn("Adam"); - - ChatMessage chatMessageEvent = new ChatMessage(null, TRADE, "", "You have now lost 999 duels.", null, 0); - chatCommandsPlugin.onChatMessage(chatMessageEvent); - - verify(configManager).setConfiguration("killcount.adam", "duel arena losses", 999); - } -} +} \ No newline at end of file diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java b/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java index 17f88f3eb3..d33785c9e7 100644 --- a/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java +++ b/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java @@ -1034,8 +1034,4 @@ public interface RSClient extends RSGameShell, Client @Import("viewportWalking") void setViewportWalking(boolean viewportWalking); - - @Import("crossSprites") - @Override - RSSprite[] getCrossSprites(); } From d0591362d7fec9117f199fe1d7ca7b40047ed0cf Mon Sep 17 00:00:00 2001 From: Ganom Date: Sat, 29 Jun 2019 07:53:04 -0400 Subject: [PATCH 32/58] Slayer NPE Fix (#810) * Slayer NPE Fix * More Slayer NPE Fixes * ..|.. travis --- .../plugins/slayer/TargetClickboxOverlay.java | 46 +++++++++++-------- .../plugins/slayer/TargetMinimapOverlay.java | 6 +++ 2 files changed, 33 insertions(+), 19 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TargetClickboxOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TargetClickboxOverlay.java index e9f6866770..c5bd4f1130 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TargetClickboxOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TargetClickboxOverlay.java @@ -26,7 +26,6 @@ */ package net.runelite.client.plugins.slayer; -import java.awt.BasicStroke; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics2D; @@ -57,8 +56,7 @@ public class TargetClickboxOverlay extends Overlay private final ModelOutlineRenderer modelOutliner; @Inject - TargetClickboxOverlay(Client client, SlayerConfig config, SlayerPlugin plugin, - ModelOutlineRenderer modelOutlineRenderer) + TargetClickboxOverlay(Client client, SlayerConfig config, SlayerPlugin plugin, ModelOutlineRenderer modelOutlineRenderer) { this.client = client; this.config = config; @@ -76,7 +74,13 @@ public class TargetClickboxOverlay extends Overlay List targets = plugin.getHighlightedTargets(); for (NPC target : targets) { + if (target == null || target.getName() == null) + { + continue; + } + Color coloration = config.getTargetColor(); + if (plugin.isSuperior(target.getName())) { coloration = config.getSuperiorColor(); @@ -95,28 +99,36 @@ public class TargetClickboxOverlay extends Overlay { case SOUTH_WEST_TILE: LocalPoint lp1 = LocalPoint.fromWorld(client, actor.getWorldLocation()); + + if (lp1 == null) + { + return; + } + Polygon tilePoly1 = Perspective.getCanvasTilePoly(client, lp1); - renderPoly(graphics, color, tilePoly1); + OverlayUtil.renderPolygon(graphics, tilePoly1, color); break; case TILE: int size = 1; NPCDefinition composition = actor.getTransformedDefinition(); + if (composition != null) { size = composition.getSize(); } + LocalPoint lp = actor.getLocalLocation(); Polygon tilePoly = Perspective.getCanvasTileAreaPoly(client, lp, size); - renderPoly(graphics, color, tilePoly); + OverlayUtil.renderPolygon(graphics, tilePoly, color); break; case HULL: Polygon objectClickbox = actor.getConvexHull(); - renderPoly(graphics, color, objectClickbox); + OverlayUtil.renderPolygon(graphics, objectClickbox, color); break; case THIN_OUTLINE: modelOutliner.drawOutline(actor, 1, color); @@ -136,15 +148,23 @@ public class TargetClickboxOverlay extends Overlay case TRUE_LOCATIONS: size = 1; composition = actor.getTransformedDefinition(); + if (composition != null) { size = composition.getSize(); } + WorldPoint wp = actor.getWorldLocation(); lp = LocalPoint.fromWorld(client, wp); + + if (lp == null) + { + return; + } + tilePoly = Perspective.getCanvasTileAreaPoly(client, lp, size); - renderPoly(graphics, color, tilePoly); + OverlayUtil.renderPolygon(graphics, tilePoly, color); break; } @@ -159,16 +179,4 @@ public class TargetClickboxOverlay extends Overlay } } } - - private static void renderPoly(Graphics2D graphics, Color color, Polygon polygon) - { - if (polygon != null) - { - graphics.setColor(color); - graphics.setStroke(new BasicStroke(2)); - graphics.draw(polygon); - graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), 20)); - graphics.fill(polygon); - } - } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TargetMinimapOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TargetMinimapOverlay.java index 8100ff70c7..57615b2a10 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TargetMinimapOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TargetMinimapOverlay.java @@ -67,7 +67,13 @@ public class TargetMinimapOverlay extends Overlay List targets = plugin.getHighlightedTargets(); for (NPC target : targets) { + if (target == null || target.getName() == null) + { + continue; + } + Color coloration = config.getTargetColor(); + if (plugin.isSuperior(target.getName())) { coloration = config.getSuperiorColor(); From 701d809f7831500525883101d3af4351af58ec4d Mon Sep 17 00:00:00 2001 From: Ganom Date: Sat, 29 Jun 2019 12:31:23 -0400 Subject: [PATCH 33/58] Fix up client. (#815) * Aoe Warnings Fix-Up * Freeze Timers NPE Fix * Slayer Chat Lookup NPE && Fixing up Access levels. * Raids Thieving NPE Fix && Fixing up Access levels. * Revert "Fix copy paste error" This reverts commit 26c88101b682eb76b98a8a0d88fc8a47c9f104d3. * Revert "Fix checkstyle" This reverts commit abf7fec004148897585bc0389bb5e0420e3d03cb. * Revert "Convert game thread events to singletons" This reverts commit b33048d7ee0481b17c5849d2d862e75c91e5a36c. * Various Fixes --- .../main/java/net/runelite/api/GraphicID.java | 3 +- .../runelite/api/events/AnimationChanged.java | 7 -- .../api/events/AreaSoundEffectPlayed.java | 7 -- .../runelite/api/events/BeforeMenuRender.java | 7 -- .../net/runelite/api/events/BeforeRender.java | 6 -- .../api/events/BoostedLevelChanged.java | 7 -- .../runelite/api/events/CannonballFired.java | 6 -- .../net/runelite/api/events/ChatMessage.java | 9 +- .../net/runelite/api/events/ClanChanged.java | 11 +-- .../runelite/api/events/ClanMemberJoined.java | 11 +-- .../runelite/api/events/ClanMemberLeft.java | 11 +-- .../net/runelite/api/events/ClientTick.java | 6 -- .../runelite/api/events/CommandExecuted.java | 11 +-- .../api/events/DecorativeObjectChanged.java | 7 -- .../api/events/DecorativeObjectDespawned.java | 7 -- .../api/events/DecorativeObjectSpawned.java | 7 -- .../api/events/DraggingWidgetChanged.java | 7 -- .../api/events/ExperienceChanged.java | 7 -- .../api/events/GameObjectChanged.java | 7 -- .../api/events/GameObjectDespawned.java | 7 -- .../api/events/GameObjectSpawned.java | 7 -- .../runelite/api/events/GameStateChanged.java | 7 -- .../net/runelite/api/events/GameTick.java | 9 +- .../api/events/GrandExchangeOfferChanged.java | 7 -- .../api/events/GraphicsObjectCreated.java | 14 +-- .../api/events/GroundObjectChanged.java | 7 -- .../api/events/GroundObjectDespawned.java | 7 -- .../api/events/GroundObjectSpawned.java | 7 -- .../runelite/api/events/HitsplatApplied.java | 7 -- .../runelite/api/events/InteractChanged.java | 7 -- .../api/events/InteractingChanged.java | 16 +-- .../api/events/ItemContainerChanged.java | 14 +-- .../runelite/api/events/ItemDespawned.java | 16 +-- .../api/events/ItemQuantityChanged.java | 19 ++-- .../net/runelite/api/events/ItemSpawned.java | 15 +-- .../runelite/api/events/LocalPlayerDeath.java | 6 -- .../runelite/api/events/MenuEntryAdded.java | 9 +- .../net/runelite/api/events/MenuOpened.java | 7 -- .../api/events/MenuOptionClicked.java | 7 -- .../api/events/MenuShouldLeftClick.java | 7 -- .../api/events/NameableNameChanged.java | 13 +-- .../runelite/api/events/NpcActionChanged.java | 7 -- .../net/runelite/api/events/NpcDespawned.java | 13 +-- .../net/runelite/api/events/NpcSpawned.java | 13 +-- .../api/events/OverheadTextChanged.java | 15 +-- .../runelite/api/events/PlayerDespawned.java | 13 +-- .../api/events/PlayerMenuOptionClicked.java | 7 -- .../api/events/PlayerMenuOptionsChanged.java | 7 -- .../runelite/api/events/PlayerSpawned.java | 13 +-- .../runelite/api/events/PostHealthBar.java | 7 -- .../api/events/PostItemDefinition.java | 7 -- .../runelite/api/events/ProjectileMoved.java | 7 -- .../api/events/ProjectileSpawned.java | 7 -- .../runelite/api/events/RemovedFriend.java | 13 +-- .../api/events/ResizeableChanged.java | 7 -- .../api/events/ScriptCallbackEvent.java | 7 -- .../api/events/SoundEffectPlayed.java | 7 -- .../api/events/SpotAnimationChanged.java | 7 -- .../runelite/api/events/UsernameChanged.java | 6 -- .../api/events/VarClientIntChanged.java | 11 +-- .../api/events/VarClientStrChanged.java | 11 +-- .../runelite/api/events/VarbitChanged.java | 7 -- .../api/events/WallObjectChanged.java | 7 -- .../api/events/WallObjectDespawned.java | 7 -- .../api/events/WallObjectSpawned.java | 7 -- .../api/events/WidgetHiddenChanged.java | 7 -- .../net/runelite/api/events/WidgetLoaded.java | 7 -- .../api/events/WidgetMenuOptionClicked.java | 7 -- .../runelite/api/events/WidgetPositioned.java | 9 +- .../runelite/api/events/WorldListLoad.java | 13 +-- .../net/runelite/client/callback/Hooks.java | 9 +- .../runelite/client/chat/CommandManager.java | 4 +- .../runelite/client/menus/MenuManager.java | 4 +- .../aoewarnings/AoeWarningOverlay.java | 62 ++---------- .../plugins/aoewarnings/AoeWarningPlugin.java | 98 ++++++++++++------- .../plugins/aoewarnings/BombOverlay.java | 6 +- .../plugins/devtools/DevToolsPlugin.java | 10 +- .../freezetimers/FreezeTimersOverlay.java | 74 ++++++-------- .../freezetimers/FreezeTimersPlugin.java | 2 +- .../plugins/implings/ImplingsPlugin.java | 8 +- .../raidsthieving/BatSolver/BatSolver.java | 2 +- .../raidsthieving/BatSolver/SolutionSet.java | 8 +- .../plugins/raidsthieving/InstancePoint.java | 6 +- .../raidsthieving/RaidsThievingConstants.java | 10 +- .../raidsthieving/RaidsThievingPlugin.java | 11 ++- .../client/plugins/slayer/KnapsackSolver.java | 4 +- .../client/plugins/slayer/NPCPresence.java | 6 +- .../client/plugins/slayer/SlayerPlugin.java | 13 ++- .../plugins/slayer/SlayerTaskPanel.java | 4 +- .../plugins/slayer/SlayerXpDropLookup.java | 8 +- .../theatre/rooms/nylocas/NyloOverlay.java | 2 + .../theatre/rooms/xarpus/XarpusCounter.java | 2 + .../client/util/GameEventManager.java | 22 ++--- .../attackstyles/AttackStylesPluginTest.java | 6 +- .../plugins/cerberus/CerberusPluginTest.java | 2 +- .../ChatNotificationsPluginTest.java | 2 +- .../plugins/cooking/CookingPluginTest.java | 2 +- .../plugins/emojis/EmojiPluginTest.java | 8 +- .../idlenotifier/IdleNotifierPluginTest.java | 81 ++++++--------- .../motherlode/MotherlodePluginTest.java | 10 +- .../screenshot/ScreenshotPluginTest.java | 16 +-- .../plugins/slayer/SlayerPluginTest.java | 26 ++--- .../net/runelite/mixins/RSActorMixin.java | 17 ++-- .../net/runelite/mixins/RSClanChatMixin.java | 6 +- .../net/runelite/mixins/RSClientMixin.java | 42 ++++---- .../runelite/mixins/RSFriendSystemMixin.java | 3 +- .../mixins/RSGraphicsObjectMixin.java | 3 +- .../runelite/mixins/RSGroundItemMixin.java | 7 +- .../mixins/RSHealthBarDefinitionMixin.java | 2 +- .../runelite/mixins/RSItemContainerMixin.java | 3 +- .../mixins/RSItemDefinitionMixin.java | 2 +- .../runelite/mixins/RSNPCDefinitionMixin.java | 2 +- .../java/net/runelite/mixins/RSNPCMixin.java | 4 +- .../runelite/mixins/RSProjectileMixin.java | 4 +- .../java/net/runelite/mixins/RSTileMixin.java | 44 ++++----- .../net/runelite/mixins/RSVarcsMixin.java | 8 +- .../net/runelite/mixins/RSWidgetMixin.java | 4 +- .../net/runelite/mixins/RSWorldMixin.java | 3 +- .../net/runelite/mixins/ScriptVMMixin.java | 2 +- .../net/runelite/mixins/SoundEffectMixin.java | 4 +- 120 files changed, 383 insertions(+), 920 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/GraphicID.java b/runelite-api/src/main/java/net/runelite/api/GraphicID.java index 5a6f7054bb..3aa58d8b64 100644 --- a/runelite-api/src/main/java/net/runelite/api/GraphicID.java +++ b/runelite-api/src/main/java/net/runelite/api/GraphicID.java @@ -51,9 +51,10 @@ public class GraphicID public static final int IMBUED_HEART = 1316; public static final int FLYING_FISH = 1387; public static final int OLM_BURN = 1351; + public static final int OLM_LIGHTNING = 1356; public static final int OLM_TELEPORT = 1359; public static final int OLM_HEAL = 1363; public static final int OLM_CRYSTAL = 1447; public static final int XERIC_TELEPORT = 1612; public static final int HYDRA_LIGHTNING = 1666; -} +} \ No newline at end of file diff --git a/runelite-api/src/main/java/net/runelite/api/events/AnimationChanged.java b/runelite-api/src/main/java/net/runelite/api/events/AnimationChanged.java index 9d3bf12a07..0c4e1d5b68 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/AnimationChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/AnimationChanged.java @@ -20,13 +20,6 @@ import net.runelite.api.Actor; @Data public class AnimationChanged { - public static final AnimationChanged INSTANCE = new AnimationChanged(); - - private AnimationChanged() - { - // noop - } - /** * The actor that has entered a new animation. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/AreaSoundEffectPlayed.java b/runelite-api/src/main/java/net/runelite/api/events/AreaSoundEffectPlayed.java index 4fb1a120a6..488bff8264 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/AreaSoundEffectPlayed.java +++ b/runelite-api/src/main/java/net/runelite/api/events/AreaSoundEffectPlayed.java @@ -29,13 +29,6 @@ import lombok.Data; @Data public class AreaSoundEffectPlayed { - public static final AreaSoundEffectPlayed INSTANCE = new AreaSoundEffectPlayed(); - - private AreaSoundEffectPlayed() - { - // noop - } - private int soundId; private int sceneX; private int sceneY; diff --git a/runelite-api/src/main/java/net/runelite/api/events/BeforeMenuRender.java b/runelite-api/src/main/java/net/runelite/api/events/BeforeMenuRender.java index db6d1de3f3..5d1e10994b 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/BeforeMenuRender.java +++ b/runelite-api/src/main/java/net/runelite/api/events/BeforeMenuRender.java @@ -29,13 +29,6 @@ import lombok.Data; @Data public class BeforeMenuRender { - public static final BeforeMenuRender INSTANCE = new BeforeMenuRender(); - - private BeforeMenuRender() - { - // noop - } - private boolean consumed; public void consume() diff --git a/runelite-api/src/main/java/net/runelite/api/events/BeforeRender.java b/runelite-api/src/main/java/net/runelite/api/events/BeforeRender.java index 73c004d4b3..741041e1e0 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/BeforeRender.java +++ b/runelite-api/src/main/java/net/runelite/api/events/BeforeRender.java @@ -29,10 +29,4 @@ package net.runelite.api.events; */ public class BeforeRender { - public static final BeforeRender INSTANCE = new BeforeRender(); - - private BeforeRender() - { - // noop - } } diff --git a/runelite-api/src/main/java/net/runelite/api/events/BoostedLevelChanged.java b/runelite-api/src/main/java/net/runelite/api/events/BoostedLevelChanged.java index e38a043e9a..a465e3b407 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/BoostedLevelChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/BoostedLevelChanged.java @@ -44,13 +44,6 @@ import lombok.Data; @Data public class BoostedLevelChanged { - public static final BoostedLevelChanged INSTANCE = new BoostedLevelChanged(); - - private BoostedLevelChanged() - { - // noop - } - /** * The skill that has had its level modified. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/CannonballFired.java b/runelite-api/src/main/java/net/runelite/api/events/CannonballFired.java index c44789965a..077a88096d 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/CannonballFired.java +++ b/runelite-api/src/main/java/net/runelite/api/events/CannonballFired.java @@ -29,10 +29,4 @@ package net.runelite.api.events; */ public class CannonballFired { - public static final CannonballFired INSTANCE = new CannonballFired(); - - private CannonballFired() - { - // noop - } } diff --git a/runelite-api/src/main/java/net/runelite/api/events/ChatMessage.java b/runelite-api/src/main/java/net/runelite/api/events/ChatMessage.java index 5b464d0807..791ec350b3 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/ChatMessage.java +++ b/runelite-api/src/main/java/net/runelite/api/events/ChatMessage.java @@ -28,6 +28,7 @@ import net.runelite.api.ChatMessageType; import net.runelite.api.MessageNode; import lombok.AllArgsConstructor; import lombok.Data; +import lombok.NoArgsConstructor; /** * An event where a new chat message is received. @@ -39,15 +40,9 @@ import lombok.Data; */ @Data @AllArgsConstructor +@NoArgsConstructor public class ChatMessage { - public static final ChatMessage INSTANCE = new ChatMessage(); - - private ChatMessage() - { - // noop - } - /** * The underlying MessageNode for the message. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/ClanChanged.java b/runelite-api/src/main/java/net/runelite/api/events/ClanChanged.java index de9ae6798e..e39dbc400e 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/ClanChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/ClanChanged.java @@ -24,21 +24,14 @@ */ package net.runelite.api.events; -import lombok.Data; +import lombok.Value; /** * An event where the client has joined or left a clan chat. */ -@Data +@Value public class ClanChanged { - public static final ClanChanged INSTANCE = new ClanChanged(); - - private ClanChanged() - { - // noop - } - /** * Whether or not the client is now in a clan chat. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/ClanMemberJoined.java b/runelite-api/src/main/java/net/runelite/api/events/ClanMemberJoined.java index 81a9a96fd6..c0a694555b 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/ClanMemberJoined.java +++ b/runelite-api/src/main/java/net/runelite/api/events/ClanMemberJoined.java @@ -25,18 +25,11 @@ package net.runelite.api.events; import net.runelite.api.ClanMember; -import lombok.Data; +import lombok.Value; -@Data +@Value public class ClanMemberJoined { - public static final ClanMemberJoined INSTANCE = new ClanMemberJoined(); - - private ClanMemberJoined() - { - // noop - } - /** * The ClanMember that joined */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/ClanMemberLeft.java b/runelite-api/src/main/java/net/runelite/api/events/ClanMemberLeft.java index 75e46e5e1d..c403261532 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/ClanMemberLeft.java +++ b/runelite-api/src/main/java/net/runelite/api/events/ClanMemberLeft.java @@ -25,18 +25,11 @@ package net.runelite.api.events; import net.runelite.api.ClanMember; -import lombok.Data; +import lombok.Value; -@Data +@Value public class ClanMemberLeft { - public static final ClanMemberLeft INSTANCE = new ClanMemberLeft(); - - private ClanMemberLeft() - { - // noop - } - /** * The ClanMember that left */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/ClientTick.java b/runelite-api/src/main/java/net/runelite/api/events/ClientTick.java index 6874f4145c..369ff7982a 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/ClientTick.java +++ b/runelite-api/src/main/java/net/runelite/api/events/ClientTick.java @@ -29,10 +29,4 @@ package net.runelite.api.events; */ public class ClientTick { - public static final ClientTick INSTANCE = new ClientTick(); - - private ClientTick() - { - // noop - } } diff --git a/runelite-api/src/main/java/net/runelite/api/events/CommandExecuted.java b/runelite-api/src/main/java/net/runelite/api/events/CommandExecuted.java index 2f170642e8..d0dfae5ff2 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/CommandExecuted.java +++ b/runelite-api/src/main/java/net/runelite/api/events/CommandExecuted.java @@ -24,7 +24,7 @@ */ package net.runelite.api.events; -import lombok.Data; +import lombok.Value; /** * An event where a command has been used in the chat. @@ -41,16 +41,9 @@ import lombok.Data; * set the command field to an empty string. For example, the message ":: hello world!" * will set command to "" and arguments to ["hello", "world!"]. */ -@Data +@Value public class CommandExecuted { - public static final CommandExecuted INSTANCE = new CommandExecuted(); - - private CommandExecuted() - { - // noop - } - /** * The name of the command entered. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/DecorativeObjectChanged.java b/runelite-api/src/main/java/net/runelite/api/events/DecorativeObjectChanged.java index 161f3c6b19..a18683d7b4 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/DecorativeObjectChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/DecorativeObjectChanged.java @@ -35,13 +35,6 @@ import lombok.Data; @Data public class DecorativeObjectChanged { - public static final DecorativeObjectChanged INSTANCE = new DecorativeObjectChanged(); - - private DecorativeObjectChanged() - { - // noop - } - /** * The affected tile. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/DecorativeObjectDespawned.java b/runelite-api/src/main/java/net/runelite/api/events/DecorativeObjectDespawned.java index efa9f657db..94c06488c7 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/DecorativeObjectDespawned.java +++ b/runelite-api/src/main/java/net/runelite/api/events/DecorativeObjectDespawned.java @@ -35,13 +35,6 @@ import lombok.Data; @Data public class DecorativeObjectDespawned { - public static final DecorativeObjectDespawned INSTANCE = new DecorativeObjectDespawned(); - - private DecorativeObjectDespawned() - { - // noop - } - /** * The affected tile. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/DecorativeObjectSpawned.java b/runelite-api/src/main/java/net/runelite/api/events/DecorativeObjectSpawned.java index a25b493743..fe8d17862f 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/DecorativeObjectSpawned.java +++ b/runelite-api/src/main/java/net/runelite/api/events/DecorativeObjectSpawned.java @@ -34,13 +34,6 @@ import lombok.Data; @Data public class DecorativeObjectSpawned { - public static final DecorativeObjectSpawned INSTANCE = new DecorativeObjectSpawned(); - - private DecorativeObjectSpawned() - { - // noop - } - /** * The affected tile. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/DraggingWidgetChanged.java b/runelite-api/src/main/java/net/runelite/api/events/DraggingWidgetChanged.java index 8f1179f76e..8aef02d570 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/DraggingWidgetChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/DraggingWidgetChanged.java @@ -33,13 +33,6 @@ import lombok.Data; @Data public class DraggingWidgetChanged { - public static final DraggingWidgetChanged INSTANCE = new DraggingWidgetChanged(); - - private DraggingWidgetChanged() - { - // noop - } - /** * Whether a widget is currently being dragged. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/ExperienceChanged.java b/runelite-api/src/main/java/net/runelite/api/events/ExperienceChanged.java index 980fbfcd75..587efd4f41 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/ExperienceChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/ExperienceChanged.java @@ -34,13 +34,6 @@ import lombok.Data; @Data public class ExperienceChanged { - public static final ExperienceChanged INSTANCE = new ExperienceChanged(); - - private ExperienceChanged() - { - // noop - } - /** * The modified skill. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/GameObjectChanged.java b/runelite-api/src/main/java/net/runelite/api/events/GameObjectChanged.java index 5cdba0899c..117ad81f60 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/GameObjectChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/GameObjectChanged.java @@ -34,13 +34,6 @@ import net.runelite.api.Tile; @Data public class GameObjectChanged { - public static final GameObjectChanged INSTANCE = new GameObjectChanged(); - - private GameObjectChanged() - { - // noop - } - /** * The affected tile. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/GameObjectDespawned.java b/runelite-api/src/main/java/net/runelite/api/events/GameObjectDespawned.java index 28091ca793..5d2e9fad1a 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/GameObjectDespawned.java +++ b/runelite-api/src/main/java/net/runelite/api/events/GameObjectDespawned.java @@ -34,13 +34,6 @@ import lombok.Data; @Data public class GameObjectDespawned { - public static final GameObjectDespawned INSTANCE = new GameObjectDespawned(); - - private GameObjectDespawned() - { - // noop - } - /** * The affected tile. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/GameObjectSpawned.java b/runelite-api/src/main/java/net/runelite/api/events/GameObjectSpawned.java index e7965b1164..5dfc301066 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/GameObjectSpawned.java +++ b/runelite-api/src/main/java/net/runelite/api/events/GameObjectSpawned.java @@ -34,13 +34,6 @@ import lombok.Data; @Data public class GameObjectSpawned { - public static final GameObjectSpawned INSTANCE = new GameObjectSpawned(); - - private GameObjectSpawned() - { - // noop - } - /** * The affected tile. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/GameStateChanged.java b/runelite-api/src/main/java/net/runelite/api/events/GameStateChanged.java index f89c8ecb43..2a0b61fc40 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/GameStateChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/GameStateChanged.java @@ -33,13 +33,6 @@ import lombok.Data; @Data public class GameStateChanged { - public static final GameStateChanged INSTANCE = new GameStateChanged(); - - private GameStateChanged() - { - // noop - } - /** * The new game state. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/GameTick.java b/runelite-api/src/main/java/net/runelite/api/events/GameTick.java index 2bf035633d..aefa7fc3e4 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/GameTick.java +++ b/runelite-api/src/main/java/net/runelite/api/events/GameTick.java @@ -24,6 +24,8 @@ */ package net.runelite.api.events; +import lombok.Data; + // The NPC update event seem to run every server tick, // but having the game tick event after all packets // have been processed is typically more useful. @@ -41,12 +43,7 @@ package net.runelite.api.events; * Note that occurrences that take place purely on the client, such as right * click menus, are independent of the game tick. */ +@Data public class GameTick { - public static final GameTick INSTANCE = new GameTick(); - - private GameTick() - { - // noop - } } diff --git a/runelite-api/src/main/java/net/runelite/api/events/GrandExchangeOfferChanged.java b/runelite-api/src/main/java/net/runelite/api/events/GrandExchangeOfferChanged.java index 7a49ee6f8d..7260063760 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/GrandExchangeOfferChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/GrandExchangeOfferChanged.java @@ -44,13 +44,6 @@ import lombok.Data; @Data public class GrandExchangeOfferChanged { - public static final GrandExchangeOfferChanged INSTANCE = new GrandExchangeOfferChanged(); - - private GrandExchangeOfferChanged() - { - // noop - } - /** * The offer that has been modified. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/GraphicsObjectCreated.java b/runelite-api/src/main/java/net/runelite/api/events/GraphicsObjectCreated.java index 4d624e716f..f2cc4f35a9 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/GraphicsObjectCreated.java +++ b/runelite-api/src/main/java/net/runelite/api/events/GraphicsObjectCreated.java @@ -25,24 +25,16 @@ package net.runelite.api.events; import net.runelite.api.GraphicsObject; - -import lombok.Data; +import lombok.Value; /** * An event where a new {@link GraphicsObject} has been created. */ -@Data +@Value public class GraphicsObjectCreated { - public static final GraphicsObjectCreated INSTANCE = new GraphicsObjectCreated(); - - private GraphicsObjectCreated() - { - // noop - } - /** * The newly created graphics object. */ - private GraphicsObject graphicsObject; + private final GraphicsObject graphicsObject; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/GroundObjectChanged.java b/runelite-api/src/main/java/net/runelite/api/events/GroundObjectChanged.java index 836780f6a5..8fa97ae503 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/GroundObjectChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/GroundObjectChanged.java @@ -34,13 +34,6 @@ import lombok.Data; @Data public class GroundObjectChanged { - public static final GroundObjectChanged INSTANCE = new GroundObjectChanged(); - - private GroundObjectChanged() - { - // noop - } - /** * The affected tile. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/GroundObjectDespawned.java b/runelite-api/src/main/java/net/runelite/api/events/GroundObjectDespawned.java index 0ff488f3b4..54bb6dfbe0 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/GroundObjectDespawned.java +++ b/runelite-api/src/main/java/net/runelite/api/events/GroundObjectDespawned.java @@ -34,13 +34,6 @@ import lombok.Data; @Data public class GroundObjectDespawned { - public static final GroundObjectDespawned INSTANCE = new GroundObjectDespawned(); - - private GroundObjectDespawned() - { - // noop - } - /** * The affected tile. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/GroundObjectSpawned.java b/runelite-api/src/main/java/net/runelite/api/events/GroundObjectSpawned.java index 7964707840..af1f15ab6f 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/GroundObjectSpawned.java +++ b/runelite-api/src/main/java/net/runelite/api/events/GroundObjectSpawned.java @@ -34,13 +34,6 @@ import lombok.Data; @Data public class GroundObjectSpawned { - public static final GroundObjectSpawned INSTANCE = new GroundObjectSpawned(); - - private GroundObjectSpawned() - { - // noop - } - /** * The affected tile. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/HitsplatApplied.java b/runelite-api/src/main/java/net/runelite/api/events/HitsplatApplied.java index 3cf8986299..f96a0f08d7 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/HitsplatApplied.java +++ b/runelite-api/src/main/java/net/runelite/api/events/HitsplatApplied.java @@ -38,13 +38,6 @@ import lombok.Data; @Data public class HitsplatApplied { - public static final HitsplatApplied INSTANCE = new HitsplatApplied(); - - private HitsplatApplied() - { - // noop - } - /** * The actor the hitsplat was applied to. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/InteractChanged.java b/runelite-api/src/main/java/net/runelite/api/events/InteractChanged.java index f606eba5d0..fcd2e54a43 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/InteractChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/InteractChanged.java @@ -30,12 +30,5 @@ import lombok.Data; @Data public class InteractChanged { - public static final InteractChanged INSTANCE = new InteractChanged(); - - private InteractChanged() - { - // noop - } - private Actor actor; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/InteractingChanged.java b/runelite-api/src/main/java/net/runelite/api/events/InteractingChanged.java index 4549527b4d..c76abd349f 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/InteractingChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/InteractingChanged.java @@ -1,26 +1,18 @@ package net.runelite.api.events; import net.runelite.api.Actor; - -import lombok.Data; +import lombok.Value; /** * An event called when the actor an actor is interacting with changes */ -@Data +@Value public class InteractingChanged { - public static final InteractingChanged INSTANCE = new InteractingChanged(); - - private InteractingChanged() - { - // noop - } - - private Actor source; + private final Actor source; /** * Target actor, may be null */ - private Actor target; + private final Actor target; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/ItemContainerChanged.java b/runelite-api/src/main/java/net/runelite/api/events/ItemContainerChanged.java index e68ad8fb44..ec0ff6627b 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/ItemContainerChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/ItemContainerChanged.java @@ -25,8 +25,7 @@ package net.runelite.api.events; import net.runelite.api.ItemContainer; - -import lombok.Data; +import lombok.Value; /** * An event called whenever the stack size of an {@link api.Item} @@ -39,18 +38,11 @@ import lombok.Data; *

  • Dropping an item
  • * */ -@Data +@Value public class ItemContainerChanged { - public static final ItemContainerChanged INSTANCE = new ItemContainerChanged(); - - private ItemContainerChanged() - { - // noop - } - /** * The modified item container. */ - private ItemContainer itemContainer; + private final ItemContainer itemContainer; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/ItemDespawned.java b/runelite-api/src/main/java/net/runelite/api/events/ItemDespawned.java index 1c22d7ce59..aeb90ede92 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/ItemDespawned.java +++ b/runelite-api/src/main/java/net/runelite/api/events/ItemDespawned.java @@ -26,23 +26,15 @@ package net.runelite.api.events; import net.runelite.api.Item; import net.runelite.api.Tile; - -import lombok.Data; +import lombok.Value; /** * Called when an item pile despawns from the ground. When the client loads a new scene, * all item piles are implicitly despawned, and despawn events will not be sent. */ -@Data +@Value public class ItemDespawned { - public static final ItemDespawned INSTANCE = new ItemDespawned(); - - private ItemDespawned() - { - // noop - } - - private Tile tile; - private Item item; + private final Tile tile; + private final Item item; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/ItemQuantityChanged.java b/runelite-api/src/main/java/net/runelite/api/events/ItemQuantityChanged.java index ee273f407d..2cb1048f06 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/ItemQuantityChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/ItemQuantityChanged.java @@ -26,23 +26,16 @@ package net.runelite.api.events; import net.runelite.api.Item; import net.runelite.api.Tile; -import lombok.Data; +import lombok.Value; /** * Called when the quantity of an item pile changes. */ -@Data +@Value public class ItemQuantityChanged { - public static final ItemQuantityChanged INSTANCE = new ItemQuantityChanged(); - - private ItemQuantityChanged() - { - // noop - } - - private Item item; - private Tile tile; - private int oldQuantity; - private int newQuantity; + private final Item item; + private final Tile tile; + private final int oldQuantity; + private final int newQuantity; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/ItemSpawned.java b/runelite-api/src/main/java/net/runelite/api/events/ItemSpawned.java index aae38645c2..eb41b3e530 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/ItemSpawned.java +++ b/runelite-api/src/main/java/net/runelite/api/events/ItemSpawned.java @@ -26,22 +26,15 @@ package net.runelite.api.events; import net.runelite.api.Item; import net.runelite.api.Tile; -import lombok.Data; +import lombok.Value; /** * Called when an item pile spawns on the ground. When the client loads a new scene, * all item piles are implicitly reset and a new spawn event will be sent. */ -@Data +@Value public class ItemSpawned { - public static final ItemSpawned INSTANCE = new ItemSpawned(); - - private ItemSpawned() - { - // noop - } - - private Tile tile; - private Item item; + private final Tile tile; + private final Item item; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/LocalPlayerDeath.java b/runelite-api/src/main/java/net/runelite/api/events/LocalPlayerDeath.java index 0cf8f33c76..e46b815f49 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/LocalPlayerDeath.java +++ b/runelite-api/src/main/java/net/runelite/api/events/LocalPlayerDeath.java @@ -29,10 +29,4 @@ package net.runelite.api.events; */ public class LocalPlayerDeath { - public static final LocalPlayerDeath INSTANCE = new LocalPlayerDeath(); - - private LocalPlayerDeath() - { - // noop - } } diff --git a/runelite-api/src/main/java/net/runelite/api/events/MenuEntryAdded.java b/runelite-api/src/main/java/net/runelite/api/events/MenuEntryAdded.java index 0f1cafcf15..37f73ec792 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/MenuEntryAdded.java +++ b/runelite-api/src/main/java/net/runelite/api/events/MenuEntryAdded.java @@ -35,17 +35,10 @@ import net.runelite.api.MenuEntry; @AllArgsConstructor public class MenuEntryAdded { - public static final MenuEntryAdded INSTANCE = new MenuEntryAdded(); - - private MenuEntryAdded() - { - // noop - } - /** * The MenuEntry object that was actually added */ - private MenuEntry menuEntry; + private final MenuEntry menuEntry; public String getOption() { diff --git a/runelite-api/src/main/java/net/runelite/api/events/MenuOpened.java b/runelite-api/src/main/java/net/runelite/api/events/MenuOpened.java index 634d8f46f3..3a7b04c287 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/MenuOpened.java +++ b/runelite-api/src/main/java/net/runelite/api/events/MenuOpened.java @@ -33,13 +33,6 @@ import lombok.Data; @Data public class MenuOpened { - public static final MenuOpened INSTANCE = new MenuOpened(); - - private MenuOpened() - { - // noop - } - /** * The menu entries in the newly opened menu. *

    diff --git a/runelite-api/src/main/java/net/runelite/api/events/MenuOptionClicked.java b/runelite-api/src/main/java/net/runelite/api/events/MenuOptionClicked.java index 770fb6966e..2180458228 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/MenuOptionClicked.java +++ b/runelite-api/src/main/java/net/runelite/api/events/MenuOptionClicked.java @@ -42,13 +42,6 @@ import net.runelite.api.MenuEntry; @Data public class MenuOptionClicked { - public static final MenuOptionClicked INSTANCE = new MenuOptionClicked(); - - private MenuOptionClicked() - { - // noop - } - public MenuOptionClicked(MenuEntry entry) { menuEntry = entry; diff --git a/runelite-api/src/main/java/net/runelite/api/events/MenuShouldLeftClick.java b/runelite-api/src/main/java/net/runelite/api/events/MenuShouldLeftClick.java index 85561790ab..c36372ff2c 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/MenuShouldLeftClick.java +++ b/runelite-api/src/main/java/net/runelite/api/events/MenuShouldLeftClick.java @@ -33,13 +33,6 @@ import lombok.Data; @Data public class MenuShouldLeftClick { - public static final MenuShouldLeftClick INSTANCE = new MenuShouldLeftClick(); - - private MenuShouldLeftClick() - { - // noop - } - /** * If set to true, the menu will open on left click. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/NameableNameChanged.java b/runelite-api/src/main/java/net/runelite/api/events/NameableNameChanged.java index 839f81dcec..afcc43973d 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/NameableNameChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/NameableNameChanged.java @@ -25,23 +25,16 @@ package net.runelite.api.events; import net.runelite.api.Nameable; -import lombok.Data; +import lombok.Value; /** * An event where a {@link Nameable} has had their name changed. */ -@Data +@Value public class NameableNameChanged { - public static final NameableNameChanged INSTANCE = new NameableNameChanged(); - - private NameableNameChanged() - { - // noop - } - /** * The nameable that changed names. */ - private Nameable nameable; + private final Nameable nameable; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/NpcActionChanged.java b/runelite-api/src/main/java/net/runelite/api/events/NpcActionChanged.java index f5906ad03f..35838e067c 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/NpcActionChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/NpcActionChanged.java @@ -33,13 +33,6 @@ import net.runelite.api.NPCDefinition; @Data public class NpcActionChanged { - public static final NpcActionChanged INSTANCE = new NpcActionChanged(); - - private NpcActionChanged() - { - // noop - } - /** * The NPC composition that has been changed. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/NpcDespawned.java b/runelite-api/src/main/java/net/runelite/api/events/NpcDespawned.java index f5b20af29e..f1bc72344f 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/NpcDespawned.java +++ b/runelite-api/src/main/java/net/runelite/api/events/NpcDespawned.java @@ -26,25 +26,18 @@ package net.runelite.api.events; import net.runelite.api.Actor; import net.runelite.api.NPC; -import lombok.Data; +import lombok.Value; /** * An event where an {@link NPC} has despawned. */ -@Data +@Value public class NpcDespawned { - public static final NpcDespawned INSTANCE = new NpcDespawned(); - - private NpcDespawned() - { - // noop - } - /** * The despawned NPC. */ - private NPC npc; + private final NPC npc; public Actor getActor() { diff --git a/runelite-api/src/main/java/net/runelite/api/events/NpcSpawned.java b/runelite-api/src/main/java/net/runelite/api/events/NpcSpawned.java index 226fa9918b..911d3780c1 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/NpcSpawned.java +++ b/runelite-api/src/main/java/net/runelite/api/events/NpcSpawned.java @@ -26,25 +26,18 @@ package net.runelite.api.events; import net.runelite.api.Actor; import net.runelite.api.NPC; -import lombok.Data; +import lombok.Value; /** * An event where an {@link NPC} has spawned. */ -@Data +@Value public class NpcSpawned { - public static final NpcSpawned INSTANCE = new NpcSpawned(); - - private NpcSpawned() - { - // noop - } - /** * The spawned NPC. */ - private NPC npc; + private final NPC npc; public Actor getActor() { diff --git a/runelite-api/src/main/java/net/runelite/api/events/OverheadTextChanged.java b/runelite-api/src/main/java/net/runelite/api/events/OverheadTextChanged.java index 242c2c07c5..a8a22730fd 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/OverheadTextChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/OverheadTextChanged.java @@ -1,19 +1,12 @@ package net.runelite.api.events; import net.runelite.api.Actor; -import lombok.Data; +import lombok.Value; -@Data +@Value public class OverheadTextChanged { - public static final OverheadTextChanged INSTANCE = new OverheadTextChanged(); + private final Actor actor; - private OverheadTextChanged() - { - // noop - } - - private Actor actor; - - private String overheadText; + private final String overheadText; } \ No newline at end of file diff --git a/runelite-api/src/main/java/net/runelite/api/events/PlayerDespawned.java b/runelite-api/src/main/java/net/runelite/api/events/PlayerDespawned.java index 3740d6179d..7094f3bd1a 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/PlayerDespawned.java +++ b/runelite-api/src/main/java/net/runelite/api/events/PlayerDespawned.java @@ -26,27 +26,20 @@ package net.runelite.api.events; import net.runelite.api.Actor; import net.runelite.api.Player; -import lombok.Data; +import lombok.Value; /** * An event where a {@link Player} has despawned. *

    * Note: This event does not get called for the local player. */ -@Data +@Value public class PlayerDespawned { - public static final PlayerDespawned INSTANCE = new PlayerDespawned(); - - private PlayerDespawned() - { - // noop - } - /** * The despawned player. */ - private Player player; + private final Player player; public Actor getActor() { diff --git a/runelite-api/src/main/java/net/runelite/api/events/PlayerMenuOptionClicked.java b/runelite-api/src/main/java/net/runelite/api/events/PlayerMenuOptionClicked.java index b085b0e5bb..dcfb0421ca 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/PlayerMenuOptionClicked.java +++ b/runelite-api/src/main/java/net/runelite/api/events/PlayerMenuOptionClicked.java @@ -33,13 +33,6 @@ import lombok.Data; @Data public class PlayerMenuOptionClicked { - public static final PlayerMenuOptionClicked INSTANCE = new PlayerMenuOptionClicked(); - - private PlayerMenuOptionClicked() - { - // noop - } - /** * The menu option clicked. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/PlayerMenuOptionsChanged.java b/runelite-api/src/main/java/net/runelite/api/events/PlayerMenuOptionsChanged.java index 4ce089baed..d33aa4d06c 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/PlayerMenuOptionsChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/PlayerMenuOptionsChanged.java @@ -29,13 +29,6 @@ import lombok.Data; @Data public class PlayerMenuOptionsChanged { - public static final PlayerMenuOptionsChanged INSTANCE = new PlayerMenuOptionsChanged(); - - private PlayerMenuOptionsChanged() - { - // noop - } - /** * Index in playerOptions which changed. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/PlayerSpawned.java b/runelite-api/src/main/java/net/runelite/api/events/PlayerSpawned.java index aafcf5ec01..31cc16a9c0 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/PlayerSpawned.java +++ b/runelite-api/src/main/java/net/runelite/api/events/PlayerSpawned.java @@ -26,25 +26,18 @@ package net.runelite.api.events; import net.runelite.api.Actor; import net.runelite.api.Player; -import lombok.Data; +import lombok.Value; /** * An event where a {@link Player} has spawned. */ -@Data +@Value public class PlayerSpawned { - public static final PlayerSpawned INSTANCE = new PlayerSpawned(); - - private PlayerSpawned() - { - // noop - } - /** * The spawned player. */ - private Player player; + private final Player player; public Actor getActor() { diff --git a/runelite-api/src/main/java/net/runelite/api/events/PostHealthBar.java b/runelite-api/src/main/java/net/runelite/api/events/PostHealthBar.java index 5f0f7addee..c8896ff945 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/PostHealthBar.java +++ b/runelite-api/src/main/java/net/runelite/api/events/PostHealthBar.java @@ -30,12 +30,5 @@ import lombok.Data; @Data public class PostHealthBar { - public static final PostHealthBar INSTANCE = new PostHealthBar(); - - private PostHealthBar() - { - // noop - } - private HealthBar healthBar; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/PostItemDefinition.java b/runelite-api/src/main/java/net/runelite/api/events/PostItemDefinition.java index 66b4dbb7ce..35718b5ea9 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/PostItemDefinition.java +++ b/runelite-api/src/main/java/net/runelite/api/events/PostItemDefinition.java @@ -34,13 +34,6 @@ import net.runelite.api.ItemDefinition; @Data public class PostItemDefinition { - public static final PostItemDefinition INSTANCE = new PostItemDefinition(); - - private PostItemDefinition() - { - // noop - } - /** * The newly created item. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/ProjectileMoved.java b/runelite-api/src/main/java/net/runelite/api/events/ProjectileMoved.java index 4deb6879bc..70d73d7026 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/ProjectileMoved.java +++ b/runelite-api/src/main/java/net/runelite/api/events/ProjectileMoved.java @@ -37,13 +37,6 @@ import lombok.Data; @Data public class ProjectileMoved { - public static final ProjectileMoved INSTANCE = new ProjectileMoved(); - - private ProjectileMoved() - { - // noop - } - /** * The projectile being moved. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/ProjectileSpawned.java b/runelite-api/src/main/java/net/runelite/api/events/ProjectileSpawned.java index d415e3b850..f5ba810a5f 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/ProjectileSpawned.java +++ b/runelite-api/src/main/java/net/runelite/api/events/ProjectileSpawned.java @@ -34,13 +34,6 @@ import lombok.Data; @Data public class ProjectileSpawned { - public static final ProjectileSpawned INSTANCE = new ProjectileSpawned(); - - private ProjectileSpawned() - { - // noop - } - /** * The spawned projectile. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/RemovedFriend.java b/runelite-api/src/main/java/net/runelite/api/events/RemovedFriend.java index e8e7f24511..c60cd13c33 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/RemovedFriend.java +++ b/runelite-api/src/main/java/net/runelite/api/events/RemovedFriend.java @@ -24,23 +24,16 @@ */ package net.runelite.api.events; -import lombok.Data; +import lombok.Value; /** * An event where a request to remove a friend is sent to the server. */ -@Data +@Value public class RemovedFriend { - public static final RemovedFriend INSTANCE = new RemovedFriend(); - - private RemovedFriend() - { - // noop - } - /** * The name of the removed friend. */ - private String name; + private final String name; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/ResizeableChanged.java b/runelite-api/src/main/java/net/runelite/api/events/ResizeableChanged.java index 084d0eb0f6..146f92ac38 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/ResizeableChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/ResizeableChanged.java @@ -34,13 +34,6 @@ import lombok.Data; @Data public class ResizeableChanged { - public static final ResizeableChanged INSTANCE = new ResizeableChanged(); - - private ResizeableChanged() - { - // noop - } - /** * Whether the game is in resizable mode. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/ScriptCallbackEvent.java b/runelite-api/src/main/java/net/runelite/api/events/ScriptCallbackEvent.java index fc36c9ae4d..0c1bdd5ee9 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/ScriptCallbackEvent.java +++ b/runelite-api/src/main/java/net/runelite/api/events/ScriptCallbackEvent.java @@ -33,13 +33,6 @@ import lombok.Data; @Data public class ScriptCallbackEvent { - public static final ScriptCallbackEvent INSTANCE = new ScriptCallbackEvent(); - - private ScriptCallbackEvent() - { - // noop - } - /** * The script being called. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/SoundEffectPlayed.java b/runelite-api/src/main/java/net/runelite/api/events/SoundEffectPlayed.java index 049229c6e4..127a9a2646 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/SoundEffectPlayed.java +++ b/runelite-api/src/main/java/net/runelite/api/events/SoundEffectPlayed.java @@ -29,13 +29,6 @@ import lombok.Data; @Data public class SoundEffectPlayed { - public static final SoundEffectPlayed INSTANCE = new SoundEffectPlayed(); - - private SoundEffectPlayed() - { - // noop - } - private int soundId; private int delay; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/SpotAnimationChanged.java b/runelite-api/src/main/java/net/runelite/api/events/SpotAnimationChanged.java index 6bfe72baec..79b8643d2c 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/SpotAnimationChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/SpotAnimationChanged.java @@ -21,13 +21,6 @@ import net.runelite.api.Actor; @Data public class SpotAnimationChanged { - public static final SpotAnimationChanged INSTANCE = new SpotAnimationChanged(); - - private SpotAnimationChanged() - { - // noop - } - /** * The actor that has had their graphic changed. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/UsernameChanged.java b/runelite-api/src/main/java/net/runelite/api/events/UsernameChanged.java index 3dea001150..91bed8a304 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/UsernameChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/UsernameChanged.java @@ -32,10 +32,4 @@ package net.runelite.api.events; */ public class UsernameChanged { - public static final UsernameChanged INSTANCE = new UsernameChanged(); - - private UsernameChanged() - { - // noop - } } diff --git a/runelite-api/src/main/java/net/runelite/api/events/VarClientIntChanged.java b/runelite-api/src/main/java/net/runelite/api/events/VarClientIntChanged.java index ab9892b6de..82c2c404d4 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/VarClientIntChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/VarClientIntChanged.java @@ -25,20 +25,13 @@ */ package net.runelite.api.events; -import lombok.Data; +import lombok.Value; /** * An event where a varbit integer has changed. */ -@Data +@Value public class VarClientIntChanged { - public static final VarClientIntChanged INSTANCE = new VarClientIntChanged(); - - private VarClientIntChanged() - { - // noop - } - private int index; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/VarClientStrChanged.java b/runelite-api/src/main/java/net/runelite/api/events/VarClientStrChanged.java index 7aca876b72..e1d7da6ffa 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/VarClientStrChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/VarClientStrChanged.java @@ -25,20 +25,13 @@ */ package net.runelite.api.events; -import lombok.Data; +import lombok.Value; /** * An event where a varbit string has changed. */ -@Data +@Value public class VarClientStrChanged { - public static final VarClientStrChanged INSTANCE = new VarClientStrChanged(); - - private VarClientStrChanged() - { - // noop - } - private int index; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/VarbitChanged.java b/runelite-api/src/main/java/net/runelite/api/events/VarbitChanged.java index 04b8a30ab3..9680e54ac4 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/VarbitChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/VarbitChanged.java @@ -34,13 +34,6 @@ import lombok.Data; @Data public class VarbitChanged { - public static final VarbitChanged INSTANCE = new VarbitChanged(); - - private VarbitChanged() - { - // noop - } - /** * Index in the varp array that was changed. * For varplayer, this is the varplayer id. diff --git a/runelite-api/src/main/java/net/runelite/api/events/WallObjectChanged.java b/runelite-api/src/main/java/net/runelite/api/events/WallObjectChanged.java index 59ccec9a72..bea7686602 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/WallObjectChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/WallObjectChanged.java @@ -34,13 +34,6 @@ import lombok.Data; @Data public class WallObjectChanged { - public static final WallObjectChanged INSTANCE = new WallObjectChanged(); - - private WallObjectChanged() - { - // noop - } - /** * The affected tile. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/WallObjectDespawned.java b/runelite-api/src/main/java/net/runelite/api/events/WallObjectDespawned.java index 6c34cbc9ac..6ac609a46f 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/WallObjectDespawned.java +++ b/runelite-api/src/main/java/net/runelite/api/events/WallObjectDespawned.java @@ -34,13 +34,6 @@ import lombok.Data; @Data public class WallObjectDespawned { - public static final WallObjectDespawned INSTANCE = new WallObjectDespawned(); - - private WallObjectDespawned() - { - // noop - } - /** * The affected tile. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/WallObjectSpawned.java b/runelite-api/src/main/java/net/runelite/api/events/WallObjectSpawned.java index babf7d50b8..dc22e07f7d 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/WallObjectSpawned.java +++ b/runelite-api/src/main/java/net/runelite/api/events/WallObjectSpawned.java @@ -34,13 +34,6 @@ import lombok.Data; @Data public class WallObjectSpawned { - public static final WallObjectSpawned INSTANCE = new WallObjectSpawned(); - - private WallObjectSpawned() - { - // noop - } - /** * The affected tile. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/WidgetHiddenChanged.java b/runelite-api/src/main/java/net/runelite/api/events/WidgetHiddenChanged.java index 91883db505..2cf434faa4 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/WidgetHiddenChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/WidgetHiddenChanged.java @@ -33,13 +33,6 @@ import lombok.Data; @Data public class WidgetHiddenChanged { - public static final WidgetHiddenChanged INSTANCE = new WidgetHiddenChanged(); - - private WidgetHiddenChanged() - { - // noop - } - /** * The affected widget. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/WidgetLoaded.java b/runelite-api/src/main/java/net/runelite/api/events/WidgetLoaded.java index bf9c258412..c71bc41634 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/WidgetLoaded.java +++ b/runelite-api/src/main/java/net/runelite/api/events/WidgetLoaded.java @@ -32,13 +32,6 @@ import lombok.Data; @Data public class WidgetLoaded { - public static final WidgetLoaded INSTANCE = new WidgetLoaded(); - - private WidgetLoaded() - { - // noop - } - /** * The group ID of the loaded widget. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/WidgetMenuOptionClicked.java b/runelite-api/src/main/java/net/runelite/api/events/WidgetMenuOptionClicked.java index abe0962d8e..6945e88790 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/WidgetMenuOptionClicked.java +++ b/runelite-api/src/main/java/net/runelite/api/events/WidgetMenuOptionClicked.java @@ -33,13 +33,6 @@ import lombok.Data; @Data public class WidgetMenuOptionClicked { - public static final WidgetMenuOptionClicked INSTANCE = new WidgetMenuOptionClicked(); - - private WidgetMenuOptionClicked() - { - // noop - } - /** * The clicked menu option. */ diff --git a/runelite-api/src/main/java/net/runelite/api/events/WidgetPositioned.java b/runelite-api/src/main/java/net/runelite/api/events/WidgetPositioned.java index 6f58e9fe07..d5479e3485 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/WidgetPositioned.java +++ b/runelite-api/src/main/java/net/runelite/api/events/WidgetPositioned.java @@ -24,16 +24,13 @@ */ package net.runelite.api.events; +import lombok.Value; + /** * An event where the position of a {@link net.runelite.api.widgets.Widget} * relative to its parent has changed. */ +@Value public class WidgetPositioned { - public static final WidgetPositioned INSTANCE = new WidgetPositioned(); - - private WidgetPositioned() - { - // noop - } } diff --git a/runelite-api/src/main/java/net/runelite/api/events/WorldListLoad.java b/runelite-api/src/main/java/net/runelite/api/events/WorldListLoad.java index f060a50139..67fa28797e 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/WorldListLoad.java +++ b/runelite-api/src/main/java/net/runelite/api/events/WorldListLoad.java @@ -25,20 +25,13 @@ package net.runelite.api.events; import net.runelite.api.World; -import lombok.Data; +import lombok.Value; /** * Event when the world list is loaded for the world switcher */ -@Data +@Value public class WorldListLoad { - public static final WorldListLoad INSTANCE = new WorldListLoad(); - - private WorldListLoad() - { - // noop - } - - private World[] worlds; + private final World[] worlds; } diff --git a/runelite-client/src/main/java/net/runelite/client/callback/Hooks.java b/runelite-client/src/main/java/net/runelite/client/callback/Hooks.java index df29fd2c04..ca25fa84a8 100644 --- a/runelite-client/src/main/java/net/runelite/client/callback/Hooks.java +++ b/runelite-client/src/main/java/net/runelite/client/callback/Hooks.java @@ -87,6 +87,9 @@ public class Hooks implements Callbacks private static final OverlayRenderer renderer = injector.getInstance(OverlayRenderer.class); private static final OverlayManager overlayManager = injector.getInstance(OverlayManager.class); + private static final GameTick GAME_TICK = new GameTick(); + private static final BeforeRender BEFORE_RENDER = new BeforeRender(); + @Inject private EventBus eventBus; @@ -148,13 +151,13 @@ public class Hooks implements Callbacks deferredEventBus.replay(); - eventBus.post(GameTick.INSTANCE); + eventBus.post(GAME_TICK); int tick = client.getTickCount(); client.setTickCount(tick + 1); } - eventBus.post(BeforeRender.INSTANCE); + eventBus.post(BEFORE_RENDER); clientThread.invoke(); @@ -508,7 +511,7 @@ public class Hooks implements Callbacks public static boolean drawMenu() { - BeforeMenuRender event = BeforeMenuRender.INSTANCE; + BeforeMenuRender event = new BeforeMenuRender(); client.getCallbacks().post(event); return event.isConsumed(); } diff --git a/runelite-client/src/main/java/net/runelite/client/chat/CommandManager.java b/runelite-client/src/main/java/net/runelite/client/chat/CommandManager.java index cf5292991e..7529fc6d56 100644 --- a/runelite-client/src/main/java/net/runelite/client/chat/CommandManager.java +++ b/runelite-client/src/main/java/net/runelite/client/chat/CommandManager.java @@ -114,9 +114,7 @@ public class CommandManager String command = split[0]; String[] args = Arrays.copyOfRange(split, 1, split.length); - CommandExecuted commandExecuted = CommandExecuted.INSTANCE; - commandExecuted.setCommand(command); - commandExecuted.setArguments(args); + CommandExecuted commandExecuted = new CommandExecuted(command, args); eventBus.post(commandExecuted); } diff --git a/runelite-client/src/main/java/net/runelite/client/menus/MenuManager.java b/runelite-client/src/main/java/net/runelite/client/menus/MenuManager.java index c723bfa326..6c674c1d14 100644 --- a/runelite-client/src/main/java/net/runelite/client/menus/MenuManager.java +++ b/runelite-client/src/main/java/net/runelite/client/menus/MenuManager.java @@ -429,7 +429,7 @@ public class MenuManager if (curMenuOption.getMenuTarget().equals(event.getTarget()) && curMenuOption.getMenuOption().equals(event.getOption())) { - WidgetMenuOptionClicked customMenu = WidgetMenuOptionClicked.INSTANCE; + WidgetMenuOptionClicked customMenu = new WidgetMenuOptionClicked(); customMenu.setMenuOption(event.getOption()); customMenu.setMenuTarget(event.getTarget()); customMenu.setWidget(curMenuOption.getWidget()); @@ -444,7 +444,7 @@ public class MenuManager // username (level-42) or username String username = Text.removeTags(target).split("[(]")[0].trim(); - PlayerMenuOptionClicked playerMenuOptionClicked = PlayerMenuOptionClicked.INSTANCE; + PlayerMenuOptionClicked playerMenuOptionClicked = new PlayerMenuOptionClicked(); playerMenuOptionClicked.setMenuOption(event.getOption()); playerMenuOptionClicked.setMenuTarget(username); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeWarningOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeWarningOverlay.java index 179c9b8c02..48491da688 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeWarningOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeWarningOverlay.java @@ -27,10 +27,8 @@ */ package net.runelite.client.plugins.aoewarnings; -import java.awt.BasicStroke; import java.awt.Color; import java.awt.Dimension; -import java.awt.Font; import java.awt.Graphics2D; import java.awt.Polygon; import java.awt.Rectangle; @@ -38,13 +36,11 @@ import java.time.Duration; import java.time.Instant; import java.util.Iterator; import java.util.Map; -import javax.annotation.Nullable; import javax.inject.Inject; import net.runelite.api.Client; import net.runelite.api.Perspective; import net.runelite.api.Point; import net.runelite.api.Projectile; -import net.runelite.api.coords.LocalPoint; import net.runelite.api.coords.WorldPoint; import net.runelite.client.ui.overlay.Overlay; import net.runelite.client.ui.overlay.OverlayLayer; @@ -62,7 +58,7 @@ public class AoeWarningOverlay extends Overlay private final AoeWarningConfig config; @Inject - public AoeWarningOverlay(@Nullable Client client, AoeWarningPlugin plugin, AoeWarningConfig config) + public AoeWarningOverlay(Client client, AoeWarningPlugin plugin, AoeWarningConfig config) { setPosition(OverlayPosition.DYNAMIC); setLayer(OverlayLayer.UNDER_WIDGETS); @@ -74,24 +70,25 @@ public class AoeWarningOverlay extends Overlay @Override public Dimension render(Graphics2D graphics) { + WorldPoint lp = client.getLocalPlayer().getWorldLocation(); for (WorldPoint point : plugin.getLightningTrail()) { - drawTile(graphics, point, new Color(0, 150, 200), 2, 150, 50); + OverlayUtil.drawTile(graphics, client, point, lp, new Color(0, 150, 200), 2, 150, 50); } for (WorldPoint point : plugin.getAcidTrail()) { - drawTile(graphics, point, new Color(69, 241, 44), 2, 150, 50); + OverlayUtil.drawTile(graphics, client, point, lp, new Color(69, 241, 44), 2, 150, 50); } for (WorldPoint point : plugin.getCrystalSpike()) { - drawTile(graphics, point, new Color(255, 0, 84), 2, 150, 50); + OverlayUtil.drawTile(graphics, client, point, lp, new Color(255, 0, 84), 2, 150, 50); } for (WorldPoint point : plugin.getWintertodtSnowFall()) { - drawTile(graphics, point, new Color(255, 0, 84), 2, 150, 50); + OverlayUtil.drawTile(graphics, client, point, lp, new Color(255, 0, 84), 2, 150, 50); } Instant now = Instant.now(); @@ -164,7 +161,8 @@ public class AoeWarningOverlay extends Overlay { if (tickProgress >= 0) { - renderTextLocation(graphics, Integer.toString(tickProgress), config.textSize(), config.fontStyle().getFont(), color, centerPoint(tilePoly.getBounds())); + OverlayUtil.renderTextLocation(graphics, Integer.toString(tickProgress), plugin.getTextSize(), + plugin.getFontStyle(), color, centerPoint(tilePoly.getBounds()), plugin.isShadows(), 0); } } graphics.setColor(new Color(setAlphaComponent(config.overlayColor().getRGB(), fillAlpha), true)); @@ -173,50 +171,6 @@ public class AoeWarningOverlay extends Overlay return null; } - private void drawTile(Graphics2D graphics, WorldPoint point, Color color, int strokeWidth, int outlineAlpha, int fillAlpha) - { - WorldPoint playerLocation = client.getLocalPlayer().getWorldLocation(); - if (point.distanceTo(playerLocation) >= 32) - { - return; - } - LocalPoint lp = LocalPoint.fromWorld(client, point); - if (lp == null) - { - return; - } - - Polygon poly = Perspective.getCanvasTilePoly(client, lp); - if (poly == null) - { - return; - } - graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), outlineAlpha)); - graphics.setStroke(new BasicStroke(strokeWidth)); - graphics.draw(poly); - graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), fillAlpha)); - graphics.fill(poly); - } - - private void renderTextLocation(Graphics2D graphics, String txtString, int fontSize, int fontStyle, Color fontColor, Point canvasPoint) - { - graphics.setFont(new Font("Arial", fontStyle, fontSize)); - if (canvasPoint != null) - { - final Point canvasCenterPoint = new Point( - canvasPoint.getX(), - canvasPoint.getY()); - final Point canvasCenterPoint_shadow = new Point( - canvasPoint.getX() + 1, - canvasPoint.getY() + 1); - if (config.shadows()) - { - OverlayUtil.renderTextLocation(graphics, canvasCenterPoint_shadow, txtString, Color.BLACK); - } - OverlayUtil.renderTextLocation(graphics, canvasCenterPoint, txtString, fontColor); - } - } - private Point centerPoint(Rectangle rect) { int x = (int) (rect.getX() + rect.getWidth() / 2); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeWarningPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeWarningPlugin.java index 37375941d6..00ed024a44 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeWarningPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeWarningPlugin.java @@ -41,6 +41,7 @@ import lombok.extern.slf4j.Slf4j; import net.runelite.api.Client; import net.runelite.api.GameObject; import net.runelite.api.GameState; +import net.runelite.api.GraphicID; import net.runelite.api.GraphicsObject; import net.runelite.api.NullObjectID; import net.runelite.api.ObjectID; @@ -48,6 +49,7 @@ import net.runelite.api.Projectile; import net.runelite.api.Tile; import net.runelite.api.coords.LocalPoint; import net.runelite.api.coords.WorldPoint; +import net.runelite.api.events.ConfigChanged; import net.runelite.api.events.GameObjectDespawned; import net.runelite.api.events.GameObjectSpawned; import net.runelite.api.events.GameStateChanged; @@ -72,40 +74,35 @@ import net.runelite.client.ui.overlay.OverlayManager; @Slf4j public class AoeWarningPlugin extends Plugin { - @Getter private final Map bombs = new HashMap<>(); private final Map projectiles = new HashMap<>(); - @Inject public AoeWarningConfig config; - @Inject private Notifier notifier; - @Inject private OverlayManager overlayManager; - @Inject private AoeWarningOverlay coreOverlay; - @Inject private BombOverlay bombOverlay; - @Inject private Client client; - @Getter(AccessLevel.PACKAGE) private List LightningTrail = new ArrayList<>(); - @Getter(AccessLevel.PACKAGE) private List AcidTrail = new ArrayList<>(); - @Getter(AccessLevel.PACKAGE) private List CrystalSpike = new ArrayList<>(); - @Getter(AccessLevel.PACKAGE) private List WintertodtSnowFall = new ArrayList<>(); + @Getter(AccessLevel.PACKAGE) + private boolean shadows; + @Getter(AccessLevel.PACKAGE) + private int textSize; + @Getter(AccessLevel.PACKAGE) + private int fontStyle; @Provides AoeWarningConfig getConfig(ConfigManager configManager) @@ -123,10 +120,7 @@ public class AoeWarningPlugin extends Plugin { overlayManager.add(coreOverlay); overlayManager.add(bombOverlay); - LightningTrail.clear(); - AcidTrail.clear(); - CrystalSpike.clear(); - WintertodtSnowFall.clear(); + reset(true); } @Override @@ -134,10 +128,29 @@ public class AoeWarningPlugin extends Plugin { overlayManager.remove(coreOverlay); overlayManager.remove(bombOverlay); - LightningTrail.clear(); - AcidTrail.clear(); - CrystalSpike.clear(); - WintertodtSnowFall.clear(); + reset(false); + } + + @Subscribe + public void onConfigChanged(ConfigChanged event) + { + if (!event.getGroup().equals("aoe")) + { + return; + } + + switch (event.getKey()) + { + case "fontStyle": + fontStyle = config.fontStyle().getFont(); + break; + case "textSize": + textSize = config.textSize(); + break; + case "shadows": + shadows = config.shadows(); + break; + } } @Subscribe @@ -172,12 +185,12 @@ public class AoeWarningPlugin extends Plugin public void onGameObjectSpawned(GameObjectSpawned event) { final GameObject gameObject = event.getGameObject(); - final WorldPoint bombLocation = gameObject.getWorldLocation(); + final WorldPoint wp = gameObject.getWorldLocation(); switch (gameObject.getId()) { case ObjectID.CRYSTAL_BOMB: - bombs.put(bombLocation, new CrystalBomb(gameObject, client.getTickCount())); + bombs.put(wp, new CrystalBomb(gameObject, client.getTickCount())); if (config.aoeNotifyAll() || config.bombDisplayNotifyEnabled()) { @@ -185,17 +198,16 @@ public class AoeWarningPlugin extends Plugin } break; case ObjectID.ACID_POOL: - AcidTrail.add(bombLocation); + AcidTrail.add(wp); break; case ObjectID.SMALL_CRYSTALS: - //todo - CrystalSpike.add(bombLocation); + CrystalSpike.add(wp); break; case NullObjectID.NULL_26690: //Wintertodt Snowfall if (config.isWintertodtEnabled()) { - WintertodtSnowFall.add(bombLocation); + WintertodtSnowFall.add(wp); if (config.aoeNotifyAll() || config.isWintertodtNotifyEnabled()) { @@ -210,25 +222,23 @@ public class AoeWarningPlugin extends Plugin public void onGameObjectDespawned(GameObjectDespawned event) { GameObject gameObject = event.getGameObject(); - WorldPoint bombLocation = gameObject.getWorldLocation(); + WorldPoint wp = gameObject.getWorldLocation(); switch (gameObject.getId()) { case ObjectID.CRYSTAL_BOMB: - //might as well check the ObjectID to save some time. purgeBombs(bombs); break; case ObjectID.ACID_POOL: - AcidTrail.remove(bombLocation); + AcidTrail.remove(wp); break; case ObjectID.SMALL_CRYSTALS: - //todo - CrystalSpike.remove(bombLocation); + CrystalSpike.remove(wp); break; case NullObjectID.NULL_26690: //Wintertodt Snowfall if (config.isWintertodtEnabled()) { - WintertodtSnowFall.remove(bombLocation); + WintertodtSnowFall.remove(wp); } break; } @@ -251,7 +261,7 @@ public class AoeWarningPlugin extends Plugin LightningTrail.clear(); for (GraphicsObject o : client.getGraphicsObjects()) { - if (o.getId() == 1356) + if (o.getId() == GraphicID.OLM_LIGHTNING) { LightningTrail.add(WorldPoint.fromLocal(client, o.getLocation())); @@ -281,6 +291,12 @@ public class AoeWarningPlugin extends Plugin Map.Entry entry = it.next(); WorldPoint world = entry.getKey(); LocalPoint local = LocalPoint.fromWorld(client, world); + + if (local == null) + { + return; + } + Tile tile = tiles[world.getPlane()][local.getSceneX()][local.getSceneY()]; GameObject[] objects = tile.getGameObjects(); boolean containsObjects = false; @@ -391,4 +407,20 @@ public class AoeWarningPlugin extends Plugin return false; } -} + + private void reset(boolean setConfig) + { + LightningTrail.clear(); + AcidTrail.clear(); + CrystalSpike.clear(); + WintertodtSnowFall.clear(); + bombs.clear(); + projectiles.clear(); + if (setConfig) + { + fontStyle = config.fontStyle().getFont(); + textSize = config.textSize(); + shadows = config.shadows(); + } + } +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/BombOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/BombOverlay.java index b538b3df25..317f5ad04b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/BombOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/BombOverlay.java @@ -121,6 +121,10 @@ public class BombOverlay extends Overlay { final Player localPlayer = client.getLocalPlayer(); LocalPoint localLoc = LocalPoint.fromWorld(client, bomb.getWorldLocation()); + if (localLoc == null) + { + return; + } double distance_x = Math.abs(bomb.getWorldLocation().getX() - localPlayer.getWorldLocation().getX()); double distance_y = Math.abs(bomb.getWorldLocation().getY() - localPlayer.getWorldLocation().getY()); Color color_code = Color.decode(SAFE); @@ -142,7 +146,7 @@ public class BombOverlay extends Overlay { color_code = Color.decode(CAUTION); } - LocalPoint CenterPoint = new LocalPoint(localLoc.getX() + 0, localLoc.getY() + 0); + LocalPoint CenterPoint = new LocalPoint(localLoc.getX(), localLoc.getY()); Polygon poly = Perspective.getCanvasTileAreaPoly(client, CenterPoint, BOMB_AOE); if (poly != null) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPlugin.java index 9fd09a8ac8..cc64835acb 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPlugin.java @@ -258,7 +258,7 @@ public class DevToolsPlugin extends Plugin int value = Integer.parseInt(args[1]); client.setVarpValue(client.getVarps(), varp, value); client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "Set VarPlayer " + varp + " to " + value, null); - VarbitChanged varbitChanged = VarbitChanged.INSTANCE; + VarbitChanged varbitChanged = new VarbitChanged(); varbitChanged.setIndex(varp); eventBus.post(varbitChanged); // fake event break; @@ -276,7 +276,7 @@ public class DevToolsPlugin extends Plugin int value = Integer.parseInt(args[1]); client.setVarbitValue(client.getVarps(), varbit, value); client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "Set varbit " + varbit + " to " + value, null); - eventBus.post(VarbitChanged.INSTANCE); // fake event + eventBus.post(new VarbitChanged()); // fake event break; } case "addxp": @@ -293,7 +293,7 @@ public class DevToolsPlugin extends Plugin client.queueChangedSkill(skill); - ExperienceChanged experienceChanged = ExperienceChanged.INSTANCE; + ExperienceChanged experienceChanged = new ExperienceChanged(); experienceChanged.setSkill(skill); eventBus.post(experienceChanged); break; @@ -312,11 +312,11 @@ public class DevToolsPlugin extends Plugin client.queueChangedSkill(skill); - ExperienceChanged experienceChanged = ExperienceChanged.INSTANCE; + ExperienceChanged experienceChanged = new ExperienceChanged(); experienceChanged.setSkill(skill); eventBus.post(experienceChanged); - BoostedLevelChanged boostedLevelChanged = BoostedLevelChanged.INSTANCE; + BoostedLevelChanged boostedLevelChanged = new BoostedLevelChanged(); boostedLevelChanged.setSkill(skill); eventBus.post(boostedLevelChanged); break; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/freezetimers/FreezeTimersOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/freezetimers/FreezeTimersOverlay.java index 87e3a0ee98..6842cd111d 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/freezetimers/FreezeTimersOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/freezetimers/FreezeTimersOverlay.java @@ -54,17 +54,17 @@ public class FreezeTimersOverlay extends Overlay private final BufferedImage FREEZE_IMAGE = ImageUtil.getResourceStreamFromClass(getClass(), "freeze.png"); private final BufferedImage TB_IMAGE = ImageUtil.getResourceStreamFromClass(getClass(), "teleblock.png"); private final BufferedImage VENG_IMAGE = ImageUtil.getResourceStreamFromClass(getClass(), "veng.png"); - @Inject private Timers timers; private boolean lock; private long finishedAtTest; @Inject - public FreezeTimersOverlay(FreezeTimersConfig config, Client client) + public FreezeTimersOverlay(FreezeTimersConfig config, Client client, Timers timers) { this.config = config; this.client = client; + this.timers = timers; setPriority(OverlayPriority.HIGHEST); setPosition(OverlayPosition.DYNAMIC); setLayer(OverlayLayer.UNDER_WIDGETS); @@ -119,24 +119,23 @@ public class FreezeTimersOverlay extends Overlay String text = processTickCounter(finishedAt); int test = Integer.parseInt(text); Point poi = actor.getCanvasTextLocation(g, text, 0); + if (poi == null) { return false; } - int xpoi = poi.getX(); - int ypoi = poi.getY(); - Point FixedPoint = new Point(xpoi, ypoi); + Point FixedPoint = new Point(poi.getX(), poi.getY()); if (config.noImage()) { if (test > 3) { - renderTextLocation(g, text, config.textSize(), config.fontStyle().getFont(), Color.WHITE, FixedPoint); + OverlayUtil.renderTextLocation(g, text, config.textSize(), config.fontStyle().getFont(), Color.WHITE, FixedPoint, false, 0); } else { - renderTextLocation(g, text, config.textSize(), config.fontStyle().getFont(), Color.YELLOW, FixedPoint); + OverlayUtil.renderTextLocation(g, text, config.textSize(), config.fontStyle().getFont(), Color.YELLOW, FixedPoint, false, 0); } } else @@ -161,23 +160,26 @@ public class FreezeTimersOverlay extends Overlay String text = processTickCounter(finishedAt); Point poi = actor.getCanvasTextLocation(g, text, 0); - int xpoi = poi.getX() + 20; - int ypoi = poi.getY(); - Point FixedPoint = new Point(xpoi, ypoi); + if (poi == null) + { + return false; + } + + Point FixedPoint = new Point(poi.getX() + 20, poi.getY()); if (config.noImage()) { if (timers.getTimerEnd(actor, TimerType.FREEZE) <= currentTick) { - renderTextLocation(g, text, config.textSize(), config.fontStyle().getFont(), Color.CYAN, poi); + OverlayUtil.renderTextLocation(g, text, config.textSize(), config.fontStyle().getFont(), Color.CYAN, poi, false, 0); } if (timers.getTimerEnd(actor, TimerType.FREEZE) >= currentTick) { - renderTextLocation(g, " | " + text, config.textSize(), config.fontStyle().getFont(), Color.CYAN, FixedPoint); + OverlayUtil.renderTextLocation(g, " | " + text, config.textSize(), config.fontStyle().getFont(), Color.CYAN, FixedPoint, false, 0); } if (timers.getTimerEnd(actor, TimerType.VENG) >= currentTick) { - renderTextLocation(g, " | " + text, config.textSize(), config.fontStyle().getFont(), Color.CYAN, FixedPoint); + OverlayUtil.renderTextLocation(g, " | " + text, config.textSize(), config.fontStyle().getFont(), Color.CYAN, FixedPoint, false, 0); } } else @@ -202,22 +204,26 @@ public class FreezeTimersOverlay extends Overlay String text = processTickCounter(finishedAt); Point poi = actor.getCanvasTextLocation(g, text, 0); - int xpoi = poi.getX() - 20; - int ypoi = poi.getY(); - Point FixedPoint = new Point(xpoi, ypoi); + + if (poi == null) + { + return false; + } + + Point FixedPoint = new Point(poi.getX() - 20, poi.getY()); if (config.noImage()) { if (timers.getTimerEnd(actor, TimerType.FREEZE) <= currentTick) { - renderTextLocation(g, text, config.textSize(), config.fontStyle().getFont(), Color.RED, poi); + OverlayUtil.renderTextLocation(g, text, config.textSize(), config.fontStyle().getFont(), Color.RED, poi, false, 0); } if (timers.getTimerEnd(actor, TimerType.FREEZE) >= currentTick) { - renderTextLocation(g, text + " | ", config.textSize(), config.fontStyle().getFont(), Color.RED, FixedPoint); + OverlayUtil.renderTextLocation(g, text + " | ", config.textSize(), config.fontStyle().getFont(), Color.RED, FixedPoint, false, 0); } if (timers.getTimerEnd(actor, TimerType.TELEBLOCK) >= currentTick) { - renderTextLocation(g, text + " | ", config.textSize(), config.fontStyle().getFont(), Color.RED, FixedPoint); + OverlayUtil.renderTextLocation(g, text + " | ", config.textSize(), config.fontStyle().getFont(), Color.RED, FixedPoint, false, 0); } } else @@ -229,10 +235,13 @@ public class FreezeTimersOverlay extends Overlay g.setColor(RED); Polygon poly = actor.getCanvasTilePoly(); - if (poly != null) + + if (poly == null) { - OverlayUtil.renderPolygon(g, poly, RED); + return false; } + + OverlayUtil.renderPolygon(g, poly, RED); OverlayUtil.renderTextLocation(g, new Point((int) poly.getBounds2D().getCenterX(), (int) poly.getBounds2D().getCenterY()), actor.getName(), RED); } @@ -249,22 +258,6 @@ public class FreezeTimersOverlay extends Overlay xOffset); } - private void renderTextLocation(Graphics2D graphics, String txtString, int fontSize, int fontStyle, Color fontColor, Point canvasPoint) - { - graphics.setFont(new Font("Arial", fontStyle, fontSize)); - if (canvasPoint != null) - { - final Point canvasCenterPoint = new Point( - canvasPoint.getX(), - canvasPoint.getY()); - final Point canvasCenterPoint_shadow = new Point( - canvasPoint.getX() + 1, - canvasPoint.getY() + 1); - OverlayUtil.renderTextLocation(graphics, canvasCenterPoint_shadow, txtString, Color.BLACK); - OverlayUtil.renderTextLocation(graphics, canvasCenterPoint, txtString, fontColor); - } - } - public void renderImageLocation(Graphics2D graphics, Point imgLoc, BufferedImage image) { int x = imgLoc.getX(); @@ -273,12 +266,9 @@ public class FreezeTimersOverlay extends Overlay graphics.drawImage(image, x, y, null); } - public void renderActorTextAndImage(Graphics2D graphics, Actor actor, String text, Color color, - BufferedImage image, int yOffset, int xOffset) + private void renderActorTextAndImage(Graphics2D graphics, Actor actor, String text, Color color, BufferedImage image, int yOffset, int xOffset) { - Point textLocation = new Point(actor.getCanvasImageLocation(image, 0).getX() + xOffset, - actor.getCanvasImageLocation(image, 0).getY() + yOffset); - + Point textLocation = new Point(actor.getCanvasImageLocation(image, 0).getX() + xOffset, actor.getCanvasImageLocation(image, 0).getY() + yOffset); renderImageLocation(graphics, textLocation, image); xOffset = image.getWidth() + 1; yOffset = (image.getHeight() - (int) graphics.getFontMetrics().getStringBounds(text, graphics).getHeight()); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/freezetimers/FreezeTimersPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/freezetimers/FreezeTimersPlugin.java index 8ac9d913d7..e66279aa4d 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/freezetimers/FreezeTimersPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/freezetimers/FreezeTimersPlugin.java @@ -121,7 +121,7 @@ public class FreezeTimersPlugin extends Plugin { if (prayerTracker.getSpotanimLastTick(actor) != actor.getSpotAnimation()) { - SpotAnimationChanged callback = SpotAnimationChanged.INSTANCE; + SpotAnimationChanged callback = new SpotAnimationChanged(); callback.setActor(actor); client.getCallbacks().post(callback); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/implings/ImplingsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/implings/ImplingsPlugin.java index f0709535f4..5ec61041da 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/implings/ImplingsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/implings/ImplingsPlugin.java @@ -30,14 +30,13 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.HashMap; import javax.inject.Inject; import lombok.AccessLevel; import lombok.Getter; import net.runelite.api.GameState; import net.runelite.api.NPC; -import net.runelite.api.events.GameTick; import net.runelite.api.events.GameStateChanged; +import net.runelite.api.events.GameTick; import net.runelite.api.events.NpcDespawned; import net.runelite.api.events.NpcSpawned; import net.runelite.client.config.ConfigManager; @@ -119,6 +118,11 @@ public class ImplingsPlugin extends Plugin { Impling impling = Impling.findImpling(npc.getId()); + if (impling == null || impling.getImplingType() == null) + { + continue; + } + ImplingType type = impling.getImplingType(); if (implingCounterMap.containsKey(type)) { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raidsthieving/BatSolver/BatSolver.java b/runelite-client/src/main/java/net/runelite/client/plugins/raidsthieving/BatSolver/BatSolver.java index a2b9f1bb01..e937633dc8 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raidsthieving/BatSolver/BatSolver.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raidsthieving/BatSolver/BatSolver.java @@ -106,7 +106,7 @@ public class BatSolver } - public void calculateChanceOfPoison() + private void calculateChanceOfPoison() { if (getType() == null) { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raidsthieving/BatSolver/SolutionSet.java b/runelite-client/src/main/java/net/runelite/client/plugins/raidsthieving/BatSolver/SolutionSet.java index 11bda048e5..82c36163e4 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raidsthieving/BatSolver/SolutionSet.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raidsthieving/BatSolver/SolutionSet.java @@ -35,9 +35,9 @@ import lombok.Getter; // e.g. if there is an empty chest in L room chest 1, the other empty chests could be 16, 17, 38, 54, 55 // See https://dikkenoob.github.io/ for more information -public class SolutionSet +class SolutionSet { - public static final SolutionSet[] SOLUTION_SETS = + static final SolutionSet[] SOLUTION_SETS = { new SolutionSet(ThievingRoomType.LEFT_TURN, 1, 16, 17, 55), new SolutionSet(ThievingRoomType.LEFT_TURN, 1, 17, 38, 54), @@ -147,12 +147,12 @@ public class SolutionSet this.emptyChests = new HashSet<>(Arrays.asList(emptyChests)); } - public void addEmptyChest(int chestId) + void addEmptyChest(int chestId) { emptyChests.add(chestId); } - public boolean containsChest(int chestId) + boolean containsChest(int chestId) { return emptyChests.contains(chestId); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raidsthieving/InstancePoint.java b/runelite-client/src/main/java/net/runelite/client/plugins/raidsthieving/InstancePoint.java index 490c5d40b1..b1ba3e0102 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raidsthieving/InstancePoint.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raidsthieving/InstancePoint.java @@ -15,7 +15,7 @@ public class InstancePoint private static final int CHUNK_SIZE = 8; private static final double CHUNK_OFFSET = 3.5; - public InstancePoint(int x, int y, int rot) + private InstancePoint(int x, int y, int rot) { this.x = x; this.y = y; @@ -29,7 +29,7 @@ public class InstancePoint this.rot = 0; } - public static InstancePoint buildFromPoint(WorldPoint worldPoint, Client client) + static InstancePoint buildFromPoint(WorldPoint worldPoint, Client client) { Point point = new Point(worldPoint.getX(), worldPoint.getY()); Point base = new Point(client.getBaseX(), client.getBaseY()); @@ -48,7 +48,7 @@ public class InstancePoint return buildFromTile(base, point, rotation, new Point(x, y)); } - public static InstancePoint buildFromTile(Point base, Point tile, int rot, Point chunkOrigin) + private static InstancePoint buildFromTile(Point base, Point tile, int rot, Point chunkOrigin) { int deltaX = tile.getX() - base.getX(); int deltaY = tile.getY() - base.getY(); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raidsthieving/RaidsThievingConstants.java b/runelite-client/src/main/java/net/runelite/client/plugins/raidsthieving/RaidsThievingConstants.java index 965934a01b..8ab527ebe8 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raidsthieving/RaidsThievingConstants.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raidsthieving/RaidsThievingConstants.java @@ -26,10 +26,10 @@ package net.runelite.client.plugins.raidsthieving; public class RaidsThievingConstants { - public static final int CLOSED_CHEST_ID = 29742; - public static final int OPEN_EMPTY_CHEST = 29743; - public static final int OPEN_FULL_CHEST_1 = 29744; - public static final int OPEN_FULL_CHEST_2 = 29745; - public static final int EMPTY_TROUGH = 29746; + static final int CLOSED_CHEST_ID = 29742; + static final int OPEN_EMPTY_CHEST = 29743; + static final int OPEN_FULL_CHEST_1 = 29744; + static final int OPEN_FULL_CHEST_2 = 29745; + static final int EMPTY_TROUGH = 29746; public static final int[] STORAGE = {29769, 29770, 29771, 29772}; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raidsthieving/RaidsThievingPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/raidsthieving/RaidsThievingPlugin.java index 1569ab79fe..a7679b985a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raidsthieving/RaidsThievingPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raidsthieving/RaidsThievingPlugin.java @@ -201,6 +201,12 @@ public class RaidsThievingPlugin extends Plugin { log.debug("Found poison splat"); WorldPoint loc = WorldPoint.fromLocal(client, obj.getLocation()); + + if (chests.get(loc) == null) + { + return; + } + chests.get(loc).setPoison(true); } } @@ -235,7 +241,7 @@ public class RaidsThievingPlugin extends Plugin mapper = null; } - public int numberOfEmptyChestsFound() + int numberOfEmptyChestsFound() { int total = 0; for (ThievingChest chest : chests.values()) @@ -248,7 +254,6 @@ public class RaidsThievingPlugin extends Plugin return total; } - private boolean checkForBats() { for (ThievingChest chest : chests.values()) @@ -266,7 +271,7 @@ public class RaidsThievingPlugin extends Plugin return false; } - public int getChestId(WorldPoint worldPoint) + int getChestId(WorldPoint worldPoint) { return chests.get(worldPoint).getChestId(); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/KnapsackSolver.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/KnapsackSolver.java index b97e2aa21f..dc2afab56c 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/KnapsackSolver.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/KnapsackSolver.java @@ -27,7 +27,7 @@ package net.runelite.client.plugins.slayer; import java.util.ArrayList; import java.util.List; -public class KnapsackSolver +class KnapsackSolver { private List reconstructItemsInSack(int[][] sackMatrix, List items, int i, int w) @@ -49,7 +49,7 @@ public class KnapsackSolver } } - public int howMuchFitsInSack(List items, int maxWeight) + int howMuchFitsInSack(List items, int maxWeight) { int itemCount = items.size(); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/NPCPresence.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/NPCPresence.java index 0924660d6c..cc28df5393 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/NPCPresence.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/NPCPresence.java @@ -29,17 +29,17 @@ public class NPCPresence return name + "[" + combatLevel + "]"; } - public boolean shouldExist() + boolean shouldExist() { return fadeTimer > 0; } - public void tickExistence() + void tickExistence() { fadeTimer--; } - public static NPCPresence buildPresence(NPC npc) + static NPCPresence buildPresence(NPC npc) { return new NPCPresence(npc.getName(), npc.getCombatLevel()); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerPlugin.java index e15e641d33..79dca36797 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerPlugin.java @@ -390,7 +390,7 @@ public class SlayerPlugin extends Plugin } } - int estimateKillCount(List potentialKills, int gains) + private int estimateKillCount(List potentialKills, int gains) { // failsafe to avoid calculating kill count if there were no slayer monsters around that could be killed on task // this failsafe *WILL FAIL* if someone decides to lamp their slayer in the middle of a task next to on task creatures @@ -751,7 +751,7 @@ public class SlayerPlugin extends Plugin } @VisibleForTesting - void killedOne() + private void killedOne() { if (currentTask.getAmount() == 0) { @@ -788,7 +788,7 @@ public class SlayerPlugin extends Plugin } // checks if any contiguous subsequence of seq0 exactly matches the String toMatch - boolean contiguousSubsequenceMatches(String[] seq0, String toMatch) + private boolean contiguousSubsequenceMatches(String[] seq0, String toMatch) { for (int i = 0; i < seq0.length; i++) { @@ -962,7 +962,7 @@ public class SlayerPlugin extends Plugin rebuildTargetList(); } - public AsyncBufferedImage getImageForTask(Task task) + AsyncBufferedImage getImageForTask(Task task) { int itemSpriteId = ItemID.ENCHANTED_GEM; if (task != null) @@ -1048,6 +1048,11 @@ public class SlayerPlugin extends Plugin return; } + if (task == null) + { + return; + } + if (TASK_STRING_VALIDATION.matcher(task.getTask()).find() || task.getTask().length() > TASK_STRING_MAX_LENGTH || TASK_STRING_VALIDATION.matcher(task.getLocation()).find() || task.getLocation().length() > TASK_STRING_MAX_LENGTH) { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerTaskPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerTaskPanel.java index ea3fbf0712..0cd238a6d3 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerTaskPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerTaskPanel.java @@ -343,7 +343,7 @@ public class SlayerTaskPanel extends PluginPanel changePauseState(paused); } - static String htmlLabel(String key, long timeMillis) + private static String htmlLabel(String key, long timeMillis) { if (timeMillis == Long.MAX_VALUE) { @@ -363,7 +363,7 @@ public class SlayerTaskPanel extends PluginPanel } } - static String htmlLabel(String key, int value) + private static String htmlLabel(String key, int value) { String valueStr = StackFormatter.quantityToRSDecimalStack(value); return String.format(HTML_LABEL_TEMPLATE, ColorUtil.toHexColor(ColorScheme.LIGHT_GRAY_COLOR), diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerXpDropLookup.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerXpDropLookup.java index a3e3898390..458c9421c2 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerXpDropLookup.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerXpDropLookup.java @@ -31,14 +31,14 @@ import java.io.InputStreamReader; import java.util.List; import java.util.Map; -public class SlayerXpDropLookup +class SlayerXpDropLookup { private Map> xpMap; // floating point math equality private static final double EPSILON = 1e-6; - void loadXpJson() + private void loadXpJson() { final InputStream xpFile = getClass().getResourceAsStream("/slayer_xp.json"); Gson gson = new Gson(); @@ -76,7 +76,7 @@ public class SlayerXpDropLookup * @param npc the npc we are estimating slayer xp for * @return our best guess for the slayer xp for this npc */ - public double findXpForNpc(NPCPresence npc) + double findXpForNpc(NPCPresence npc) { List xpCombatLevel = xpMap.get(npc.getName()); if (xpCombatLevel == null) @@ -127,7 +127,7 @@ public class SlayerXpDropLookup return -1; } - public SlayerXpDropLookup() + SlayerXpDropLookup() { loadXpJson(); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/nylocas/NyloOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/nylocas/NyloOverlay.java index 54e568cb7e..0f3e4dd26d 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/nylocas/NyloOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/nylocas/NyloOverlay.java @@ -39,6 +39,7 @@ import net.runelite.client.ui.overlay.OverlayMenuEntry; import net.runelite.client.ui.overlay.OverlayPosition; import net.runelite.client.ui.overlay.OverlayPriority; import net.runelite.client.ui.overlay.components.PanelComponent; +import net.runelite.client.ui.overlay.components.table.TableAlignment; import net.runelite.client.ui.overlay.components.table.TableComponent; import net.runelite.client.util.ColorUtil; @@ -102,6 +103,7 @@ class NyloOverlay extends Overlay panelComponent.getChildren().clear(); TableComponent tableComponent = new TableComponent(); + tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT); int nyloCount = (hagios + toxobolos + ischyros); if (nylohandler.getWave() < 21) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/xarpus/XarpusCounter.java b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/xarpus/XarpusCounter.java index 840902c186..3b39af4640 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/xarpus/XarpusCounter.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/xarpus/XarpusCounter.java @@ -13,6 +13,7 @@ import net.runelite.client.ui.overlay.OverlayMenuEntry; import net.runelite.client.ui.overlay.OverlayPosition; import net.runelite.client.ui.overlay.components.PanelComponent; import net.runelite.client.ui.overlay.components.TitleComponent; +import net.runelite.client.ui.overlay.components.table.TableAlignment; import net.runelite.client.ui.overlay.components.table.TableComponent; public class XarpusCounter extends Overlay @@ -60,6 +61,7 @@ public class XarpusCounter extends Overlay )); TableComponent tableComponent = new TableComponent(); + tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT); tableComponent.addRow("Exhumes", String.valueOf(xarpusHandler.getExhumesCount())); panelComponent.getChildren().add(tableComponent); diff --git a/runelite-client/src/main/java/net/runelite/client/util/GameEventManager.java b/runelite-client/src/main/java/net/runelite/client/util/GameEventManager.java index 94359890e8..edaedc856f 100644 --- a/runelite-client/src/main/java/net/runelite/client/util/GameEventManager.java +++ b/runelite-client/src/main/java/net/runelite/client/util/GameEventManager.java @@ -118,9 +118,7 @@ public class GameEventManager if (itemContainer != null) { - ItemContainerChanged event = ItemContainerChanged.INSTANCE; - event.setItemContainer(itemContainer); - eventBus.post(event); + eventBus.post(new ItemContainerChanged(itemContainer)); } } @@ -128,8 +126,7 @@ public class GameEventManager { if (npc != null) { - final NpcSpawned npcSpawned = NpcSpawned.INSTANCE; - npcSpawned.setNpc(npc); + final NpcSpawned npcSpawned = new NpcSpawned(npc); eventBus.post(npcSpawned); } } @@ -138,8 +135,7 @@ public class GameEventManager { if (player != null) { - final PlayerSpawned playerSpawned = PlayerSpawned.INSTANCE; - playerSpawned.setPlayer(player); + final PlayerSpawned playerSpawned = new PlayerSpawned(player); eventBus.post(playerSpawned); } } @@ -148,7 +144,7 @@ public class GameEventManager { Optional.ofNullable(tile.getWallObject()).ifPresent(object -> { - final WallObjectSpawned objectSpawned = WallObjectSpawned.INSTANCE; + final WallObjectSpawned objectSpawned = new WallObjectSpawned(); objectSpawned.setTile(tile); objectSpawned.setWallObject(object); eventBus.post(objectSpawned); @@ -156,7 +152,7 @@ public class GameEventManager Optional.ofNullable(tile.getDecorativeObject()).ifPresent(object -> { - final DecorativeObjectSpawned objectSpawned = DecorativeObjectSpawned.INSTANCE; + final DecorativeObjectSpawned objectSpawned = new DecorativeObjectSpawned(); objectSpawned.setTile(tile); objectSpawned.setDecorativeObject(object); eventBus.post(objectSpawned); @@ -164,7 +160,7 @@ public class GameEventManager Optional.ofNullable(tile.getGroundObject()).ifPresent(object -> { - final GroundObjectSpawned objectSpawned = GroundObjectSpawned.INSTANCE; + final GroundObjectSpawned objectSpawned = new GroundObjectSpawned(); objectSpawned.setTile(tile); objectSpawned.setGroundObject(object); eventBus.post(objectSpawned); @@ -174,7 +170,7 @@ public class GameEventManager .filter(Objects::nonNull) .forEach(object -> { - final GameObjectSpawned objectSpawned = GameObjectSpawned.INSTANCE; + final GameObjectSpawned objectSpawned = new GameObjectSpawned(); objectSpawned.setTile(tile); objectSpawned.setGameObject(object); eventBus.post(objectSpawned); @@ -190,9 +186,7 @@ public class GameEventManager current = current.getNext(); - final ItemSpawned itemSpawned = ItemSpawned.INSTANCE; - itemSpawned.setItem(item); - itemSpawned.setTile(tile); + final ItemSpawned itemSpawned = new ItemSpawned(tile, item); eventBus.post(itemSpawned); } }); diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/attackstyles/AttackStylesPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/attackstyles/AttackStylesPluginTest.java index 6a94e305e1..2060d0d536 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/attackstyles/AttackStylesPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/attackstyles/AttackStylesPluginTest.java @@ -93,14 +93,14 @@ public class AttackStylesPluginTest when(client.getVar(VarPlayer.ATTACK_STYLE)).thenReturn(AttackStyle.ACCURATE.ordinal()); // verify that earning xp in a warned skill will display red text on the widget - attackPlugin.onVarbitChanged(VarbitChanged.INSTANCE); + attackPlugin.onVarbitChanged(new VarbitChanged()); assertTrue(attackPlugin.isWarnedSkillSelected()); // Switch to attack style that doesn't give attack xp when(client.getVar(VarPlayer.ATTACK_STYLE)).thenReturn(AttackStyle.AGGRESSIVE.ordinal()); // Verify the widget will now display white text - attackPlugin.onVarbitChanged(VarbitChanged.INSTANCE); + attackPlugin.onVarbitChanged(new VarbitChanged()); warnedSkills = attackPlugin.getWarnedSkills(); assertTrue(warnedSkills.contains(Skill.ATTACK)); assertFalse(attackPlugin.isWarnedSkillSelected()); @@ -129,7 +129,7 @@ public class AttackStylesPluginTest // equip type_4 weapon type on player when(client.getVar(Varbits.EQUIPPED_WEAPON_TYPE)).thenReturn(WeaponType.TYPE_4.ordinal()); - attackPlugin.onVarbitChanged(VarbitChanged.INSTANCE); + attackPlugin.onVarbitChanged(new VarbitChanged()); // Verify there is a warned skill Set warnedSkills = attackPlugin.getWarnedSkills(); diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/cerberus/CerberusPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/cerberus/CerberusPluginTest.java index daac7907de..4f35f7b174 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/cerberus/CerberusPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/cerberus/CerberusPluginTest.java @@ -71,7 +71,7 @@ public class CerberusPluginTest mockNpc(new LocalPoint(2, 5)), mockNpc(new LocalPoint(1, 5)) )); - cerberusPlugin.onGameTick(GameTick.INSTANCE); + cerberusPlugin.onGameTick(new GameTick()); // Expected sort is by lowest y first, then by lowest x assertEquals(ghosts.get(0).getLocalLocation(), new LocalPoint(0, 0)); diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsPluginTest.java index 58cf5ac99e..c30c8a4e9e 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsPluginTest.java @@ -83,7 +83,7 @@ public class ChatNotificationsPluginTest MessageNode messageNode = mock(MessageNode.class); when(messageNode.getValue()).thenReturn("Deathbeam, Deathbeam OSRS"); - ChatMessage chatMessage = ChatMessage.INSTANCE; + ChatMessage chatMessage = new ChatMessage(); chatMessage.setType(ChatMessageType.PUBLICCHAT); chatMessage.setMessageNode(messageNode); diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/cooking/CookingPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/cooking/CookingPluginTest.java index f05a53c8f9..6b8334e99d 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/cooking/CookingPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/cooking/CookingPluginTest.java @@ -118,7 +118,7 @@ public class CookingPluginTest when(config.fermentTimer()).thenReturn(true); when(client.getLocalPlayer()).thenReturn(player); - SpotAnimationChanged graphicChanged = SpotAnimationChanged.INSTANCE; + SpotAnimationChanged graphicChanged = new SpotAnimationChanged(); graphicChanged.setActor(player); cookingPlugin.onSpotAnimationChanged(graphicChanged); diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/emojis/EmojiPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/emojis/EmojiPluginTest.java index ebf58ca625..3427246946 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/emojis/EmojiPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/emojis/EmojiPluginTest.java @@ -73,7 +73,7 @@ public class EmojiPluginTest when(client.createIndexedSprite()).thenReturn(mock(IndexedSprite.class)); // Trip emoji loading - GameStateChanged gameStateChanged = GameStateChanged.INSTANCE; + GameStateChanged gameStateChanged = new GameStateChanged(); gameStateChanged.setGameState(GameState.LOGGED_IN); emojiPlugin.onGameStateChanged(gameStateChanged); @@ -81,7 +81,7 @@ public class EmojiPluginTest // With chat recolor, message may be wrapped in col tags when(messageNode.getValue()).thenReturn(":) :) :)"); - ChatMessage chatMessage = ChatMessage.INSTANCE; + ChatMessage chatMessage = new ChatMessage(); chatMessage.setType(ChatMessageType.PUBLICCHAT); chatMessage.setMessageNode(messageNode); @@ -98,14 +98,14 @@ public class EmojiPluginTest when(client.createIndexedSprite()).thenReturn(mock(IndexedSprite.class)); // Trip emoji loading - GameStateChanged gameStateChanged = GameStateChanged.INSTANCE; + GameStateChanged gameStateChanged = new GameStateChanged(); gameStateChanged.setGameState(GameState.LOGGED_IN); emojiPlugin.onGameStateChanged(gameStateChanged); MessageNode messageNode = mock(MessageNode.class); when(messageNode.getValue()).thenReturn(":D"); - ChatMessage chatMessage = ChatMessage.INSTANCE; + ChatMessage chatMessage = new ChatMessage(); chatMessage.setType(ChatMessageType.PUBLICCHAT); chatMessage.setMessageNode(messageNode); diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/idlenotifier/IdleNotifierPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/idlenotifier/IdleNotifierPluginTest.java index b8373c81b3..51dc7842e0 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/idlenotifier/IdleNotifierPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/idlenotifier/IdleNotifierPluginTest.java @@ -132,13 +132,13 @@ public class IdleNotifierPluginTest public void checkAnimationIdle() { when(player.getAnimation()).thenReturn(AnimationID.WOODCUTTING_BRONZE); - AnimationChanged animationChanged = AnimationChanged.INSTANCE; + AnimationChanged animationChanged = new AnimationChanged(); animationChanged.setActor(player); plugin.onAnimationChanged(animationChanged); - plugin.onGameTick(GameTick.INSTANCE); + plugin.onGameTick(new GameTick()); when(player.getAnimation()).thenReturn(AnimationID.IDLE); plugin.onAnimationChanged(animationChanged); - plugin.onGameTick(GameTick.INSTANCE); + plugin.onGameTick(new GameTick()); verify(notifier).notify("[" + PLAYER_NAME + "] is now idle!"); } @@ -146,16 +146,16 @@ public class IdleNotifierPluginTest public void checkAnimationReset() { when(player.getAnimation()).thenReturn(AnimationID.WOODCUTTING_BRONZE); - AnimationChanged animationChanged = AnimationChanged.INSTANCE; + AnimationChanged animationChanged = new AnimationChanged(); animationChanged.setActor(player); plugin.onAnimationChanged(animationChanged); - plugin.onGameTick(GameTick.INSTANCE); + plugin.onGameTick(new GameTick()); when(player.getAnimation()).thenReturn(AnimationID.LOOKING_INTO); plugin.onAnimationChanged(animationChanged); - plugin.onGameTick(GameTick.INSTANCE); + plugin.onGameTick(new GameTick()); when(player.getAnimation()).thenReturn(AnimationID.IDLE); plugin.onAnimationChanged(animationChanged); - plugin.onGameTick(GameTick.INSTANCE); + plugin.onGameTick(new GameTick()); verify(notifier, times(0)).notify(any()); } @@ -163,14 +163,14 @@ public class IdleNotifierPluginTest public void checkAnimationLogout() { when(player.getAnimation()).thenReturn(AnimationID.WOODCUTTING_BRONZE); - AnimationChanged animationChanged = AnimationChanged.INSTANCE; + AnimationChanged animationChanged = new AnimationChanged(); animationChanged.setActor(player); plugin.onAnimationChanged(animationChanged); - plugin.onGameTick(GameTick.INSTANCE); + plugin.onGameTick(new GameTick()); // Logout when(client.getGameState()).thenReturn(GameState.LOGIN_SCREEN); - GameStateChanged gameStateChanged = GameStateChanged.INSTANCE; + GameStateChanged gameStateChanged = new GameStateChanged(); gameStateChanged.setGameState(GameState.LOGIN_SCREEN); plugin.onGameStateChanged(gameStateChanged); @@ -182,7 +182,7 @@ public class IdleNotifierPluginTest // Tick when(player.getAnimation()).thenReturn(AnimationID.IDLE); plugin.onAnimationChanged(animationChanged); - plugin.onGameTick(GameTick.INSTANCE); + plugin.onGameTick(new GameTick()); verify(notifier, times(0)).notify(any()); } @@ -190,16 +190,11 @@ public class IdleNotifierPluginTest public void checkCombatIdle() { when(player.getInteracting()).thenReturn(monster); - InteractingChanged event = InteractingChanged.INSTANCE; - event.setSource(player); - event.setTarget(monster); - plugin.onInteractingChanged(event); - plugin.onGameTick(GameTick.INSTANCE); + plugin.onInteractingChanged(new InteractingChanged(player, monster)); + plugin.onGameTick(new GameTick()); when(player.getInteracting()).thenReturn(null); - event.setSource(player); - event.setTarget(null); - plugin.onInteractingChanged(event); - plugin.onGameTick(GameTick.INSTANCE); + plugin.onInteractingChanged(new InteractingChanged(player, null)); + plugin.onGameTick(new GameTick()); verify(notifier).notify("[" + PLAYER_NAME + "] is now out of combat!"); } @@ -207,37 +202,27 @@ public class IdleNotifierPluginTest public void checkCombatReset() { when(player.getInteracting()).thenReturn(monster); - InteractingChanged event = InteractingChanged.INSTANCE; - event.setSource(player); - event.setTarget(monster); - plugin.onInteractingChanged(event); - plugin.onGameTick(GameTick.INSTANCE); + plugin.onInteractingChanged(new InteractingChanged(player, monster)); + plugin.onGameTick(new GameTick()); when(player.getInteracting()).thenReturn(randomEvent); - event.setSource(player); - event.setTarget(randomEvent); - plugin.onInteractingChanged(event); - plugin.onGameTick(GameTick.INSTANCE); + plugin.onInteractingChanged(new InteractingChanged(player, randomEvent)); + plugin.onGameTick(new GameTick()); when(player.getInteracting()).thenReturn(null); - event.setSource(player); - event.setTarget(null); - plugin.onInteractingChanged(event); - plugin.onGameTick(GameTick.INSTANCE); + plugin.onInteractingChanged(new InteractingChanged(player, null)); + plugin.onGameTick(new GameTick()); verify(notifier, times(0)).notify(any()); } @Test public void checkCombatLogout() { - InteractingChanged event = InteractingChanged.INSTANCE; - event.setSource(player); - event.setTarget(monster); - plugin.onInteractingChanged(event); + plugin.onInteractingChanged(new InteractingChanged(player, monster)); when(player.getInteracting()).thenReturn(monster); - plugin.onGameTick(GameTick.INSTANCE); + plugin.onGameTick(new GameTick()); // Logout when(client.getGameState()).thenReturn(GameState.LOGIN_SCREEN); - GameStateChanged gameStateChanged = GameStateChanged.INSTANCE; + GameStateChanged gameStateChanged = new GameStateChanged(); gameStateChanged.setGameState(GameState.LOGIN_SCREEN); plugin.onGameStateChanged(gameStateChanged); @@ -248,10 +233,8 @@ public class IdleNotifierPluginTest // Tick when(player.getInteracting()).thenReturn(null); - event.setSource(player); - event.setTarget(null); - plugin.onInteractingChanged(event); - plugin.onGameTick(GameTick.INSTANCE); + plugin.onInteractingChanged(new InteractingChanged(player, null)); + plugin.onGameTick(new GameTick()); verify(notifier, times(0)).notify(any()); } @@ -262,11 +245,11 @@ public class IdleNotifierPluginTest when(client.getMouseIdleTicks()).thenReturn(80_000); // But player is being damaged (is in combat) - final HitsplatApplied hitsplatApplied = HitsplatApplied.INSTANCE; + final HitsplatApplied hitsplatApplied = new HitsplatApplied(); hitsplatApplied.setActor(player); hitsplatApplied.setHitsplat(new Hitsplat(Hitsplat.HitsplatType.DAMAGE, 0, 0)); plugin.onHitsplatApplied(hitsplatApplied); - plugin.onGameTick(GameTick.INSTANCE); + plugin.onGameTick(new GameTick()); verify(notifier, times(0)).notify(any()); } @@ -279,8 +262,8 @@ public class IdleNotifierPluginTest when(client.getKeyboardIdleTicks()).thenReturn(80_000); when(client.getMouseIdleTicks()).thenReturn(14_500); - plugin.onGameTick(GameTick.INSTANCE); - plugin.onGameTick(GameTick.INSTANCE); + plugin.onGameTick(new GameTick()); + plugin.onGameTick(new GameTick()); verify(notifier, times(1)).notify(any()); } @@ -290,11 +273,11 @@ public class IdleNotifierPluginTest when(config.getSpecEnergyThreshold()).thenReturn(50); when(client.getVar(Matchers.eq(VarPlayer.SPECIAL_ATTACK_PERCENT))).thenReturn(400); // 40% - plugin.onGameTick(GameTick.INSTANCE); // once to set lastSpecEnergy to 400 + plugin.onGameTick(new GameTick()); // once to set lastSpecEnergy to 400 verify(notifier, never()).notify(any()); when(client.getVar(Matchers.eq(VarPlayer.SPECIAL_ATTACK_PERCENT))).thenReturn(500); // 50% - plugin.onGameTick(GameTick.INSTANCE); + plugin.onGameTick(new GameTick()); verify(notifier).notify(Matchers.eq("[" + PLAYER_NAME + "] has restored spec energy!")); } } \ No newline at end of file diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/motherlode/MotherlodePluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/motherlode/MotherlodePluginTest.java index 3e00ae7b6d..7f4c3bcbb0 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/motherlode/MotherlodePluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/motherlode/MotherlodePluginTest.java @@ -115,13 +115,13 @@ public class MotherlodePluginTest public void testOreCounter() { // set inMlm - GameStateChanged gameStateChanged = GameStateChanged.INSTANCE; + GameStateChanged gameStateChanged = new GameStateChanged(); gameStateChanged.setGameState(GameState.LOGGED_IN); motherlodePlugin.onGameStateChanged(gameStateChanged); // Initial sack count when(client.getVar(Varbits.SACK_NUMBER)).thenReturn(42); - motherlodePlugin.onVarbitChanged(VarbitChanged.INSTANCE); + motherlodePlugin.onVarbitChanged(new VarbitChanged()); // Create before inventory ItemContainer inventory = mock(ItemContainer.class); @@ -140,7 +140,7 @@ public class MotherlodePluginTest // Withdraw 20 when(client.getVar(Varbits.SACK_NUMBER)).thenReturn(22); - motherlodePlugin.onVarbitChanged(VarbitChanged.INSTANCE); + motherlodePlugin.onVarbitChanged(new VarbitChanged()); inventory = mock(ItemContainer.class); // +1 rune, +4 nugget, +2 coal, +1 addy @@ -162,9 +162,7 @@ public class MotherlodePluginTest when(client.getItemContainer(InventoryID.INVENTORY)).thenReturn(inventory); // Trigger comparison - ItemContainerChanged event = ItemContainerChanged.INSTANCE; - event.setItemContainer(inventory); - motherlodePlugin.onItemContainerChanged(event); + motherlodePlugin.onItemContainerChanged(new ItemContainerChanged(inventory)); verify(motherlodeSession).updateOreFound(ItemID.RUNITE_ORE, 1); verify(motherlodeSession).updateOreFound(ItemID.GOLDEN_NUGGET, 4); diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/screenshot/ScreenshotPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/screenshot/ScreenshotPluginTest.java index 9efc27c57e..9aff61c346 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/screenshot/ScreenshotPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/screenshot/ScreenshotPluginTest.java @@ -175,11 +175,11 @@ public class ScreenshotPluginTest assertEquals("Hitpoints(99)", screenshotPlugin.parseLevelUpWidget(LEVEL_UP_LEVEL)); - WidgetLoaded event = WidgetLoaded.INSTANCE; + WidgetLoaded event = new WidgetLoaded(); event.setGroupId(LEVEL_UP_GROUP_ID); screenshotPlugin.onWidgetLoaded(event); - GameTick tick = GameTick.INSTANCE; + GameTick tick = new GameTick(); screenshotPlugin.onGameTick(tick); verify(drawManager).requestNextFrameListener(Matchers.any(Consumer.class)); @@ -198,11 +198,11 @@ public class ScreenshotPluginTest assertEquals("Firemaking(9)", screenshotPlugin.parseLevelUpWidget(LEVEL_UP_LEVEL)); - WidgetLoaded event = WidgetLoaded.INSTANCE; + WidgetLoaded event = new WidgetLoaded(); event.setGroupId(LEVEL_UP_GROUP_ID); screenshotPlugin.onWidgetLoaded(event); - GameTick tick = GameTick.INSTANCE; + GameTick tick = new GameTick(); screenshotPlugin.onGameTick(tick); verify(drawManager).requestNextFrameListener(Matchers.any(Consumer.class)); @@ -221,11 +221,11 @@ public class ScreenshotPluginTest assertEquals("Attack(70)", screenshotPlugin.parseLevelUpWidget(LEVEL_UP_LEVEL)); - WidgetLoaded event = WidgetLoaded.INSTANCE; + WidgetLoaded event = new WidgetLoaded(); event.setGroupId(LEVEL_UP_GROUP_ID); screenshotPlugin.onWidgetLoaded(event); - GameTick tick = GameTick.INSTANCE; + GameTick tick = new GameTick(); screenshotPlugin.onGameTick(tick); verify(drawManager).requestNextFrameListener(Matchers.any(Consumer.class)); @@ -244,11 +244,11 @@ public class ScreenshotPluginTest assertEquals("Hunter(2)", screenshotPlugin.parseLevelUpWidget(DIALOG_SPRITE_TEXT)); - WidgetLoaded event = WidgetLoaded.INSTANCE; + WidgetLoaded event = new WidgetLoaded(); event.setGroupId(DIALOG_SPRITE_GROUP_ID); screenshotPlugin.onWidgetLoaded(event); - GameTick tick = GameTick.INSTANCE; + GameTick tick = new GameTick(); screenshotPlugin.onGameTick(tick); verify(drawManager).requestNextFrameListener(Matchers.any(Consumer.class)); diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/slayer/SlayerPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/slayer/SlayerPluginTest.java index c339b1de6e..099a76d19b 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/slayer/SlayerPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/slayer/SlayerPluginTest.java @@ -155,7 +155,7 @@ public class SlayerPluginTest Widget npcDialog = mock(Widget.class); when(npcDialog.getText()).thenReturn(TASK_NEW); when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog); - slayerPlugin.onGameTick(GameTick.INSTANCE); + slayerPlugin.onGameTick(new GameTick()); assertEquals("Suqahs", slayerPlugin.getCurrentTask().getTaskName()); assertEquals(231, slayerPlugin.getCurrentTask().getAmount()); @@ -167,7 +167,7 @@ public class SlayerPluginTest Widget npcDialog = mock(Widget.class); when(npcDialog.getText()).thenReturn(TASK_NEW_KONAR); when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog); - slayerPlugin.onGameTick(GameTick.INSTANCE); + slayerPlugin.onGameTick(new GameTick()); assertEquals("Wyrms", slayerPlugin.getCurrentTask().getTaskName()); assertEquals(147, slayerPlugin.getCurrentTask().getAmount()); @@ -180,7 +180,7 @@ public class SlayerPluginTest Widget npcDialog = mock(Widget.class); when(npcDialog.getText()).thenReturn(TASK_NEW_KONAR_2); when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog); - slayerPlugin.onGameTick(GameTick.INSTANCE); + slayerPlugin.onGameTick(new GameTick()); assertEquals("Hellhounds", slayerPlugin.getCurrentTask().getTaskName()); assertEquals(142, slayerPlugin.getCurrentTask().getAmount()); @@ -193,7 +193,7 @@ public class SlayerPluginTest Widget npcDialog = mock(Widget.class); when(npcDialog.getText()).thenReturn(TASK_NEW_KONAR_3); when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog); - slayerPlugin.onGameTick(GameTick.INSTANCE); + slayerPlugin.onGameTick(new GameTick()); assertEquals("Trolls", slayerPlugin.getCurrentTask().getTaskName()); assertEquals(135, slayerPlugin.getCurrentTask().getAmount()); @@ -206,7 +206,7 @@ public class SlayerPluginTest Widget npcDialog = mock(Widget.class); when(npcDialog.getText()).thenReturn(TASK_NEW_FIRST); when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog); - slayerPlugin.onGameTick(GameTick.INSTANCE); + slayerPlugin.onGameTick(new GameTick()); assertEquals("goblins", slayerPlugin.getCurrentTask().getTaskName()); assertEquals(17, slayerPlugin.getCurrentTask().getAmount()); @@ -218,7 +218,7 @@ public class SlayerPluginTest Widget npcDialog = mock(Widget.class); when(npcDialog.getText()).thenReturn(TASK_NEW_NPC_CONTACT); when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog); - slayerPlugin.onGameTick(GameTick.INSTANCE); + slayerPlugin.onGameTick(new GameTick()); assertEquals("Suqahs", slayerPlugin.getCurrentTask().getTaskName()); assertEquals(211, slayerPlugin.getCurrentTask().getAmount()); @@ -230,7 +230,7 @@ public class SlayerPluginTest Widget npcDialog = mock(Widget.class); when(npcDialog.getText()).thenReturn(TASK_BOSS_NEW); when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog); - slayerPlugin.onGameTick(GameTick.INSTANCE); + slayerPlugin.onGameTick(new GameTick()); assertEquals("Vet'ion", slayerPlugin.getCurrentTask().getTaskName()); assertEquals(3, slayerPlugin.getCurrentTask().getAmount()); @@ -243,7 +243,7 @@ public class SlayerPluginTest Widget npcDialog = mock(Widget.class); when(npcDialog.getText()).thenReturn(TASK_BOSS_NEW_THE); when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog); - slayerPlugin.onGameTick(GameTick.INSTANCE); + slayerPlugin.onGameTick(new GameTick()); assertEquals("Chaos Elemental", slayerPlugin.getCurrentTask().getTaskName()); assertEquals(3, slayerPlugin.getCurrentTask().getAmount()); @@ -296,7 +296,7 @@ public class SlayerPluginTest Widget npcDialog = mock(Widget.class); when(npcDialog.getText()).thenReturn(TASK_EXISTING); when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog); - slayerPlugin.onGameTick(GameTick.INSTANCE); + slayerPlugin.onGameTick(new GameTick()); assertEquals("suqahs", slayerPlugin.getCurrentTask().getTaskName()); assertEquals(222, slayerPlugin.getCurrentTask().getAmount()); @@ -331,7 +331,7 @@ public class SlayerPluginTest ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "Perterter", TASK_POINTS, null, 0); slayerPlugin.onChatMessage(chatMessageEvent); - VarbitChanged varbitChanged = VarbitChanged.INSTANCE; + VarbitChanged varbitChanged = new VarbitChanged(); slayerPlugin.onVarbitChanged(varbitChanged); assertEquals(9, slayerPlugin.getStreak()); @@ -347,7 +347,7 @@ public class SlayerPluginTest ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "Perterter", TASK_LARGE_STREAK, null, 0); slayerPlugin.onChatMessage(chatMessageEvent); - VarbitChanged varbitChanged = VarbitChanged.INSTANCE; + VarbitChanged varbitChanged = new VarbitChanged(); slayerPlugin.onVarbitChanged(varbitChanged); assertEquals(2465, slayerPlugin.getStreak()); @@ -408,7 +408,7 @@ public class SlayerPluginTest when(slayerConfig.taskCommand()).thenReturn(true); when(chatClient.getTask(anyString())).thenReturn(task); - ChatMessage setMessage = ChatMessage.INSTANCE; + ChatMessage setMessage = new ChatMessage(); setMessage.setType(ChatMessageType.PUBLICCHAT); setMessage.setName("Adam"); setMessage.setMessageNode(mock(MessageNode.class)); @@ -430,7 +430,7 @@ public class SlayerPluginTest when(slayerConfig.taskCommand()).thenReturn(true); when(chatClient.getTask(anyString())).thenReturn(task); - ChatMessage chatMessage = ChatMessage.INSTANCE; + ChatMessage chatMessage = new ChatMessage(); chatMessage.setType(ChatMessageType.PUBLICCHAT); chatMessage.setName("Adam"); chatMessage.setMessageNode(mock(MessageNode.class)); diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSActorMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSActorMixin.java index 113e6a77cc..f25c98e263 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSActorMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSActorMixin.java @@ -186,7 +186,7 @@ public abstract class RSActorMixin implements RSActor @Inject public void animationChanged(int idx) { - AnimationChanged animationChange = AnimationChanged.INSTANCE; + AnimationChanged animationChange = new AnimationChanged(); animationChange.setActor(this); client.getCallbacks().post(animationChange); } @@ -195,7 +195,7 @@ public abstract class RSActorMixin implements RSActor @Inject public void spotAnimationChanged(int idx) { - SpotAnimationChanged spotAnimationChanged = SpotAnimationChanged.INSTANCE; + SpotAnimationChanged spotAnimationChanged = new SpotAnimationChanged(); spotAnimationChanged.setActor(this); client.getCallbacks().post(spotAnimationChanged); } @@ -204,9 +204,7 @@ public abstract class RSActorMixin implements RSActor @Inject public void interactingChanged(int idx) { - InteractingChanged interactingChanged = InteractingChanged.INSTANCE; - interactingChanged.setSource(this); - interactingChanged.setTarget(getInteracting()); + InteractingChanged interactingChanged = new InteractingChanged(this, getInteracting()); client.getCallbacks().post(interactingChanged); } @@ -217,10 +215,7 @@ public abstract class RSActorMixin implements RSActor String overheadText = getOverheadText(); if (overheadText != null) { - - OverheadTextChanged overheadTextChanged = OverheadTextChanged.INSTANCE; - overheadTextChanged.setActor(this); - overheadTextChanged.setOverheadText(overheadText); + OverheadTextChanged overheadTextChanged = new OverheadTextChanged(this, overheadText); client.getCallbacks().post(overheadTextChanged); } } @@ -256,7 +251,7 @@ public abstract class RSActorMixin implements RSActor { client.getLogger().debug("You died!"); - LocalPlayerDeath event = LocalPlayerDeath.INSTANCE; + LocalPlayerDeath event = new LocalPlayerDeath(); client.getCallbacks().post(event); } else if (this instanceof RSNPC) @@ -283,7 +278,7 @@ public abstract class RSActorMixin implements RSActor public void applyActorHitsplat(int type, int value, int var3, int var4, int gameCycle, int duration) { final Hitsplat hitsplat = new Hitsplat(Hitsplat.HitsplatType.fromInteger(type), value, gameCycle + duration); - final HitsplatApplied event = HitsplatApplied.INSTANCE; + final HitsplatApplied event = new HitsplatApplied(); event.setActor(this); event.setHitsplat(hitsplat); client.getCallbacks().post(event); diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSClanChatMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSClanChatMixin.java index c829abf231..beacf0eec4 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSClanChatMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSClanChatMixin.java @@ -27,8 +27,7 @@ public abstract class RSClanChatMixin implements RSClanChat return; } - ClanMemberJoined event = ClanMemberJoined.INSTANCE; - event.setMember(member); + ClanMemberJoined event = new ClanMemberJoined(member); client.getCallbacks().postDeferred(event); } @@ -42,8 +41,7 @@ public abstract class RSClanChatMixin implements RSClanChat return; } - ClanMemberLeft event = ClanMemberLeft.INSTANCE; - event.setMember(member); + ClanMemberLeft event = new ClanMemberLeft(member); client.getCallbacks().postDeferred(event); } } diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java index 762dd86fa5..069c9a99d4 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java @@ -867,7 +867,7 @@ public abstract class RSClientMixin implements RSClient @Inject public static void draggingWidgetChanged(int idx) { - DraggingWidgetChanged draggingWidgetChanged = DraggingWidgetChanged.INSTANCE; + DraggingWidgetChanged draggingWidgetChanged = new DraggingWidgetChanged(); draggingWidgetChanged.setDraggingWidget(client.isDraggingWidget()); client.getCallbacks().post(draggingWidgetChanged); } @@ -905,7 +905,7 @@ public abstract class RSClientMixin implements RSClient if (loaded) { - WidgetLoaded event = WidgetLoaded.INSTANCE; + WidgetLoaded event = new WidgetLoaded(); event.setGroupId(groupId); client.getCallbacks().post(event); } @@ -937,7 +937,7 @@ public abstract class RSClientMixin implements RSClient @Inject public static void experiencedChanged(int idx) { - ExperienceChanged experienceChanged = ExperienceChanged.INSTANCE; + ExperienceChanged experienceChanged = new ExperienceChanged(); Skill[] possibleSkills = Skill.values(); // We subtract one here because 'Overall' isn't considered a skill that's updated. @@ -958,7 +958,7 @@ public abstract class RSClientMixin implements RSClient if (idx >= 0 && idx < skills.length - 1) { Skill updatedSkill = skills[idx]; - BoostedLevelChanged boostedLevelChanged = BoostedLevelChanged.INSTANCE; + BoostedLevelChanged boostedLevelChanged = new BoostedLevelChanged(); boostedLevelChanged.setSkill(updatedSkill); client.getCallbacks().post(boostedLevelChanged); } @@ -977,7 +977,7 @@ public abstract class RSClientMixin implements RSClient client.getPlayerMenuTypes()[idx] = playerAction.getId(); } - PlayerMenuOptionsChanged optionsChanged = PlayerMenuOptionsChanged.INSTANCE; + PlayerMenuOptionsChanged optionsChanged = new PlayerMenuOptionsChanged(); optionsChanged.setIndex(idx); client.getCallbacks().post(optionsChanged); } @@ -986,7 +986,7 @@ public abstract class RSClientMixin implements RSClient @Inject public static void gameStateChanged(int idx) { - GameStateChanged gameStateChange = GameStateChanged.INSTANCE; + GameStateChanged gameStateChange = new GameStateChanged(); gameStateChange.setGameState(client.getGameState()); client.getCallbacks().post(gameStateChange); } @@ -1007,9 +1007,7 @@ public abstract class RSClientMixin implements RSClient { npc.setIndex(idx); - NpcSpawned npcSpawned = NpcSpawned.INSTANCE; - npcSpawned.setNpc(npc); - client.getCallbacks().postDeferred(npcSpawned); + client.getCallbacks().postDeferred(new NpcSpawned(npc)); } } @@ -1029,15 +1027,11 @@ public abstract class RSClientMixin implements RSClient if (oldPlayer != null) { - PlayerDespawned playerDespawned = PlayerDespawned.INSTANCE; - playerDespawned.setPlayer(oldPlayer); - client.getCallbacks().post(playerDespawned); + client.getCallbacks().post(new PlayerDespawned(oldPlayer)); } if (player != null) { - PlayerSpawned playerSpawned = PlayerSpawned.INSTANCE; - playerSpawned.setPlayer(player); - client.getCallbacks().postDeferred(playerSpawned); + client.getCallbacks().postDeferred(new PlayerSpawned(player)); } } @@ -1057,7 +1051,7 @@ public abstract class RSClientMixin implements RSClient return; } - GrandExchangeOfferChanged offerChangedEvent = GrandExchangeOfferChanged.INSTANCE; + GrandExchangeOfferChanged offerChangedEvent = new GrandExchangeOfferChanged(); offerChangedEvent.setOffer(internalOffer); offerChangedEvent.setSlot(idx); client.getCallbacks().post(offerChangedEvent); @@ -1067,7 +1061,7 @@ public abstract class RSClientMixin implements RSClient @Inject public static void settingsChanged(int idx) { - VarbitChanged varbitChanged = VarbitChanged.INSTANCE; + VarbitChanged varbitChanged = new VarbitChanged(); varbitChanged.setIndex(idx); client.getCallbacks().post(varbitChanged); } @@ -1081,7 +1075,7 @@ public abstract class RSClientMixin implements RSClient if (oldIsResized != isResized) { - ResizeableChanged resizeableChanged = ResizeableChanged.INSTANCE; + ResizeableChanged resizeableChanged = new ResizeableChanged(); resizeableChanged.setResized(isResized); client.getCallbacks().post(resizeableChanged); @@ -1093,9 +1087,7 @@ public abstract class RSClientMixin implements RSClient @Inject public static void clanMemberManagerChanged(int idx) { - ClanChanged event = ClanChanged.INSTANCE; - event.setJoined(client.getClanMemberManager() != null); - client.getCallbacks().post(event); + client.getCallbacks().post(new ClanChanged(client.getClanMemberManager() != null)); } @FieldHook("canvasWidth") @@ -1279,7 +1271,7 @@ public abstract class RSClientMixin implements RSClient @Inject public static void onUsernameChanged(int idx) { - client.getCallbacks().post(UsernameChanged.INSTANCE); + client.getCallbacks().post(new UsernameChanged()); } @Override @@ -1308,7 +1300,7 @@ public abstract class RSClientMixin implements RSClient @MethodHook("openMenu") public void menuOpened(int var1, int var2) { - final MenuOpened event = MenuOpened.INSTANCE; + final MenuOpened event = new MenuOpened(); event.setMenuEntries(getMenuEntries()); callbacks.post(event); } @@ -1521,7 +1513,7 @@ public abstract class RSClientMixin implements RSClient @FieldHook("cycleCntr") public static void onCycleCntrChanged(int idx) { - client.getCallbacks().post(ClientTick.INSTANCE); + client.getCallbacks().post(new ClientTick()); } @Copy("shouldLeftClickOpenMenu") @@ -1538,7 +1530,7 @@ public abstract class RSClientMixin implements RSClient return true; } - MenuShouldLeftClick menuShouldLeftClick = MenuShouldLeftClick.INSTANCE; + MenuShouldLeftClick menuShouldLeftClick = new MenuShouldLeftClick(); client.getCallbacks().post(menuShouldLeftClick); if (menuShouldLeftClick.isForceRightClick()) diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSFriendSystemMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSFriendSystemMixin.java index 6a495d7fd6..7497e7c2a5 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSFriendSystemMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSFriendSystemMixin.java @@ -18,8 +18,7 @@ public abstract class RSFriendSystemMixin implements RSFriendSystem @Inject public void rl$removeFriend(String friendName) { - RemovedFriend removedFriend = RemovedFriend.INSTANCE; - removedFriend.setName(friendName); + RemovedFriend removedFriend = new RemovedFriend(friendName); client.getCallbacks().post(removedFriend); } } diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSGraphicsObjectMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSGraphicsObjectMixin.java index 3fe720a8ab..c7757732ba 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSGraphicsObjectMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSGraphicsObjectMixin.java @@ -17,8 +17,7 @@ public abstract class RSGraphicsObjectMixin implements RSGraphicsObject @Inject RSGraphicsObjectMixin() { - final GraphicsObjectCreated event = GraphicsObjectCreated.INSTANCE; - event.setGraphicsObject(this); + final GraphicsObjectCreated event = new GraphicsObjectCreated(this); client.getCallbacks().post(event); } diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSGroundItemMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSGroundItemMixin.java index 078ca652e7..23d0ce6586 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSGroundItemMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSGroundItemMixin.java @@ -66,12 +66,7 @@ public abstract class RSGroundItemMixin implements RSGroundItem { client.getLogger().debug("Item quantity changed: {} ({} -> {})", getId(), getQuantity(), quantity); - ItemQuantityChanged itemQuantityChanged = ItemQuantityChanged.INSTANCE; - itemQuantityChanged.setItem(this); - itemQuantityChanged.setTile(getTile()); - itemQuantityChanged.setOldQuantity(getQuantity()); - itemQuantityChanged.setNewQuantity(quantity); - + ItemQuantityChanged itemQuantityChanged = new ItemQuantityChanged(this, getTile(), getQuantity(), quantity); client.getCallbacks().post(itemQuantityChanged); } } diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSHealthBarDefinitionMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSHealthBarDefinitionMixin.java index f7143c4fd1..f6f31abdf6 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSHealthBarDefinitionMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSHealthBarDefinitionMixin.java @@ -19,7 +19,7 @@ public abstract class RSHealthBarDefinitionMixin implements RSHealthBarDefinitio @Inject public void onRead(RSBuffer buffer) { - PostHealthBar postHealthBar = PostHealthBar.INSTANCE; + PostHealthBar postHealthBar = new PostHealthBar(); postHealthBar.setHealthBar(this); client.getCallbacks().post(postHealthBar); } diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSItemContainerMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSItemContainerMixin.java index 21cd6e9c72..74c1bf29a3 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSItemContainerMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSItemContainerMixin.java @@ -75,8 +75,7 @@ public abstract class RSItemContainerMixin implements RSItemContainer rl$lastCycle = cycle; - ItemContainerChanged event = ItemContainerChanged.INSTANCE; - event.setItemContainer(this); + ItemContainerChanged event = new ItemContainerChanged(this); client.getCallbacks().postDeferred(event); } diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSItemDefinitionMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSItemDefinitionMixin.java index 763dfcb0d6..68105f05bc 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSItemDefinitionMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSItemDefinitionMixin.java @@ -60,7 +60,7 @@ public abstract class RSItemDefinitionMixin implements RSItemDefinition @MethodHook(value = "post", end = true) public void post() { - final PostItemDefinition event = PostItemDefinition.INSTANCE; + final PostItemDefinition event = new PostItemDefinition(); event.setItemDefinition(this); client.getCallbacks().post(event); } diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSNPCDefinitionMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSNPCDefinitionMixin.java index 9c1d646c62..07d16f949a 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSNPCDefinitionMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSNPCDefinitionMixin.java @@ -42,7 +42,7 @@ public abstract class RSNPCDefinitionMixin implements RSNPCDefinition @Inject public void actionsHook(int idx) { - NpcActionChanged npcActionChanged = NpcActionChanged.INSTANCE; + NpcActionChanged npcActionChanged = new NpcActionChanged(); npcActionChanged.setNpcDefinition(this); npcActionChanged.setIdx(idx); client.getCallbacks().post(npcActionChanged); diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSNPCMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSNPCMixin.java index c9d2b0657b..ea0f74f93c 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSNPCMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSNPCMixin.java @@ -109,9 +109,7 @@ public abstract class RSNPCMixin implements RSNPC { if (composition == null) { - NpcDespawned event = NpcDespawned.INSTANCE; - event.setNpc(this); - client.getCallbacks().post(event); + client.getCallbacks().post(new NpcDespawned(this)); } } diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSProjectileMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSProjectileMixin.java index 221a81642f..1c10eeb835 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSProjectileMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSProjectileMixin.java @@ -46,7 +46,7 @@ public abstract class RSProjectileMixin implements RSProjectile @Inject RSProjectileMixin() { - final ProjectileSpawned projectileSpawned = ProjectileSpawned.INSTANCE; + final ProjectileSpawned projectileSpawned = new ProjectileSpawned(); projectileSpawned.setProjectile(this); client.getCallbacks().post(projectileSpawned); } @@ -105,7 +105,7 @@ public abstract class RSProjectileMixin implements RSProjectile public void projectileMoved(int targetX, int targetY, int targetZ, int cycle) { final LocalPoint position = new LocalPoint(targetX, targetY); - final ProjectileMoved projectileMoved = ProjectileMoved.INSTANCE; + final ProjectileMoved projectileMoved = new ProjectileMoved(); projectileMoved.setProjectile(this); projectileMoved.setPosition(position); projectileMoved.setZ(targetZ); diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSTileMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSTileMixin.java index 34b624cf88..ed17140360 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSTileMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSTileMixin.java @@ -126,21 +126,21 @@ public abstract class RSTileMixin implements RSTile if (current == null && previous != null) { - WallObjectDespawned wallObjectDespawned = WallObjectDespawned.INSTANCE; + WallObjectDespawned wallObjectDespawned = new WallObjectDespawned(); wallObjectDespawned.setTile(this); wallObjectDespawned.setWallObject(previous); client.getCallbacks().post(wallObjectDespawned); } else if (current != null && previous == null) { - WallObjectSpawned wallObjectSpawned = WallObjectSpawned.INSTANCE; + WallObjectSpawned wallObjectSpawned = new WallObjectSpawned(); wallObjectSpawned.setTile(this); wallObjectSpawned.setWallObject(current); client.getCallbacks().post(wallObjectSpawned); } else if (current != null) { - WallObjectChanged wallObjectChanged = WallObjectChanged.INSTANCE; + WallObjectChanged wallObjectChanged = new WallObjectChanged(); wallObjectChanged.setTile(this); wallObjectChanged.setPrevious(previous); wallObjectChanged.setWallObject(current); @@ -159,21 +159,21 @@ public abstract class RSTileMixin implements RSTile if (current == null && previous != null) { - DecorativeObjectDespawned decorativeObjectDespawned = DecorativeObjectDespawned.INSTANCE; + DecorativeObjectDespawned decorativeObjectDespawned = new DecorativeObjectDespawned(); decorativeObjectDespawned.setTile(this); decorativeObjectDespawned.setDecorativeObject(previous); client.getCallbacks().post(decorativeObjectDespawned); } else if (current != null && previous == null) { - DecorativeObjectSpawned decorativeObjectSpawned = DecorativeObjectSpawned.INSTANCE; + DecorativeObjectSpawned decorativeObjectSpawned = new DecorativeObjectSpawned(); decorativeObjectSpawned.setTile(this); decorativeObjectSpawned.setDecorativeObject(current); client.getCallbacks().post(decorativeObjectSpawned); } else if (current != null) { - DecorativeObjectChanged decorativeObjectChanged = DecorativeObjectChanged.INSTANCE; + DecorativeObjectChanged decorativeObjectChanged = new DecorativeObjectChanged(); decorativeObjectChanged.setTile(this); decorativeObjectChanged.setPrevious(previous); decorativeObjectChanged.setDecorativeObject(current); @@ -192,21 +192,21 @@ public abstract class RSTileMixin implements RSTile if (current == null && previous != null) { - GroundObjectDespawned groundObjectDespawned = GroundObjectDespawned.INSTANCE; + GroundObjectDespawned groundObjectDespawned = new GroundObjectDespawned(); groundObjectDespawned.setTile(this); groundObjectDespawned.setGroundObject(previous); client.getCallbacks().post(groundObjectDespawned); } else if (current != null && previous == null) { - GroundObjectSpawned groundObjectSpawned = GroundObjectSpawned.INSTANCE; + GroundObjectSpawned groundObjectSpawned = new GroundObjectSpawned(); groundObjectSpawned.setTile(this); groundObjectSpawned.setGroundObject(current); client.getCallbacks().post(groundObjectSpawned); } else if (current != null) { - GroundObjectChanged groundObjectChanged = GroundObjectChanged.INSTANCE; + GroundObjectChanged groundObjectChanged = new GroundObjectChanged(); groundObjectChanged.setTile(this); groundObjectChanged.setPrevious(previous); groundObjectChanged.setGroundObject(current); @@ -282,7 +282,7 @@ public abstract class RSTileMixin implements RSTile logger.trace("Game object despawn: {}", previous.getId()); - GameObjectDespawned gameObjectDespawned = GameObjectDespawned.INSTANCE; + GameObjectDespawned gameObjectDespawned = new GameObjectDespawned(); gameObjectDespawned.setTile(this); gameObjectDespawned.setGameObject(previous); client.getCallbacks().post(gameObjectDespawned); @@ -296,7 +296,7 @@ public abstract class RSTileMixin implements RSTile logger.trace("Game object spawn: {}", current.getId()); - GameObjectSpawned gameObjectSpawned = GameObjectSpawned.INSTANCE; + GameObjectSpawned gameObjectSpawned = new GameObjectSpawned(); gameObjectSpawned.setTile(this); gameObjectSpawned.setGameObject(current); client.getCallbacks().post(gameObjectSpawned); @@ -310,7 +310,7 @@ public abstract class RSTileMixin implements RSTile logger.trace("Game object change: {} -> {}", previous.getId(), current.getId()); - GameObjectChanged gameObjectsChanged = GameObjectChanged.INSTANCE; + GameObjectChanged gameObjectsChanged = new GameObjectChanged(); gameObjectsChanged.setTile(this); gameObjectsChanged.setPrevious(previous); gameObjectsChanged.setGameObject(current); @@ -339,9 +339,7 @@ public abstract class RSTileMixin implements RSTile for (RSNode cur = head.getNext(); cur != head; cur = cur.getNext()) { RSGroundItem item = (RSGroundItem) cur; - ItemDespawned itemDespawned = ItemDespawned.INSTANCE; - itemDespawned.setTile(this); - itemDespawned.setItem(item); + ItemDespawned itemDespawned = new ItemDespawned(this, item); client.getCallbacks().post(itemDespawned); } } @@ -359,9 +357,7 @@ public abstract class RSTileMixin implements RSTile { if (lastUnlink != null) { - ItemDespawned itemDespawned = ItemDespawned.INSTANCE; - itemDespawned.setTile(this); - itemDespawned.setItem(lastUnlink); + ItemDespawned itemDespawned = new ItemDespawned(this, lastUnlink); client.getCallbacks().post(itemDespawned); } return; @@ -373,9 +369,7 @@ public abstract class RSTileMixin implements RSTile { if (lastUnlink != null) { - ItemDespawned itemDespawned = ItemDespawned.INSTANCE; - itemDespawned.setTile(this); - itemDespawned.setItem(lastUnlink); + ItemDespawned itemDespawned = new ItemDespawned(this, lastUnlink); client.getCallbacks().post(itemDespawned); } return; @@ -408,9 +402,7 @@ public abstract class RSTileMixin implements RSTile if (lastUnlink != null && lastUnlink != previous && lastUnlink != next) { - ItemDespawned itemDespawned = ItemDespawned.INSTANCE; - itemDespawned.setTile(this); - itemDespawned.setItem(lastUnlink); + ItemDespawned itemDespawned = new ItemDespawned(this, lastUnlink); client.getCallbacks().post(itemDespawned); } @@ -425,9 +417,7 @@ public abstract class RSTileMixin implements RSTile item.setX(x); item.setY(y); - ItemSpawned itemSpawned = ItemSpawned.INSTANCE; - itemSpawned.setTile(this); - itemSpawned.setItem(item); + ItemSpawned itemSpawned = new ItemSpawned(this, item); client.getCallbacks().post(itemSpawned); current = forward ? current.getNext() : current.getPrevious(); diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSVarcsMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSVarcsMixin.java index e3d8db2864..86a757092b 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSVarcsMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSVarcsMixin.java @@ -19,17 +19,13 @@ public abstract class RSVarcsMixin implements RSVarcs @Inject public void onVarCIntChanged(int id, int value) { - VarClientIntChanged event = VarClientIntChanged.INSTANCE; - event.setIndex(id); - client.getCallbacks().post(event); + client.getCallbacks().post(new VarClientIntChanged(id)); } @MethodHook(value = "setString", end = true) @Inject public void onVarCStrChanged(int id, String value) { - VarClientStrChanged event = VarClientStrChanged.INSTANCE; - event.setIndex(id); - client.getCallbacks().post(event); + client.getCallbacks().post(new VarClientStrChanged(id)); } } diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSWidgetMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSWidgetMixin.java index 02b69facf0..4c59a88e53 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSWidgetMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSWidgetMixin.java @@ -408,7 +408,7 @@ public abstract class RSWidgetMixin implements RSWidget @Override public void broadcastHidden(boolean hidden) { - WidgetHiddenChanged event = WidgetHiddenChanged.INSTANCE; + WidgetHiddenChanged event = new WidgetHiddenChanged(); event.setWidget(this); event.setHidden(hidden); @@ -496,7 +496,7 @@ public abstract class RSWidgetMixin implements RSWidget client.getLogger().trace("Posting widget position changed"); - WidgetPositioned widgetPositioned = WidgetPositioned.INSTANCE; + WidgetPositioned widgetPositioned = new WidgetPositioned(); client.getCallbacks().postDeferred(widgetPositioned); } diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSWorldMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSWorldMixin.java index 2b8ff3fc30..eefb479963 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSWorldMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSWorldMixin.java @@ -62,8 +62,7 @@ public abstract class RSWorldMixin implements RSWorld if (worlds != null && worlds.length > 0 && worlds[worlds.length - 1] == this) { // this is the last world in the list. - WorldListLoad worldLoad = WorldListLoad.INSTANCE; - worldLoad.setWorlds(worlds); + WorldListLoad worldLoad = new WorldListLoad(worlds); client.getCallbacks().post(worldLoad); } } diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/ScriptVMMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/ScriptVMMixin.java index c1b2d09409..ab372ca932 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/ScriptVMMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/ScriptVMMixin.java @@ -98,7 +98,7 @@ public abstract class ScriptVMMixin implements RSClient return true; } - ScriptCallbackEvent event = ScriptCallbackEvent.INSTANCE; + ScriptCallbackEvent event = new ScriptCallbackEvent(); event.setScript(currentScript); event.setEventName(stringOp); client.getCallbacks().post(event); diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/SoundEffectMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/SoundEffectMixin.java index 737e0f0a54..6338d07521 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/SoundEffectMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/SoundEffectMixin.java @@ -120,7 +120,7 @@ public abstract class SoundEffectMixin implements RSClient { // Regular sound effect - SoundEffectPlayed event = SoundEffectPlayed.INSTANCE; + SoundEffectPlayed event = new SoundEffectPlayed(); event.setSoundId(client.getQueuedSoundEffectIDs()[soundIndex]); event.setDelay(client.getQueuedSoundEffectDelays()[soundIndex]); client.getCallbacks().post(event); @@ -133,7 +133,7 @@ public abstract class SoundEffectMixin implements RSClient int y = (packedLocation >> 8) & 0xFF; int range = (packedLocation) & 0xFF; - AreaSoundEffectPlayed event = AreaSoundEffectPlayed.INSTANCE; + AreaSoundEffectPlayed event = new AreaSoundEffectPlayed(); event.setSoundId(client.getQueuedSoundEffectIDs()[soundIndex]); event.setSceneX(x); event.setSceneY(y); From be5024290920c1899caf2dfdd957761d4043c0a0 Mon Sep 17 00:00:00 2001 From: Ian William O'Neill Date: Sat, 29 Jun 2019 23:02:11 +0100 Subject: [PATCH 34/58] Initial push for Chat Translation Plugin. --- runelite-client/pom.xml | 5 + .../ChatTranslationConfig.java | 32 ++++ .../ChatTranslationPlugin.java | 154 ++++++++++++++++++ .../plugins/chattranslation/Languages.java | 23 +++ .../plugins/chattranslation/Translator.java | 44 +++++ 5 files changed, 258 insertions(+) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationConfig.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationPlugin.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/Languages.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/Translator.java diff --git a/runelite-client/pom.xml b/runelite-client/pom.xml index 70c5c83000..98b1c9529c 100644 --- a/runelite-client/pom.xml +++ b/runelite-client/pom.xml @@ -284,6 +284,11 @@ asm-all 6.0_BETA + + org.json + json + 20180813 + diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationConfig.java new file mode 100644 index 0000000000..bf0e7a532b --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationConfig.java @@ -0,0 +1,32 @@ +package net.runelite.client.plugins.chattranslation; + +import net.runelite.client.config.Config; +import net.runelite.client.config.ConfigGroup; +import net.runelite.client.config.ConfigItem; + +@ConfigGroup("chattranslation") +public interface ChatTranslationConfig extends Config +{ + + @ConfigItem( + keyName = "publicChat", + name = "Translate All Public Chat?", + description = "Would you like to Translate Public Chat?", + position = 0 + ) + default boolean publicChat() { return false; } + + @ConfigItem( + keyName = "targetLanguage", + name = "Target Language", + description = "Language to translate messages too.", + position = 2, + hidden = true, + unhide = "publicChat" + ) + default Languages targetLanguage() + { + return Languages.ENGLISH; + } + +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationPlugin.java new file mode 100644 index 0000000000..da770088f9 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationPlugin.java @@ -0,0 +1,154 @@ +package net.runelite.client.plugins.chattranslation; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ObjectArrays; +import com.google.inject.Provides; +import net.runelite.api.*; +import net.runelite.api.events.ChatMessage; +import net.runelite.api.events.MenuEntryAdded; +import net.runelite.api.events.PlayerMenuOptionClicked; +import net.runelite.api.widgets.WidgetInfo; +import net.runelite.client.chat.ChatMessageManager; +import net.runelite.client.config.ConfigManager; +import net.runelite.client.eventbus.Subscribe; +import net.runelite.client.menus.MenuManager; +import net.runelite.client.plugins.Plugin; +import net.runelite.client.plugins.PluginDescriptor; +import net.runelite.client.plugins.PluginType; +import org.apache.commons.lang3.ArrayUtils; + +import javax.annotation.Nullable; +import javax.inject.Inject; +import javax.inject.Provider; + +@PluginDescriptor( + name = "Chat Translator", + description = "Translates messages from one Language to another.", + tags = {"translate", "language", "english", "spanish", "dutch", "french"}, + type = PluginType.UTILITY +) +public class ChatTranslationPlugin extends Plugin { + + public static final String TRANSLATE = "Translate"; + private static final ImmutableList AFTER_OPTIONS = ImmutableList.of("Message", "Add ignore", "Remove friend", "Kick"); + + @Inject + @Nullable + private Client client; + + @Inject + private Provider menuManager; + + @Inject + private ChatMessageManager chatMessageManager; + + @Inject + private ChatTranslationConfig config; + + @Provides + ChatTranslationConfig provideConfig(ConfigManager configManager) + { + return configManager.getConfig(ChatTranslationConfig.class); + } + + @Override + protected void startUp() throws Exception + { + if (client != null) + { + menuManager.get().addPlayerMenuItem(TRANSLATE); + } + } + + @Override + protected void shutDown() throws Exception + { + if (client != null) + { + menuManager.get().removePlayerMenuItem(TRANSLATE); + } + } + + @Subscribe + public void onPlayerMenuOptionClicked(PlayerMenuOptionClicked event) + { + if (event.getMenuOption().equals(TRANSLATE)) + { + //TODO: Translate selected message. + } + } + + @Subscribe + public void onMenuEntryAdded(MenuEntryAdded event) + { + int groupId = WidgetInfo.TO_GROUP(event.getActionParam1()); + String option = event.getOption(); + + if (groupId == WidgetInfo.CHATBOX.getGroupId()) + { + boolean after; + + if (!AFTER_OPTIONS.contains(option)) + { + return; + } + + final MenuEntry lookup = new MenuEntry(); + lookup.setOption(TRANSLATE); + lookup.setTarget(event.getTarget()); + lookup.setType(MenuAction.RUNELITE.getId()); + lookup.setParam0(event.getActionParam0()); + lookup.setParam1(event.getActionParam1()); + lookup.setIdentifier(event.getIdentifier()); + + insertMenuEntry(lookup, client.getMenuEntries()); + } + } + + @Subscribe + public void onChatMessage(ChatMessage chatMessage) + { + if (client.getGameState() != GameState.LOADING && client.getGameState() != GameState.LOGGED_IN) + { + return; + } + switch (chatMessage.getType()) + { + case PUBLICCHAT: + case MODCHAT: + if (!config.publicChat()) + { + return; + } + break; + default: + return; + } + + String message = chatMessage.getMessage(); + + Translator translator = new Translator(); + + try { + //Automatically check language of message and translate to selected language. + String translation = translator.translate("auto", config.targetLanguage().toString(), message); + + final MessageNode messageNode = chatMessage.getMessageNode(); + messageNode.setRuneLiteFormatMessage(translation); + chatMessageManager.update(messageNode); + } catch (Exception e) { + e.printStackTrace(); + } + + client.refreshChat(); + } + + private void insertMenuEntry(MenuEntry newEntry, MenuEntry[] entries) + { + MenuEntry[] newMenu = ObjectArrays.concat(entries, newEntry); + int menuEntryCount = newMenu.length; + ArrayUtils.swap(newMenu, menuEntryCount - 1, menuEntryCount - 2); + client.setMenuEntries(newMenu); + } + +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/Languages.java b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/Languages.java new file mode 100644 index 0000000000..695c1a637d --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/Languages.java @@ -0,0 +1,23 @@ +package net.runelite.client.plugins.chattranslation; + +public enum Languages { + + ENGLISH("en"), + DUTCH("nl"), + SPANISH("es"), + FRENCH("fr"); + + private final String shortName; + + Languages(String shortName) + { + this.shortName = shortName; + } + + @Override + public String toString() + { + return shortName; + } + +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/Translator.java b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/Translator.java new file mode 100644 index 0000000000..220ba888e8 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/Translator.java @@ -0,0 +1,44 @@ +package net.runelite.client.plugins.chattranslation; + +import org.json.JSONArray; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; +import java.net.URLEncoder; + +public class Translator { + + public String translate(String source, String target, String message) throws Exception + { + + String url = "https://translate.googleapis.com/translate_a/single?client=gtx&sl=" + source + "&tl=" + target + "&dt=t&q=" + URLEncoder.encode(message, "UTF-8"); + + URL obj = new URL(url); + HttpURLConnection con = (HttpURLConnection) obj.openConnection(); + con.setRequestProperty("User-Agent", "Mozilla/5.0"); + + BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); + String inputLine; + StringBuffer response = new StringBuffer(); + + while ((inputLine = in.readLine()) != null) { + response.append(inputLine); + } + in.close(); + + return parseResult(response.toString()); + } + + private String parseResult(String inputJson) throws Exception + { + //TODO: find a way to do this using google.gson + JSONArray jsonArray = new JSONArray(inputJson); + JSONArray jsonArray2 = (JSONArray) jsonArray.get(0); + JSONArray jsonArray3 = (JSONArray) jsonArray2.get(0); + + return jsonArray3.get(0).toString(); + } + +} From 358b8d05d0579c63a89e62e2cd1533aeefec89f2 Mon Sep 17 00:00:00 2001 From: Ganom Date: Sat, 29 Jun 2019 18:18:29 -0400 Subject: [PATCH 35/58] Add NPC Composition Changed Event (#820) --- .../api/events/NpcCompositionChanged.java | 40 +++++++++++++++++++ .../java/net/runelite/mixins/RSNPCMixin.java | 13 +++++- 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 runelite-api/src/main/java/net/runelite/api/events/NpcCompositionChanged.java diff --git a/runelite-api/src/main/java/net/runelite/api/events/NpcCompositionChanged.java b/runelite-api/src/main/java/net/runelite/api/events/NpcCompositionChanged.java new file mode 100644 index 0000000000..29cdd890b6 --- /dev/null +++ b/runelite-api/src/main/java/net/runelite/api/events/NpcCompositionChanged.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2018, Woox + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.api.events; + +import lombok.Value; +import net.runelite.api.NPC; + +/** + * Fires after the composition of an {@link NPC} changes. + */ +@Value +public class NpcCompositionChanged +{ + /** + * The NPC of which the composition changed. + */ + private final NPC npc; +} \ No newline at end of file diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSNPCMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSNPCMixin.java index ea0f74f93c..9b58f3eb2c 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSNPCMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSNPCMixin.java @@ -24,12 +24,13 @@ */ package net.runelite.mixins; +import java.awt.Polygon; import net.runelite.api.AnimationID; import net.runelite.api.NPCDefinition; import net.runelite.api.Perspective; import net.runelite.api.coords.LocalPoint; +import net.runelite.api.events.NpcCompositionChanged; import net.runelite.api.events.NpcDespawned; -import java.awt.Polygon; import net.runelite.api.mixins.Copy; import net.runelite.api.mixins.FieldHook; import net.runelite.api.mixins.Inject; @@ -113,6 +114,16 @@ public abstract class RSNPCMixin implements RSNPC } } + @FieldHook("definition") + @Inject + public void afterCompositionChanged(int idx) + { + if (this.getDefinition() != null && this.getId() != -1) + { + client.getCallbacks().post(new NpcCompositionChanged(this)); + } + } + @Copy("getModel") public abstract RSModel rs$getModel(); From 3c0e1bef47c2ab0f52d0e978497696915af1fbfa Mon Sep 17 00:00:00 2001 From: Ian William O'Neill Date: Sun, 30 Jun 2019 01:47:14 +0100 Subject: [PATCH 36/58] Need help adding the 'Translate' menu option for translating selected Players messages. Finished outgoing message translation however if the user has been limited by Google for the likes of using the Public Chat translation in over populated and spammy areas such as the GE they will not be able to send a message for upto 5 minutes while the Player Chat Translation config is enabled. Need to think more about ways to handle this though once the selective translation has been completed we can safely remove the 'All' public chat messages part of the plugin to prevent users from being Limited by Google. --- .../ChatTranslationConfig.java | 35 ++++++- .../ChatTranslationPlugin.java | 94 ++++++++++++++++--- 2 files changed, 111 insertions(+), 18 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationConfig.java index bf0e7a532b..8a05db21b0 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationConfig.java @@ -10,23 +10,48 @@ public interface ChatTranslationConfig extends Config @ConfigItem( keyName = "publicChat", - name = "Translate All Public Chat?", + name = "Translate incoming Messages", description = "Would you like to Translate Public Chat?", - position = 0 + position = 0, + group = "Public Chat Translation" ) default boolean publicChat() { return false; } @ConfigItem( - keyName = "targetLanguage", + keyName = "publicTargetLanguage", name = "Target Language", description = "Language to translate messages too.", - position = 2, + position = 1, + group = "Public Chat Translation", hidden = true, unhide = "publicChat" ) - default Languages targetLanguage() + default Languages publicTargetLanguage() { return Languages.ENGLISH; } + @ConfigItem( + keyName = "playerChat", + name = "Translate outgoing Messages", + description = "Would you like to Translate your Messages?", + position = 2, + group = "Player Message Translation" + ) + default boolean playerChat() { return false; } + + @ConfigItem( + keyName = "playerTargetLanguage", + name = "Target Language", + description = "Language to translate messages too.", + position = 3, + group = "Player Message Translation", + hidden = true, + unhide = "playerChat" + ) + default Languages playerTargetLanguage() + { + return Languages.SPANISH; + } + } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationPlugin.java index da770088f9..fde7c98be7 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationPlugin.java @@ -7,10 +7,14 @@ import net.runelite.api.*; import net.runelite.api.events.ChatMessage; import net.runelite.api.events.MenuEntryAdded; import net.runelite.api.events.PlayerMenuOptionClicked; +import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.WidgetInfo; +import net.runelite.client.callback.ClientThread; import net.runelite.client.chat.ChatMessageManager; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; +import net.runelite.client.input.KeyListener; +import net.runelite.client.input.KeyManager; import net.runelite.client.menus.MenuManager; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; @@ -20,6 +24,7 @@ import org.apache.commons.lang3.ArrayUtils; import javax.annotation.Nullable; import javax.inject.Inject; import javax.inject.Provider; +import java.awt.event.KeyEvent; @PluginDescriptor( name = "Chat Translator", @@ -27,21 +32,26 @@ import javax.inject.Provider; tags = {"translate", "language", "english", "spanish", "dutch", "french"}, type = PluginType.UTILITY ) -public class ChatTranslationPlugin extends Plugin { +public class ChatTranslationPlugin extends Plugin implements KeyListener { public static final String TRANSLATE = "Translate"; private static final ImmutableList AFTER_OPTIONS = ImmutableList.of("Message", "Add ignore", "Remove friend", "Kick"); @Inject - @Nullable private Client client; + @Inject + private ClientThread clientThread; + @Inject private Provider menuManager; @Inject private ChatMessageManager chatMessageManager; + @Inject + private KeyManager keyManager; + @Inject private ChatTranslationConfig config; @@ -58,6 +68,7 @@ public class ChatTranslationPlugin extends Plugin { { menuManager.get().addPlayerMenuItem(TRANSLATE); } + keyManager.registerKeyListener(this); } @Override @@ -67,6 +78,7 @@ public class ChatTranslationPlugin extends Plugin { { menuManager.get().removePlayerMenuItem(TRANSLATE); } + keyManager.unregisterKeyListener(this); } @Subscribe @@ -101,7 +113,10 @@ public class ChatTranslationPlugin extends Plugin { lookup.setParam1(event.getActionParam1()); lookup.setIdentifier(event.getIdentifier()); - insertMenuEntry(lookup, client.getMenuEntries()); + MenuEntry[] newMenu = ObjectArrays.concat(lookup, client.getMenuEntries()); + int menuEntryCount = newMenu.length; + ArrayUtils.swap(newMenu, menuEntryCount - 1, menuEntryCount - 2); + client.setMenuEntries(newMenu); } } @@ -131,11 +146,13 @@ public class ChatTranslationPlugin extends Plugin { try { //Automatically check language of message and translate to selected language. - String translation = translator.translate("auto", config.targetLanguage().toString(), message); - - final MessageNode messageNode = chatMessage.getMessageNode(); - messageNode.setRuneLiteFormatMessage(translation); - chatMessageManager.update(messageNode); + String translation = translator.translate("auto", config.publicTargetLanguage().toString(), message); + if (translation != null) + { + final MessageNode messageNode = chatMessage.getMessageNode(); + messageNode.setRuneLiteFormatMessage(translation); + chatMessageManager.update(messageNode); + } } catch (Exception e) { e.printStackTrace(); } @@ -143,12 +160,63 @@ public class ChatTranslationPlugin extends Plugin { client.refreshChat(); } - private void insertMenuEntry(MenuEntry newEntry, MenuEntry[] entries) + @Override + public void keyPressed(KeyEvent event) { + if (client.getGameState() != GameState.LOADING && client.getGameState() != GameState.LOGGED_IN) { + return; + } + + if (!config.playerChat()) + { + return; + } + + Widget chatboxParent = client.getWidget(WidgetInfo.CHATBOX_PARENT); + + if (chatboxParent != null && chatboxParent.getOnKeyListener() != null) + { + if (event.getKeyCode() == 0xA) + { + event.consume(); + + Translator translator = new Translator(); + + String message = client.getVar(VarClientStr.CHATBOX_TYPED_TEXT); + + try { + //Automatically check language of message and translate to selected language. + String translation = translator.translate("auto", config.playerTargetLanguage().toString(), message); + + if (translation != null) + { + client.setVar(VarClientStr.CHATBOX_TYPED_TEXT, translation); + + clientThread.invoke(() -> { + client.runScript(96, 0, translation); + }); + + } + + client.setVar(VarClientStr.CHATBOX_TYPED_TEXT, ""); + } catch (Exception e) { + e.printStackTrace(); + } + } + } else { + return; + } + } + + @Override + public void keyReleased(KeyEvent e) { - MenuEntry[] newMenu = ObjectArrays.concat(entries, newEntry); - int menuEntryCount = newMenu.length; - ArrayUtils.swap(newMenu, menuEntryCount - 1, menuEntryCount - 2); - client.setMenuEntries(newMenu); + // Nothing. + } + + @Override + public void keyTyped(KeyEvent e) + { + // Nothing. } } From 608471f30d7bad0160f58e2937025095ae7512df Mon Sep 17 00:00:00 2001 From: Ian William O'Neill Date: Sun, 30 Jun 2019 02:32:13 +0100 Subject: [PATCH 37/58] Clean-up for Travis. --- .../ChatTranslationConfig.java | 10 ++++-- .../ChatTranslationPlugin.java | 34 +++++++++++++------ .../plugins/chattranslation/Languages.java | 3 +- .../plugins/chattranslation/Translator.java | 6 ++-- 4 files changed, 37 insertions(+), 16 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationConfig.java index 8a05db21b0..d93356c2a5 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationConfig.java @@ -15,7 +15,10 @@ public interface ChatTranslationConfig extends Config position = 0, group = "Public Chat Translation" ) - default boolean publicChat() { return false; } + default boolean publicChat() + { + return false; + } @ConfigItem( keyName = "publicTargetLanguage", @@ -38,7 +41,10 @@ public interface ChatTranslationConfig extends Config position = 2, group = "Player Message Translation" ) - default boolean playerChat() { return false; } + default boolean playerChat() + { + return false; + } @ConfigItem( keyName = "playerTargetLanguage", diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationPlugin.java index fde7c98be7..743f89a096 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationPlugin.java @@ -21,7 +21,6 @@ import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginType; import org.apache.commons.lang3.ArrayUtils; -import javax.annotation.Nullable; import javax.inject.Inject; import javax.inject.Provider; import java.awt.event.KeyEvent; @@ -32,7 +31,8 @@ import java.awt.event.KeyEvent; tags = {"translate", "language", "english", "spanish", "dutch", "french"}, type = PluginType.UTILITY ) -public class ChatTranslationPlugin extends Plugin implements KeyListener { +public class ChatTranslationPlugin extends Plugin implements KeyListener +{ public static final String TRANSLATE = "Translate"; private static final ImmutableList AFTER_OPTIONS = ImmutableList.of("Message", "Add ignore", "Remove friend", "Kick"); @@ -144,7 +144,8 @@ public class ChatTranslationPlugin extends Plugin implements KeyListener { Translator translator = new Translator(); - try { + try + { //Automatically check language of message and translate to selected language. String translation = translator.translate("auto", config.publicTargetLanguage().toString(), message); if (translation != null) @@ -153,7 +154,9 @@ public class ChatTranslationPlugin extends Plugin implements KeyListener { messageNode.setRuneLiteFormatMessage(translation); chatMessageManager.update(messageNode); } - } catch (Exception e) { + } + catch (Exception e) + { e.printStackTrace(); } @@ -161,8 +164,10 @@ public class ChatTranslationPlugin extends Plugin implements KeyListener { } @Override - public void keyPressed(KeyEvent event) { - if (client.getGameState() != GameState.LOADING && client.getGameState() != GameState.LOGGED_IN) { + public void keyPressed(KeyEvent event) + { + if (client.getGameState() != GameState.LOADING && client.getGameState() != GameState.LOGGED_IN) + { return; } @@ -183,7 +188,8 @@ public class ChatTranslationPlugin extends Plugin implements KeyListener { String message = client.getVar(VarClientStr.CHATBOX_TYPED_TEXT); - try { + try + { //Automatically check language of message and translate to selected language. String translation = translator.translate("auto", config.playerTargetLanguage().toString(), message); @@ -191,18 +197,24 @@ public class ChatTranslationPlugin extends Plugin implements KeyListener { { client.setVar(VarClientStr.CHATBOX_TYPED_TEXT, translation); - clientThread.invoke(() -> { + clientThread.invoke(() -> + { client.runScript(96, 0, translation); - }); + } + ); } client.setVar(VarClientStr.CHATBOX_TYPED_TEXT, ""); - } catch (Exception e) { + } + catch (Exception e) + { e.printStackTrace(); } } - } else { + } + else + { return; } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/Languages.java b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/Languages.java index 695c1a637d..3ec7b3ad81 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/Languages.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/Languages.java @@ -1,6 +1,7 @@ package net.runelite.client.plugins.chattranslation; -public enum Languages { +public enum Languages +{ ENGLISH("en"), DUTCH("nl"), diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/Translator.java b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/Translator.java index 220ba888e8..df8f26ea29 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/Translator.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/Translator.java @@ -8,7 +8,8 @@ import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; -public class Translator { +public class Translator +{ public String translate(String source, String target, String message) throws Exception { @@ -23,7 +24,8 @@ public class Translator { String inputLine; StringBuffer response = new StringBuffer(); - while ((inputLine = in.readLine()) != null) { + while ((inputLine = in.readLine()) != null) + { response.append(inputLine); } in.close(); From 50b6c1119fc005cfa6ab6e8e2a88c1dc33692fd1 Mon Sep 17 00:00:00 2001 From: Ian William O'Neill Date: Sun, 30 Jun 2019 13:41:33 +0100 Subject: [PATCH 38/58] Hidden the Public Chat Translation until a better implementation is added to prevent users from being accidentally locked out by Google. --- .../client/plugins/chattranslation/ChatTranslationConfig.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationConfig.java index d93356c2a5..89201516ea 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationConfig.java @@ -13,7 +13,8 @@ public interface ChatTranslationConfig extends Config name = "Translate incoming Messages", description = "Would you like to Translate Public Chat?", position = 0, - group = "Public Chat Translation" + group = "Public Chat Translation", + hidden = true ) default boolean publicChat() { From 08134881e8a39ad58f14617a1d6de741c8cff465 Mon Sep 17 00:00:00 2001 From: Ian William O'Neill Date: Sun, 30 Jun 2019 14:23:43 +0100 Subject: [PATCH 39/58] Hidden the Public Chat Translation until a better implementation is added to prevent users from being accidentally locked out by Google. --- .../client/plugins/chattranslation/ChatTranslationConfig.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationConfig.java index 89201516ea..c7fd268532 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationConfig.java @@ -27,8 +27,8 @@ public interface ChatTranslationConfig extends Config description = "Language to translate messages too.", position = 1, group = "Public Chat Translation", - hidden = true, - unhide = "publicChat" + hidden = true +// unhide = "publicChat" ) default Languages publicTargetLanguage() { From c41709de1f5afdc8af00286f02cbe569ea337026 Mon Sep 17 00:00:00 2001 From: Ian William O'Neill Date: Sun, 30 Jun 2019 14:37:49 +0100 Subject: [PATCH 40/58] Added config options for adding the 'Translate' right-click menu option in the Chatbox. (More so to hide it while the Public Chat Translate part of the plugin is disabled/hidden.) --- .../ChatTranslationConfig.java | 20 +++++- .../ChatTranslationPlugin.java | 68 ++++++++++--------- 2 files changed, 52 insertions(+), 36 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationConfig.java index c7fd268532..3bc0a31f9f 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationConfig.java @@ -21,11 +21,25 @@ public interface ChatTranslationConfig extends Config return false; } + @ConfigItem( + keyName = "translateOptionVisable", + name = "Show 'Translate' menu option", + description = "Adds 'Translate' to the right-click menu in the Chatbox.", + position = 1, + group = "Public Chat Translation", + hidden = true +// unhide = "publicChat" + ) + default boolean translateOptionVisable() + { + return true; + } + @ConfigItem( keyName = "publicTargetLanguage", name = "Target Language", description = "Language to translate messages too.", - position = 1, + position = 2, group = "Public Chat Translation", hidden = true // unhide = "publicChat" @@ -39,7 +53,7 @@ public interface ChatTranslationConfig extends Config keyName = "playerChat", name = "Translate outgoing Messages", description = "Would you like to Translate your Messages?", - position = 2, + position = 3, group = "Player Message Translation" ) default boolean playerChat() @@ -51,7 +65,7 @@ public interface ChatTranslationConfig extends Config keyName = "playerTargetLanguage", name = "Target Language", description = "Language to translate messages too.", - position = 3, + position = 4, group = "Player Message Translation", hidden = true, unhide = "playerChat" diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationPlugin.java index 743f89a096..85dc748859 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationPlugin.java @@ -34,7 +34,7 @@ import java.awt.event.KeyEvent; public class ChatTranslationPlugin extends Plugin implements KeyListener { - public static final String TRANSLATE = "Translate"; + private static final String TRANSLATE = "Translate"; private static final ImmutableList AFTER_OPTIONS = ImmutableList.of("Message", "Add ignore", "Remove friend", "Kick"); @Inject @@ -66,7 +66,10 @@ public class ChatTranslationPlugin extends Plugin implements KeyListener { if (client != null) { - menuManager.get().addPlayerMenuItem(TRANSLATE); + if (config.translateOptionVisable()) + { + menuManager.get().addPlayerMenuItem(TRANSLATE); + } } keyManager.registerKeyListener(this); } @@ -76,7 +79,10 @@ public class ChatTranslationPlugin extends Plugin implements KeyListener { if (client != null) { - menuManager.get().removePlayerMenuItem(TRANSLATE); + if (config.translateOptionVisable()) + { + menuManager.get().removePlayerMenuItem(TRANSLATE); + } } keyManager.unregisterKeyListener(this); } @@ -93,6 +99,11 @@ public class ChatTranslationPlugin extends Plugin implements KeyListener @Subscribe public void onMenuEntryAdded(MenuEntryAdded event) { + if (!config.translateOptionVisable()) + { + return; + } + int groupId = WidgetInfo.TO_GROUP(event.getActionParam1()); String option = event.getOption(); @@ -180,42 +191,33 @@ public class ChatTranslationPlugin extends Plugin implements KeyListener if (chatboxParent != null && chatboxParent.getOnKeyListener() != null) { - if (event.getKeyCode() == 0xA) + if (event.getKeyCode() == 0xA) + { + event.consume(); + + Translator translator = new Translator(); + String message = client.getVar(VarClientStr.CHATBOX_TYPED_TEXT); + + try { - event.consume(); - - Translator translator = new Translator(); - - String message = client.getVar(VarClientStr.CHATBOX_TYPED_TEXT); - - try + //Automatically check language of message and translate to selected language. + String translation = translator.translate("auto", config.playerTargetLanguage().toString(), message); + if (translation != null) { - //Automatically check language of message and translate to selected language. - String translation = translator.translate("auto", config.playerTargetLanguage().toString(), message); + client.setVar(VarClientStr.CHATBOX_TYPED_TEXT, translation); - if (translation != null) + clientThread.invoke(() -> { - client.setVar(VarClientStr.CHATBOX_TYPED_TEXT, translation); - - clientThread.invoke(() -> - { - client.runScript(96, 0, translation); - } - ); - - } - - client.setVar(VarClientStr.CHATBOX_TYPED_TEXT, ""); - } - catch (Exception e) - { - e.printStackTrace(); + client.runScript(96, 0, translation); + }); } + client.setVar(VarClientStr.CHATBOX_TYPED_TEXT, ""); } - } - else - { - return; + catch (Exception e) + { + e.printStackTrace(); + } + } } } From 65e48ab2070e2f5941b943fcd62fcde2e7081b52 Mon Sep 17 00:00:00 2001 From: Ian William O'Neill Date: Sun, 30 Jun 2019 14:41:33 +0100 Subject: [PATCH 41/58] Update ChatTranslationConfig.java --- .../client/plugins/chattranslation/ChatTranslationConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationConfig.java index 3bc0a31f9f..565aec82d8 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationConfig.java @@ -32,7 +32,7 @@ public interface ChatTranslationConfig extends Config ) default boolean translateOptionVisable() { - return true; + return false; } @ConfigItem( From 69dbeb523db6518e7e0242dba4644b4db67bf392 Mon Sep 17 00:00:00 2001 From: Ian William O'Neill Date: Mon, 1 Jul 2019 01:23:21 +0100 Subject: [PATCH 42/58] Chat Translator plugin (#824) * Initial push for Chat Translation Plugin. * Need help adding the 'Translate' menu option for translating selected Players messages. Finished outgoing message translation however if the user has been limited by Google for the likes of using the Public Chat translation in over populated and spammy areas such as the GE they will not be able to send a message for upto 5 minutes while the Player Chat Translation config is enabled. Need to think more about ways to handle this though once the selective translation has been completed we can safely remove the 'All' public chat messages part of the plugin to prevent users from being Limited by Google. * Clean-up for Travis. * Hidden the Public Chat Translation until a better implementation is added to prevent users from being accidentally locked out by Google. * Hidden the Public Chat Translation until a better implementation is added to prevent users from being accidentally locked out by Google. * Added config options for adding the 'Translate' right-click menu option in the Chatbox. (More so to hide it while the Public Chat Translate part of the plugin is disabled/hidden.) * Update ChatTranslationConfig.java --- runelite-client/pom.xml | 5 + .../ChatTranslationConfig.java | 78 ++++++ .../ChatTranslationPlugin.java | 236 ++++++++++++++++++ .../plugins/chattranslation/Languages.java | 24 ++ .../plugins/chattranslation/Translator.java | 46 ++++ 5 files changed, 389 insertions(+) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationConfig.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationPlugin.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/Languages.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/Translator.java diff --git a/runelite-client/pom.xml b/runelite-client/pom.xml index 70c5c83000..98b1c9529c 100644 --- a/runelite-client/pom.xml +++ b/runelite-client/pom.xml @@ -284,6 +284,11 @@ asm-all 6.0_BETA + + org.json + json + 20180813 + diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationConfig.java new file mode 100644 index 0000000000..565aec82d8 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationConfig.java @@ -0,0 +1,78 @@ +package net.runelite.client.plugins.chattranslation; + +import net.runelite.client.config.Config; +import net.runelite.client.config.ConfigGroup; +import net.runelite.client.config.ConfigItem; + +@ConfigGroup("chattranslation") +public interface ChatTranslationConfig extends Config +{ + + @ConfigItem( + keyName = "publicChat", + name = "Translate incoming Messages", + description = "Would you like to Translate Public Chat?", + position = 0, + group = "Public Chat Translation", + hidden = true + ) + default boolean publicChat() + { + return false; + } + + @ConfigItem( + keyName = "translateOptionVisable", + name = "Show 'Translate' menu option", + description = "Adds 'Translate' to the right-click menu in the Chatbox.", + position = 1, + group = "Public Chat Translation", + hidden = true +// unhide = "publicChat" + ) + default boolean translateOptionVisable() + { + return false; + } + + @ConfigItem( + keyName = "publicTargetLanguage", + name = "Target Language", + description = "Language to translate messages too.", + position = 2, + group = "Public Chat Translation", + hidden = true +// unhide = "publicChat" + ) + default Languages publicTargetLanguage() + { + return Languages.ENGLISH; + } + + @ConfigItem( + keyName = "playerChat", + name = "Translate outgoing Messages", + description = "Would you like to Translate your Messages?", + position = 3, + group = "Player Message Translation" + ) + default boolean playerChat() + { + return false; + } + + @ConfigItem( + keyName = "playerTargetLanguage", + name = "Target Language", + description = "Language to translate messages too.", + position = 4, + group = "Player Message Translation", + hidden = true, + unhide = "playerChat" + ) + default Languages playerTargetLanguage() + { + return Languages.SPANISH; + } + +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationPlugin.java new file mode 100644 index 0000000000..85dc748859 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationPlugin.java @@ -0,0 +1,236 @@ +package net.runelite.client.plugins.chattranslation; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ObjectArrays; +import com.google.inject.Provides; +import net.runelite.api.*; +import net.runelite.api.events.ChatMessage; +import net.runelite.api.events.MenuEntryAdded; +import net.runelite.api.events.PlayerMenuOptionClicked; +import net.runelite.api.widgets.Widget; +import net.runelite.api.widgets.WidgetInfo; +import net.runelite.client.callback.ClientThread; +import net.runelite.client.chat.ChatMessageManager; +import net.runelite.client.config.ConfigManager; +import net.runelite.client.eventbus.Subscribe; +import net.runelite.client.input.KeyListener; +import net.runelite.client.input.KeyManager; +import net.runelite.client.menus.MenuManager; +import net.runelite.client.plugins.Plugin; +import net.runelite.client.plugins.PluginDescriptor; +import net.runelite.client.plugins.PluginType; +import org.apache.commons.lang3.ArrayUtils; + +import javax.inject.Inject; +import javax.inject.Provider; +import java.awt.event.KeyEvent; + +@PluginDescriptor( + name = "Chat Translator", + description = "Translates messages from one Language to another.", + tags = {"translate", "language", "english", "spanish", "dutch", "french"}, + type = PluginType.UTILITY +) +public class ChatTranslationPlugin extends Plugin implements KeyListener +{ + + private static final String TRANSLATE = "Translate"; + private static final ImmutableList AFTER_OPTIONS = ImmutableList.of("Message", "Add ignore", "Remove friend", "Kick"); + + @Inject + private Client client; + + @Inject + private ClientThread clientThread; + + @Inject + private Provider menuManager; + + @Inject + private ChatMessageManager chatMessageManager; + + @Inject + private KeyManager keyManager; + + @Inject + private ChatTranslationConfig config; + + @Provides + ChatTranslationConfig provideConfig(ConfigManager configManager) + { + return configManager.getConfig(ChatTranslationConfig.class); + } + + @Override + protected void startUp() throws Exception + { + if (client != null) + { + if (config.translateOptionVisable()) + { + menuManager.get().addPlayerMenuItem(TRANSLATE); + } + } + keyManager.registerKeyListener(this); + } + + @Override + protected void shutDown() throws Exception + { + if (client != null) + { + if (config.translateOptionVisable()) + { + menuManager.get().removePlayerMenuItem(TRANSLATE); + } + } + keyManager.unregisterKeyListener(this); + } + + @Subscribe + public void onPlayerMenuOptionClicked(PlayerMenuOptionClicked event) + { + if (event.getMenuOption().equals(TRANSLATE)) + { + //TODO: Translate selected message. + } + } + + @Subscribe + public void onMenuEntryAdded(MenuEntryAdded event) + { + if (!config.translateOptionVisable()) + { + return; + } + + int groupId = WidgetInfo.TO_GROUP(event.getActionParam1()); + String option = event.getOption(); + + if (groupId == WidgetInfo.CHATBOX.getGroupId()) + { + boolean after; + + if (!AFTER_OPTIONS.contains(option)) + { + return; + } + + final MenuEntry lookup = new MenuEntry(); + lookup.setOption(TRANSLATE); + lookup.setTarget(event.getTarget()); + lookup.setType(MenuAction.RUNELITE.getId()); + lookup.setParam0(event.getActionParam0()); + lookup.setParam1(event.getActionParam1()); + lookup.setIdentifier(event.getIdentifier()); + + MenuEntry[] newMenu = ObjectArrays.concat(lookup, client.getMenuEntries()); + int menuEntryCount = newMenu.length; + ArrayUtils.swap(newMenu, menuEntryCount - 1, menuEntryCount - 2); + client.setMenuEntries(newMenu); + } + } + + @Subscribe + public void onChatMessage(ChatMessage chatMessage) + { + if (client.getGameState() != GameState.LOADING && client.getGameState() != GameState.LOGGED_IN) + { + return; + } + switch (chatMessage.getType()) + { + case PUBLICCHAT: + case MODCHAT: + if (!config.publicChat()) + { + return; + } + break; + default: + return; + } + + String message = chatMessage.getMessage(); + + Translator translator = new Translator(); + + try + { + //Automatically check language of message and translate to selected language. + String translation = translator.translate("auto", config.publicTargetLanguage().toString(), message); + if (translation != null) + { + final MessageNode messageNode = chatMessage.getMessageNode(); + messageNode.setRuneLiteFormatMessage(translation); + chatMessageManager.update(messageNode); + } + } + catch (Exception e) + { + e.printStackTrace(); + } + + client.refreshChat(); + } + + @Override + public void keyPressed(KeyEvent event) + { + if (client.getGameState() != GameState.LOADING && client.getGameState() != GameState.LOGGED_IN) + { + return; + } + + if (!config.playerChat()) + { + return; + } + + Widget chatboxParent = client.getWidget(WidgetInfo.CHATBOX_PARENT); + + if (chatboxParent != null && chatboxParent.getOnKeyListener() != null) + { + if (event.getKeyCode() == 0xA) + { + event.consume(); + + Translator translator = new Translator(); + String message = client.getVar(VarClientStr.CHATBOX_TYPED_TEXT); + + try + { + //Automatically check language of message and translate to selected language. + String translation = translator.translate("auto", config.playerTargetLanguage().toString(), message); + if (translation != null) + { + client.setVar(VarClientStr.CHATBOX_TYPED_TEXT, translation); + + clientThread.invoke(() -> + { + client.runScript(96, 0, translation); + }); + } + client.setVar(VarClientStr.CHATBOX_TYPED_TEXT, ""); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + } + } + + @Override + public void keyReleased(KeyEvent e) + { + // Nothing. + } + + @Override + public void keyTyped(KeyEvent e) + { + // Nothing. + } + +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/Languages.java b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/Languages.java new file mode 100644 index 0000000000..3ec7b3ad81 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/Languages.java @@ -0,0 +1,24 @@ +package net.runelite.client.plugins.chattranslation; + +public enum Languages +{ + + ENGLISH("en"), + DUTCH("nl"), + SPANISH("es"), + FRENCH("fr"); + + private final String shortName; + + Languages(String shortName) + { + this.shortName = shortName; + } + + @Override + public String toString() + { + return shortName; + } + +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/Translator.java b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/Translator.java new file mode 100644 index 0000000000..df8f26ea29 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/Translator.java @@ -0,0 +1,46 @@ +package net.runelite.client.plugins.chattranslation; + +import org.json.JSONArray; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; +import java.net.URLEncoder; + +public class Translator +{ + + public String translate(String source, String target, String message) throws Exception + { + + String url = "https://translate.googleapis.com/translate_a/single?client=gtx&sl=" + source + "&tl=" + target + "&dt=t&q=" + URLEncoder.encode(message, "UTF-8"); + + URL obj = new URL(url); + HttpURLConnection con = (HttpURLConnection) obj.openConnection(); + con.setRequestProperty("User-Agent", "Mozilla/5.0"); + + BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); + String inputLine; + StringBuffer response = new StringBuffer(); + + while ((inputLine = in.readLine()) != null) + { + response.append(inputLine); + } + in.close(); + + return parseResult(response.toString()); + } + + private String parseResult(String inputJson) throws Exception + { + //TODO: find a way to do this using google.gson + JSONArray jsonArray = new JSONArray(inputJson); + JSONArray jsonArray2 = (JSONArray) jsonArray.get(0); + JSONArray jsonArray3 = (JSONArray) jsonArray2.get(0); + + return jsonArray3.get(0).toString(); + } + +} From 8cf1262414b2ed70de80b22011bcc49321432f47 Mon Sep 17 00:00:00 2001 From: Kyleeld <48519776+Kyleeld@users.noreply.github.com> Date: Mon, 1 Jul 2019 01:26:14 +0100 Subject: [PATCH 43/58] fixes some bugs with menu entry swapper (#831) * fixes some bugs with menu entry swapper * information format change --- .../MenuEntrySwapperConfig.java | 30 +- .../MenuEntrySwapperPlugin.java | 500 +++++++++--------- 2 files changed, 276 insertions(+), 254 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java index e6497432aa..989bce98a6 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java @@ -328,7 +328,7 @@ public interface MenuEntrySwapperConfig extends Config { return true; } - + @ConfigItem( keyName = "swapQuestCape", name = "Swap Quest Cape", @@ -651,20 +651,20 @@ public interface MenuEntrySwapperConfig extends Config description = "Don't open implings if bank has a clue.", position = 23, group = "Miscellaneous" -) -default boolean swapImps() + ) + default boolean swapImps() { return false; } -@ConfigItem( + @ConfigItem( keyName = "charterOption", name = "Trader Crew", description = "Configure whether you want Charter or Trade to be the first option of Trader Crewmembers.", position = 24, group = "Miscellaneous" -) -default CharterOption charterOption() + ) + default CharterOption charterOption() { return CharterOption.TRADE; } @@ -1671,23 +1671,25 @@ default CharterOption charterOption() keyName = "removeFreezePlayerToB", name = "Remove freeze in ToB", description = "Removes the freeze option for ice barrage, ice blitz, entangle etc. in ToB", - position = 0 + position = 0, + group = "PVM" ) default boolean getRemoveFreezePlayerToB() - { - return true; - } + { + return true; + } @ConfigItem( keyName = "removeFreezePlayerCoX", name = "Remove freeze in CoX", description = "Removes the freeze option for ice barrage, ice blitz, entangle etc. in CoX", - position = 1 + position = 1, + group = "PVM" ) default boolean getRemoveFreezePlayerCoX() - { - return true; - } + { + return true; + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java index f7f04ddef9..661ad95d18 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java @@ -98,45 +98,29 @@ import org.apache.commons.lang3.ArrayUtils; public class MenuEntrySwapperPlugin extends Plugin { + public static final HashSet CAST_OPTIONS_KEYWORDS = new HashSet<>(); private static final String CONFIGURE = "Configure"; private static final String SAVE = "Save"; private static final String RESET = "Reset"; private static final String MENU_TARGET = "Shift-click"; - private List bankItemNames = new ArrayList<>(); private static final String CONFIG_GROUP = "shiftclick"; private static final String ITEM_KEY_PREFIX = "item_"; private static final int PURO_PURO_REGION_ID = 10307; private static final String WALK_HERE = "WALK HERE"; private static final String CANCEL = "CANCEL"; private static final String CAST_OPTIONS_ATTACK = "CAST"; - public static final HashSet CAST_OPTIONS_KEYWORDS = new HashSet<>(); - static - { - CAST_OPTIONS_KEYWORDS.add(CAST_OPTIONS_ATTACK); - } - - private MenuEntry[] entries; - private final Set leftClickConstructionItems = new HashSet<>(); - private boolean buildingMode; - private static final WidgetMenuOption FIXED_INVENTORY_TAB_CONFIGURE = new WidgetMenuOption(CONFIGURE, MENU_TARGET, WidgetInfo.FIXED_VIEWPORT_INVENTORY_TAB); - private static final WidgetMenuOption FIXED_INVENTORY_TAB_SAVE = new WidgetMenuOption(SAVE, MENU_TARGET, WidgetInfo.FIXED_VIEWPORT_INVENTORY_TAB); - private static final WidgetMenuOption RESIZABLE_INVENTORY_TAB_CONFIGURE = new WidgetMenuOption(CONFIGURE, MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_INVENTORY_TAB); - private static final WidgetMenuOption RESIZABLE_INVENTORY_TAB_SAVE = new WidgetMenuOption(SAVE, MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_INVENTORY_TAB); - private static final WidgetMenuOption RESIZABLE_BOTTOM_LINE_INVENTORY_TAB_CONFIGURE = new WidgetMenuOption(CONFIGURE, MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_INVENTORY_TAB); - private static final WidgetMenuOption RESIZABLE_BOTTOM_LINE_INVENTORY_TAB_SAVE = new WidgetMenuOption(SAVE, MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_INVENTORY_TAB); - private static final Set NPC_MENU_TYPES = ImmutableSet.of( MenuAction.NPC_FIRST_OPTION, MenuAction.NPC_SECOND_OPTION, @@ -144,14 +128,21 @@ public class MenuEntrySwapperPlugin extends Plugin MenuAction.NPC_FOURTH_OPTION, MenuAction.NPC_FIFTH_OPTION, MenuAction.EXAMINE_NPC); - private static final Splitter NEWLINE_SPLITTER = Splitter .on("\n") .omitEmptyStrings() .trimResults(); - private final Map customSwaps = new HashMap<>(); + static + { + CAST_OPTIONS_KEYWORDS.add(CAST_OPTIONS_ATTACK); + } + private final Set leftClickConstructionItems = new HashSet<>(); + private final Map customSwaps = new HashMap<>(); + private List bankItemNames = new ArrayList<>(); + private MenuEntry[] entries; + private boolean buildingMode; @Inject private Client client; @@ -381,19 +372,19 @@ public class MenuEntrySwapperPlugin extends Plugin { continue; } - if (config.hideDestroyCoalbag() && entry.getTarget().contains("Coal bag")) + else if (config.hideDestroyCoalbag() && entry.getTarget().contains("Coal bag")) { continue; } - if (config.hideDestroyHerbsack() && entry.getTarget().contains("Herb sack")) + else if (config.hideDestroyHerbsack() && entry.getTarget().contains("Herb sack")) { continue; } - if (config.hideDestroyBoltpouch() && entry.getTarget().contains("Bolt pouch")) + else if (config.hideDestroyBoltpouch() && entry.getTarget().contains("Bolt pouch")) { continue; } - if (config.hideDestroyGembag() && entry.getTarget().contains("Gem bag")) + else if (config.hideDestroyGembag() && entry.getTarget().contains("Gem bag")) { continue; } @@ -402,10 +393,10 @@ public class MenuEntrySwapperPlugin extends Plugin if (option.contains("drop")) { if (config.hideDropRunecraftingPouch() && ( - entry.getTarget().contains("Small pouch") - || entry.getTarget().contains("Medium pouch") - || entry.getTarget().contains("Large pouch") - || entry.getTarget().contains("Giant pouch"))) + entry.getTarget().contains("Small pouch") + || entry.getTarget().contains("Medium pouch") + || entry.getTarget().contains("Large pouch") + || entry.getTarget().contains("Giant pouch"))) { continue; } @@ -485,7 +476,7 @@ public class MenuEntrySwapperPlugin extends Plugin return; } - int itemId = event.getIdentifier(); + int itemId = event.getType(); if (itemId == -1) { @@ -543,7 +534,7 @@ public class MenuEntrySwapperPlugin extends Plugin } final String pOptionToReplace = Text.removeTags(event.getOption()).toUpperCase(); - final int eventId = event.getIdentifier(); + final int eventId = event.getType(); final String option = Text.standardize(event.getOption()); final String target = Text.standardize(event.getTarget()); final NPC hintArrowNpc = client.getHintArrowNpc(); @@ -563,7 +554,7 @@ public class MenuEntrySwapperPlugin extends Plugin } } - if (config.getWithdrawFive()) + else if (config.getWithdrawFive()) { for (String item : Text.fromCSV(config.getWithdrawFiveItems())) { @@ -575,7 +566,7 @@ public class MenuEntrySwapperPlugin extends Plugin } } - if (config.getWithdrawTen()) + else if (config.getWithdrawTen()) { for (String item : Text.fromCSV(config.getWithdrawTenItems())) { @@ -587,7 +578,7 @@ public class MenuEntrySwapperPlugin extends Plugin } } - if (config.getWithdrawX()) + else if (config.getWithdrawX()) { for (String item : Text.fromCSV(config.getWithdrawXItems())) { @@ -599,7 +590,7 @@ public class MenuEntrySwapperPlugin extends Plugin } } - if (config.getWithdrawAll()) + else if (config.getWithdrawAll()) { for (String item : Text.fromCSV(config.getWithdrawAllItems())) { @@ -628,7 +619,7 @@ public class MenuEntrySwapperPlugin extends Plugin } } - if (config.getSwapBuyFive() && !config.getBuyFiveItems().equals("")) + else if (config.getSwapBuyFive() && !config.getBuyFiveItems().equals("")) { for (String item : Text.fromCSV(config.getBuyFiveItems())) { @@ -639,7 +630,7 @@ public class MenuEntrySwapperPlugin extends Plugin } } - if (config.getSwapBuyTen() && !config.getBuyTenItems().equals("")) + else if (config.getSwapBuyTen() && !config.getBuyTenItems().equals("")) { for (String item : Text.fromCSV(config.getBuyTenItems())) { @@ -650,7 +641,7 @@ public class MenuEntrySwapperPlugin extends Plugin } } - if (config.getSwapBuyFifty() && !config.getBuyFiftyItems().equals("")) + else if (config.getSwapBuyFifty() && !config.getBuyFiftyItems().equals("")) { for (String item : Text.fromCSV(config.getBuyFiftyItems())) { @@ -661,7 +652,7 @@ public class MenuEntrySwapperPlugin extends Plugin } } } - else if ((option.contains("sell") || option.contains("value")) && Arrays.stream(entries).anyMatch(menuEntry -> + if ((option.contains("sell") || option.contains("value")) && Arrays.stream(entries).anyMatch(menuEntry -> { return menuEntry.getOption().toLowerCase().contains("sell"); })) @@ -677,7 +668,7 @@ public class MenuEntrySwapperPlugin extends Plugin } } - if (config.getSwapSellFive() && !Strings.isNullOrEmpty(config.getSellFiveItems())) + else if (config.getSwapSellFive() && !Strings.isNullOrEmpty(config.getSellFiveItems())) { for (String item : Text.fromCSV(config.getSellFiveItems())) { @@ -688,7 +679,7 @@ public class MenuEntrySwapperPlugin extends Plugin } } - if (config.getSwapSellTen() && !Strings.isNullOrEmpty(config.getSellTenItems())) + else if (config.getSwapSellTen() && !Strings.isNullOrEmpty(config.getSellTenItems())) { for (String item : Text.fromCSV(config.getSellTenItems())) { @@ -699,7 +690,7 @@ public class MenuEntrySwapperPlugin extends Plugin } } - if (config.getSwapSellFifty() && !Strings.isNullOrEmpty(config.getSellFiftyItems())) + else if (config.getSwapSellFifty() && !Strings.isNullOrEmpty(config.getSellFiftyItems())) { for (String item : Text.fromCSV(config.getSellFiftyItems())) { @@ -718,20 +709,20 @@ public class MenuEntrySwapperPlugin extends Plugin removed = Text.standardize(removed); if (target.contains("(") && target.split(" \\(")[0].equals(removed)) { - delete(event.getIdentifier()); + delete(event.getType()); } else if (target.contains("->")) { String trimmed = target.split("->")[1].trim(); if (trimmed.length() >= removed.length() && trimmed.substring(0, removed.length()).equalsIgnoreCase(removed)) { - delete(event.getIdentifier()); + delete(event.getType()); break; } } else if (target.length() >= removed.length() && target.substring(0, removed.length()).equalsIgnoreCase(removed)) { - delete(event.getIdentifier()); + delete(event.getType()); break; } } @@ -756,7 +747,7 @@ public class MenuEntrySwapperPlugin extends Plugin } } - else if (config.getSwapSmithing() && option.contains("smith")) + if (config.getSwapSmithing() && option.contains("smith")) { if (option.equalsIgnoreCase("Smith 1")) { @@ -768,48 +759,48 @@ public class MenuEntrySwapperPlugin extends Plugin } } - else if (config.getSwapTanning() && option.equalsIgnoreCase("Tan 1")) + if (config.getSwapTanning() && option.equalsIgnoreCase("Tan 1")) { swap(client, "Tan All", option, target); } - else if (config.getSwapSawmill() && target.equalsIgnoreCase("Sawmill operator")) + if (config.getSwapSawmill() && target.equalsIgnoreCase("Sawmill operator")) { swap(client, "Buy-plank", option, target); } - else if (config.getSwapSawmillPlanks() && option.equalsIgnoreCase("Buy 1")) + if (config.getSwapSawmillPlanks() && option.equalsIgnoreCase("Buy 1")) { swap(client, "Buy All", option, target); } - else if (option.equalsIgnoreCase("Clear-All") && target.equalsIgnoreCase("Bank Filler")) + if (option.equalsIgnoreCase("Clear-All") && target.equalsIgnoreCase("Bank Filler")) { swap(client, "Clear", option, target); } - else if (target.contains("ardougne cloak") && config.getSwapArdougneCape()) + if (config.getSwapArdougneCape() && target.contains("ardougne cloak")) { swap(client, "Kandarin Monastery", option, target); swap(client, "Monastery Teleport", option, target); } - else if (target.contains("crafting cape") && config.getSwapCraftingCape()) + if (config.getSwapCraftingCape() && target.contains("crafting cape")) { swap(client, "Teleport", option, target); } - else if (target.contains("construct. cape") && config.getSwapConstructionCape()) + if (config.getSwapConstructionCape() && target.contains("construct. cape")) { swap(client, "Tele to poh", option, target); } - else if (target.contains("magic cape") && config.getSwapMagicCape()) + if (config.getSwapMagicCape() && target.contains("magic cape")) { swap(client, "Spellbook", option, target); } - else if (target.contains("explorer's ring") && config.getSwapExplorersRing()) + if (config.getSwapExplorersRing() && target.contains("explorer's ring")) { swap(client, "Teleport", option, target); } @@ -833,77 +824,79 @@ public class MenuEntrySwapperPlugin extends Plugin } } List invItemNames = new ArrayList<>(); - if (target.equals("gourmet impling jar")) + + switch (target) { - if (client.getItemContainer(InventoryID.INVENTORY) != null) - { - for (Item i : Objects.requireNonNull(client.getItemContainer(InventoryID.INVENTORY)).getItems()) + case "gourmet impling jar": + if (client.getItemContainer(InventoryID.INVENTORY) != null) { - invItemNames.add(client.getItemDefinition((i.getId())).getName()); + for (Item i : Objects.requireNonNull(client.getItemContainer(InventoryID.INVENTORY)).getItems()) + { + invItemNames.add(client.getItemDefinition((i.getId())).getName()); + } + if ((invItemNames.contains("Clue scroll (easy)") || bankItemNames.contains("Clue scroll (easy)"))) + { + menuManager.addSwap("loot", target, "use"); + } + else + { + menuManager.removeSwaps(target); + } } - if ((invItemNames.contains("Clue scroll (easy)") || bankItemNames.contains("Clue scroll (easy)"))) + break; + case "eclectic impling jar": + if (client.getItemContainer(InventoryID.INVENTORY) != null) { - menuManager.addSwap("loot", target, "use"); + for (Item i : Objects.requireNonNull(client.getItemContainer(InventoryID.INVENTORY)).getItems()) + { + invItemNames.add(client.getItemDefinition((i.getId())).getName()); + } + if ((invItemNames.contains("Clue scroll (medium)") || bankItemNames.contains("Clue scroll (medium)"))) + { + menuManager.addSwap("loot", target, "use"); + } + else + { + menuManager.removeSwaps(target); + } } - else + break; + case "magpie impling jar": + case "nature impling jar": + case "ninja impling jar": + if (client.getItemContainer(InventoryID.INVENTORY) != null) { - menuManager.removeSwaps(target); + for (Item i : Objects.requireNonNull(client.getItemContainer(InventoryID.INVENTORY)).getItems()) + { + invItemNames.add(client.getItemDefinition((i.getId())).getName()); + } + if ((invItemNames.contains("Clue scroll (hard)") || bankItemNames.contains("Clue scroll (hard)"))) + { + menuManager.addSwap("loot", target, "use"); + } + else + { + menuManager.removeSwaps(target); + } } - } - } - if (target.equals("eclectic impling jar")) - { - if (client.getItemContainer(InventoryID.INVENTORY) != null) - { - for (Item i : Objects.requireNonNull(client.getItemContainer(InventoryID.INVENTORY)).getItems()) + break; + case "dragon impling jar": + if (client.getItemContainer(InventoryID.INVENTORY) != null) { - invItemNames.add(client.getItemDefinition((i.getId())).getName()); + for (Item i : Objects.requireNonNull(client.getItemContainer(InventoryID.INVENTORY)).getItems()) + { + invItemNames.add(client.getItemDefinition((i.getId())).getName()); + } + if ((invItemNames.contains("Clue scroll (elite)") || bankItemNames.contains("Clue scroll (elite)"))) + { + menuManager.addSwap("loot", target, "use"); + } + else + { + menuManager.removeSwaps(target); + } } - if ((invItemNames.contains("Clue scroll (medium)") || bankItemNames.contains("Clue scroll (medium)"))) - { - menuManager.addSwap("loot", target, "use"); - } - else - { - menuManager.removeSwaps(target); - } - } - } - else if (target.equals("magpie impling jar") || (target.equals("nature impling jar")) || (target.equals("ninja impling jar"))) - { - if (client.getItemContainer(InventoryID.INVENTORY) != null) - { - for (Item i : Objects.requireNonNull(client.getItemContainer(InventoryID.INVENTORY)).getItems()) - { - invItemNames.add(client.getItemDefinition((i.getId())).getName()); - } - if ((invItemNames.contains("Clue scroll (hard)") || bankItemNames.contains("Clue scroll (hard)"))) - { - menuManager.addSwap("loot", target, "use"); - } - else - { - menuManager.removeSwaps(target); - } - } - } - else if (target.equals("dragon impling jar")) - { - if (client.getItemContainer(InventoryID.INVENTORY) != null) - { - for (Item i : Objects.requireNonNull(client.getItemContainer(InventoryID.INVENTORY)).getItems()) - { - invItemNames.add(client.getItemDefinition((i.getId())).getName()); - } - if ((invItemNames.contains("Clue scroll (elite)") || bankItemNames.contains("Clue scroll (elite)"))) - { - menuManager.addSwap("loot", target, "use"); - } - else - { - menuManager.removeSwaps(target); - } - } + break; } } @@ -911,16 +904,16 @@ public class MenuEntrySwapperPlugin extends Plugin if (!pOptionToReplace.equals(CANCEL) && !pOptionToReplace.equals(WALK_HERE)) { Player[] players = client.getCachedPlayers(); - int identifier = event.getIdentifier(); + int identifier = event.getType(); if (identifier >= 0 && identifier < players.length) { Player player = players[identifier]; if (player != null) { - if (((config.getRemoveFreezePlayerCoX() && client.getVar(Varbits.IN_RAID) == 1) - || (config.getRemoveFreezePlayerToB() && client.getVar(Varbits.THEATRE_OF_BLOOD) == 2)) - && (player.isFriend() || player.isClanMember()) + if (((config.getRemoveFreezePlayerCoX() && client.getVar(Varbits.IN_RAID) == 1) + || (config.getRemoveFreezePlayerToB() && client.getVar(Varbits.THEATRE_OF_BLOOD) == 2)) + && (player.isFriend() || player.isClanMember()) && CAST_OPTIONS_KEYWORDS.contains(pOptionToReplace)) { addswap(pOptionToReplace); @@ -936,22 +929,29 @@ public class MenuEntrySwapperPlugin extends Plugin swap(client, "pickpocket", option, target, true); } - if (config.swapHardWoodGrove() && target.contains("rionasta")) + else if (config.swapHardWoodGrove()) { - swap(client, "send-parcel", option, target, true); + if (target.contains("rionasta")) + { + swap(client, "send-parcel", option, target, true); + } + else if (option.equals("open") && target.equals("hardwood grove doors")) + { + swap(client, "quick-pay(100)", option, target, true); + } } - if (config.swapBankExchange()) + else if (config.swapBankExchange()) { swap(client, "bank", option, target, true); swap(client, "exchange", option, target, true); } - if (config.swapContract()) + else if (config.swapContract()) { swap(client, "contract", option, target, true); } - if (config.swapInteract()) + else if (config.swapInteract()) { swap(client, "repairs", option, target, true); swap(client, "claim-slime", option, target, true); @@ -962,24 +962,24 @@ public class MenuEntrySwapperPlugin extends Plugin } // make sure assignment swap is higher priority than trade swap for slayer masters - if (config.swapAssignment()) + else if (config.swapAssignment()) { swap(client, "assignment", option, target, true); } - if (config.swapPlank()) + else if (config.swapPlank()) { swap(client, "buy-plank", option, target, true); } - if (config.swapTrade() && (!(target.equals("trader crewmember") || target.equals("trader stan")) || config.charterOption().equals(CharterOption.TRADE))) + else if (config.swapTrade() && (!(target.equals("trader crewmember") || target.equals("trader stan")) || config.charterOption().equals(CharterOption.TRADE))) { swap(client, "trade", option, target, true); swap(client, "trade-with", option, target, true); swap(client, "shop", option, target, true); } - if (config.swapMinigame()) + else if (config.swapMinigame()) { swap(client, "story", option, target, true); swap(client, "escort", option, target, true); @@ -987,7 +987,46 @@ public class MenuEntrySwapperPlugin extends Plugin swap(client, "start-minigame", option, target, true); } - if (config.swapTravel()) + else if (config.swapAbyssTeleport() && target.contains("mage of zamorak")) + { + swap(client, "teleport", option, target, true); + } + + else if (config.swapPay()) + { + swap(client, "pay", option, target, true); + swap(client, "pay (", option, target, false); + } + + else if (config.swapQuick()) + { + swap(client, "quick-travel", option, target, true); + } + + else if (config.swapEnchant()) + { + swap(client, "enchant", option, target, true); + } + + } + + if (config.swapWildernessLever() && target.equals("lever") && option.equals("ardougne")) + { + swap(client, "edgeville", option, target, true); + } + + if (config.swapMetamorphosis() && target.contains("baby chinchompa")) + { + swap(client, "metamorphosis", option, target, true); + } + + if (config.swapStun() && target.contains("hoop snake")) + { + swap(client, "stun", option, target, true); + } + + if (config.swapTravel()) + { { swap(client, "travel", option, target, true); swap(client, "pay-fare", option, target, true); @@ -999,71 +1038,43 @@ public class MenuEntrySwapperPlugin extends Plugin swap(client, "rellekka", option, target, true); swap(client, "follow", option, target, true); swap(client, "transport", option, target, true); - - if (config.swapAbyssTeleport() && target.contains("mage of zamorak")) - { - swap(client, "teleport", option, target, true); - } - - if (!(target.equals("trader crewmember") || target.equals("trader stan")) || config.charterOption().equals(CharterOption.CHARTER)) - { - swap(client, "charter", option, target, true); - } } - if (config.swapPay()) + if (!(target.equals("trader crewmember") || target.equals("trader stan")) || config.charterOption().equals(CharterOption.CHARTER)) { - swap(client, "pay", option, target, true); - swap(client, "pay (", option, target, false); + swap(client, "charter", option, target, true); } - if (config.swapQuick()) + else if ((option.equals("pass") && target.equals("energy barrier"))) { - swap(client, "quick-travel", option, target, true); + swap(client, "pay-toll(2-ecto)", option, target, true); } - if (config.swapEnchant()) + else if (option.equals("open") && target.equals("gate")) { - swap(client, "enchant", option, target, true); + swap(client, "pay-toll(10gp)", option, target, true); } + else if (option.equals("inspect") && target.equals("trapdoor")) + { + swap(client, "travel", option, target, true); + } } - else if (config.swapWildernessLever() && target.equals("lever") && option.equals("ardougne")) + if (config.swapHarpoon()) { - swap(client, "edgeville", option, target, true); + + if (option.equals("cage")) + { + swap(client, "harpoon", option, target, true); + } + else if (option.equals("big net") || option.equals("net")) + { + swap(client, "harpoon", option, target, true); + } } - else if (config.swapMetamorphosis() && target.contains("baby chinchompa")) - { - swap(client, "metamorphosis", option, target, true); - } - - else if (config.swapStun() && target.contains("hoop snake")) - { - swap(client, "stun", option, target, true); - } - - else if (config.swapTravel() && (option.equals("pass") || option.equals("open"))) - { - swap(client, "pay-toll", option, target, false); - } - else if (config.swapTravel() && option.equals("inspect") && target.equals("trapdoor")) - { - swap(client, "travel", option, target, true); - } - - else if (config.swapHarpoon() && option.equals("cage")) - { - swap(client, "harpoon", option, target, true); - } - - else if (config.swapHarpoon() && (option.equals("big net") || option.equals("net"))) - { - swap(client, "harpoon", option, target, true); - } - - else if (config.swapOccultMode() != OccultAltarMode.VENERATE && option.equals("venerate")) + if (config.swapOccultMode() != OccultAltarMode.VENERATE && option.equals("venerate")) { switch (config.swapOccultMode()) { @@ -1082,7 +1093,7 @@ public class MenuEntrySwapperPlugin extends Plugin } - else if (config.swapObeliskMode() != ObeliskMode.ACTIVATE && option.equals("activate")) + if (config.swapObeliskMode() != ObeliskMode.ACTIVATE && option.equals("activate")) { switch (config.swapObeliskMode()) { @@ -1098,7 +1109,7 @@ public class MenuEntrySwapperPlugin extends Plugin } } - else if (config.swapHomePortalMode() != HouseMode.ENTER && option.equals("enter")) + if (config.swapHomePortalMode() != HouseMode.ENTER && option.equals("enter")) { switch (config.swapHomePortalMode()) { @@ -1113,7 +1124,8 @@ public class MenuEntrySwapperPlugin extends Plugin break; } } - else if (config.swapFairyRingMode() != FairyRingMode.OFF && config.swapFairyRingMode() != FairyRingMode.ZANARIS + + if (config.swapFairyRingMode() != FairyRingMode.OFF && config.swapFairyRingMode() != FairyRingMode.ZANARIS && (option.equals("zanaris") || option.equals("configure") || option.equals("tree"))) { if (config.swapFairyRingMode() == FairyRingMode.LAST_DESTINATION) @@ -1126,89 +1138,95 @@ public class MenuEntrySwapperPlugin extends Plugin } } - else if (config.swapFairyRingMode() == FairyRingMode.ZANARIS && option.equals("tree")) + if (config.swapFairyRingMode() == FairyRingMode.ZANARIS && option.equals("tree")) { swap(client, "zanaris", option, target, false); } - else if (config.swapBoxTrap() && (option.equals("check") || option.equals("dismantle"))) + if (config.swapBoxTrap()) { - swap(client, "reset", option, target, true); + if (option.equals("check") || option.equals("dismantle")) + { + swap(client, "reset", option, target, true); + } + + else if (option.equals("take")) + { + swap(client, "lay", option, target, true); + swap(client, "activate", option, target, true); + } } - else if (config.swapBoxTrap() && option.equals("take")) - { - swap(client, "lay", option, target, true); - swap(client, "activate", option, target, true); - } - else if (config.swapChase() && option.equals("pick-up")) + if (config.swapChase() && option.equals("pick-up")) { swap(client, "chase", option, target, true); } - else if (config.swapBirdhouseEmpty() && option.equals("interact") && target.contains("birdhouse")) + if (config.swapBirdhouseEmpty() && option.equals("interact") && target.contains("birdhouse")) { swap(client, "empty", option, target, true); } - else if (config.swapQuick() && option.equals("ring")) + if (config.swapQuick()) { - swap(client, "quick-start", option, target, true); - } + if (option.equals("ring")) + { + swap(client, "quick-start", option, target, true); + } - else if (config.swapQuick() && option.equals("pass")) - { - swap(client, "quick-pass", option, target, true); - swap(client, "quick pass", option, target, true); - } + else if (option.equals("pass")) + { + swap(client, "quick-pass", option, target, true); + } - else if (config.swapQuick() && option.equals("open")) - { - swap(client, "quick-open", option, target, true); + else if (option.equals("open")) + { + swap(client, "quick-open", option, target, true); + } + else if (option.equals("enter")) + { + swap(client, "quick-enter", option, target, true); + } + else if (option.equals("leave tomb")) + { + swap(client, "quick-leave", option, target, true); + } } - else if (config.swapQuick() && option.equals("enter")) - { - swap(client, "quick-enter", option, target, true); - } - else if (config.swapQuick() && option.equals("leave tomb")) - { - swap(client, "quick-leave", option, target, true); - } - else if (config.swapAdmire() && option.equals("admire")) + if (config.swapAdmire() && option.equals("admire")) { swap(client, "teleport", option, target, true); swap(client, "spellbook", option, target, true); swap(client, "perks", option, target, true); } - else if (config.swapPrivate() && option.equals("shared")) + if (config.swapPrivate() && option.equals("shared")) { swap(client, "private", option, target, true); } - else if (config.swapPick() && option.equals("pick")) + if (config.swapPick() && option.equals("pick")) { swap(client, "pick-lots", option, target, true); } - else if (config.swapSearch() && (option.equals("close") || option.equals("shut"))) + if (config.swapSearch() && (option.equals("close") || option.equals("shut"))) { swap(client, "search", option, target, true); } - else if (config.swapRogueschests() && target.contains("chest")) + if (config.swapRogueschests() && target.contains("chest")) { swap(client, "search for traps", option, target, true); } - else if (config.rockCake() && option.equals("eat")) + if (config.rockCake() && option.equals("eat")) { swap(client, "guzzle", option, target, true); } - else if (config.shiftClickCustomization() && shiftModifier && !option.equals("use")) + if (config.shiftClickCustomization() && shiftModifier && !option.equals("use")) { Integer customOption = getSwapConfig(eventId); @@ -1219,20 +1237,20 @@ public class MenuEntrySwapperPlugin extends Plugin } // Put all item-related swapping after shift-click - else if (config.swapTeleportItem() && (option.equals("wear") || option.equals("wield"))) + if (config.swapTeleportItem() && (option.equals("wear") || option.equals("wield"))) { swap(client, "rub", option, target, true); swap(client, "teleport", option, target, true); } - else if (config.swapCoalBag() && option.contains("deposit") && target.equals("coal bag")) + if (config.swapCoalBag() && option.contains("deposit") && target.equals("coal bag")) { swap(client, "empty", option, target, true); } - else if (config.swapBones() && option.equals("bury")) + if (config.swapBones() && option.equals("bury")) { swap(client, "use", option, target, true); } - else if (config.swapNexus() && target.contains("portal nexus")) + if (config.swapNexus() && target.contains("portal nexus")) { swap(client, "teleport menu", option, target, true); } @@ -1449,7 +1467,7 @@ public class MenuEntrySwapperPlugin extends Plugin menuManager.removeSwaps("ring of wealth"); menuManager.removeSwaps("max cape"); menuManager.removeSwaps("quest point cape"); - + } private void delete(int target) @@ -1548,10 +1566,11 @@ public class MenuEntrySwapperPlugin extends Plugin menuManager.removePriorityEntry("climb-down"); } -/** - * Swaps menu entries if the entries could be found. This places Walk Here where the top level menu option was. - * @param pOptionToReplace The String containing the Menu Option that needs to be replaced. IE: "Attack", "Chop Down". - */ + /** + * Swaps menu entries if the entries could be found. This places Walk Here where the top level menu option was. + * + * @param pOptionToReplace The String containing the Menu Option that needs to be replaced. IE: "Attack", "Chop Down". + */ private void addswap(String pOptionToReplace) { MenuEntry[] entries = client.getMenuEntries(); @@ -1559,35 +1578,36 @@ public class MenuEntrySwapperPlugin extends Plugin Integer entryToReplace = searchIndex(entries, pOptionToReplace); if (walkHereEntry != null - && entryToReplace != null) - { + && entryToReplace != null) + { MenuEntry walkHereMenuEntry = entries[walkHereEntry]; entries[walkHereEntry] = entries[entryToReplace]; entries[entryToReplace] = walkHereMenuEntry; client.setMenuEntries(entries); - } + } } -/** - * Finds the index of the menu that contains the verbiage we are looking for. - * @param pMenuEntries The list of {@link MenuEntry}s. - * @param pMenuEntryToSearchFor The Option in the menu to search for. - * @return The index location or null if it was not found. - */ + /** + * Finds the index of the menu that contains the verbiage we are looking for. + * + * @param pMenuEntries The list of {@link MenuEntry}s. + * @param pMenuEntryToSearchFor The Option in the menu to search for. + * @return The index location or null if it was not found. + */ private Integer searchIndex(MenuEntry[] pMenuEntries, String pMenuEntryToSearchFor) { Integer indexLocation = 0; for (MenuEntry menuEntry : pMenuEntries) - { + { String entryOption = Text.removeTags(menuEntry.getOption()).toUpperCase(); if (entryOption.equals(pMenuEntryToSearchFor)) - { + { return indexLocation; - } - indexLocation++; } + indexLocation++; + } return null; } -} +} \ No newline at end of file From 9c241a7253d95de89f92a269b63284c43d48c60e Mon Sep 17 00:00:00 2001 From: FrostyFridge <> Date: Sun, 30 Jun 2019 20:40:50 -0700 Subject: [PATCH 44/58] Fix name of Lithkren Dungeon teleport option --- .../plugins/menuentryswapper/util/DigsitePendantMode.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/DigsitePendantMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/DigsitePendantMode.java index 95e84a3188..dd9b58eea5 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/DigsitePendantMode.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/DigsitePendantMode.java @@ -29,7 +29,7 @@ public enum DigsitePendantMode { DIGSITE("Digsite"), FOSSIL_ISLAND("Fossil Island"), - LITHKREN("Lithkren"); + LITHKREN("Lithkren Dungeon"); private final String name; From 5f4544227831d753585eb23c25ff64beec5d20f9 Mon Sep 17 00:00:00 2001 From: Ganom Date: Mon, 1 Jul 2019 00:51:59 -0400 Subject: [PATCH 45/58] Added nylo helper to Maiden, and various tob code style fixes. --- .../client/plugins/theatre/RoomHandler.java | 60 ++-- .../client/plugins/theatre/TheatreConfig.java | 138 +++++---- .../plugins/theatre/TheatreConstant.java | 2 +- .../plugins/theatre/TheatreOverlay.java | 14 +- .../client/plugins/theatre/TheatrePlugin.java | 104 ++++++- .../client/plugins/theatre/TheatreRoom.java | 4 +- .../plugins/theatre/rooms/BloatHandler.java | 89 +++--- .../plugins/theatre/rooms/MaidenHandler.java | 291 +++++++++++++----- .../client/plugins/theatre/rooms/Nylos.java | 36 +++ .../theatre/rooms/SotetsegHandler.java | 110 ++----- .../plugins/theatre/rooms/VerzikHandler.java | 109 ++++--- .../theatre/rooms/nylocas/NyloHandler.java | 138 +++------ .../theatre/rooms/nylocas/NyloOverlay.java | 29 +- .../theatre/rooms/nylocas/NyloPredictor.java | 232 +++++++------- .../theatre/rooms/xarpus/XarpusCounter.java | 12 +- .../theatre/rooms/xarpus/XarpusHandler.java | 37 ++- .../plugins/theatre/timers/RoomTimer.java | 20 +- .../plugins/theatre/timers/Timeable.java | 2 +- 18 files changed, 792 insertions(+), 635 deletions(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/Nylos.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/RoomHandler.java b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/RoomHandler.java index e67560663f..3615d58f6d 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/RoomHandler.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/RoomHandler.java @@ -1,17 +1,23 @@ package net.runelite.client.plugins.theatre; -import net.runelite.api.*; +import java.awt.BasicStroke; +import java.awt.Color; +import java.awt.Font; +import java.awt.Graphics2D; +import java.awt.Polygon; +import java.util.Iterator; +import java.util.Map; +import net.runelite.api.Client; +import net.runelite.api.NPC; +import net.runelite.api.NPCDefinition; +import net.runelite.api.Perspective; import net.runelite.api.Point; +import net.runelite.api.Projectile; import net.runelite.api.coords.LocalPoint; -import net.runelite.api.coords.WorldArea; import net.runelite.api.coords.WorldPoint; import net.runelite.client.ui.overlay.OverlayUtil; -import java.awt.*; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -public abstract class RoomHandler +public abstract class RoomHandler { protected final Client client; @@ -29,7 +35,7 @@ public abstract class RoomHandler public abstract void onStop(); - protected void drawTile2(Graphics2D graphics, WorldPoint point, Color color, int strokeWidth, int outlineAlpha, int fillAlpha) + protected void drawTile2(Graphics2D graphics, WorldPoint point, Color color, int strokeWidth, int outlineAlpha, int fillAlpha) { WorldPoint playerLocation = client.getLocalPlayer().getWorldLocation(); if (point.distanceTo(playerLocation) >= 32) @@ -71,14 +77,14 @@ public abstract class RoomHandler Point textLocation = Perspective.getCanvasTextLocation(client, graphics, projectilePoint, text, 0); if (textLocation != null) { - if (projectileId == 1607) + if (projectileId == 1607) { // range renderTextLocation(graphics, text, 17, Font.BOLD, new Color(57, 255, 20, 255), textLocation); - } + } else if (projectileId == 1606) { //mage renderTextLocation(graphics, text, 17, Font.BOLD, new Color(64, 224, 208, 255), textLocation); - } + } else { //Orb of death? i hope renderTextLocation(graphics, text, 20, Font.BOLD, Color.WHITE, textLocation); @@ -87,20 +93,26 @@ public abstract class RoomHandler } } - protected void drawTile(Graphics2D graphics, WorldPoint point, Color color, int strokeWidth, int outlineAlpha, int fillAlpha) + protected void drawTile(Graphics2D graphics, WorldPoint point, Color color, int strokeWidth, int outlineAlpha, int fillAlpha) { WorldPoint playerLocation = client.getLocalPlayer().getWorldLocation(); if (point.distanceTo(playerLocation) >= 32) + { return; + } LocalPoint lp = LocalPoint.fromWorld(client, point); if (lp == null) + { return; + } Polygon poly = Perspective.getCanvasTilePoly(client, lp); if (poly == null) + { return; + } graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), outlineAlpha)); graphics.setStroke(new BasicStroke(strokeWidth)); @@ -109,13 +121,15 @@ public abstract class RoomHandler graphics.fill(poly); } - protected void renderNpcOverlay(Graphics2D graphics, NPC actor, Color color, int outlineWidth, int outlineAlpha, int fillAlpha) + protected void renderNpcOverlay(Graphics2D graphics, NPC actor, Color color, int outlineWidth, int outlineAlpha, int fillAlpha) { int size = 1; NPCDefinition composition = actor.getTransformedDefinition(); if (composition != null) + { size = composition.getSize(); + } LocalPoint lp = actor.getLocalLocation(); Polygon tilePoly = Perspective.getCanvasTileAreaPoly(client, lp, size); @@ -143,26 +157,6 @@ public abstract class RoomHandler } } - protected List getHitSquares(WorldPoint npcLoc, int npcSize, int thickness, boolean includeUnder) - { - List little = new WorldArea(npcLoc, npcSize, npcSize).toWorldPointList(); - List big = new WorldArea(npcLoc.getX() - thickness, npcLoc.getY() - thickness, npcSize + (thickness * 2), npcSize + (thickness * 2), npcLoc.getPlane()).toWorldPointList(); - - if (!includeUnder) - { - for (Iterator it = big.iterator(); it.hasNext(); ) - { - WorldPoint p = it.next(); - if (little.contains(p)) - { - it.remove(); - } - } - } - - return big; - } - protected String twoDigitString(long number) { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/TheatreConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/TheatreConfig.java index 39a5cc7e41..bf9a5e5963 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/TheatreConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/TheatreConfig.java @@ -8,30 +8,15 @@ package net.runelite.client.plugins.theatre; +import java.awt.Color; import net.runelite.client.config.Config; import net.runelite.client.config.ConfigGroup; import net.runelite.client.config.ConfigItem; -import java.awt.*; @ConfigGroup("Theatre") public interface TheatreConfig extends Config { - enum NYLOCAS - { - NONE, - MAGE, - MELEE, - RANGER - } - - enum NYLOOPTION - { - NONE, - TILE, - TIMER - } - @ConfigItem( position = 0, keyName = "showMaidenBloodToss", @@ -39,7 +24,7 @@ public interface TheatreConfig extends Config description = "Displays the tile location where tossed blood will land.", group = "Maiden" ) - default boolean showMaidenBloodToss() + default boolean showMaidenBloodToss() { return true; } @@ -51,7 +36,19 @@ public interface TheatreConfig extends Config description = "Show the tiles that blood spawns will travel to.", group = "Maiden" ) - default boolean showMaidenBloodSpawns() + default boolean showMaidenBloodSpawns() + { + return true; + } + + @ConfigItem( + position = 2, + keyName = "showNyloFreezeHighlights", + name = "Show Nylo Freeze Highlights", + description = "Show when to freeze Nylos at maiden. Say n1,n2,s1,s2 in chat for it to register.", + group = "Maiden" + ) + default boolean showNyloFreezeHighlights() { return true; } @@ -63,7 +60,7 @@ public interface TheatreConfig extends Config description = "Displays Bloat's status (asleep, wake, and enrage) using color code.", group = "Bloat" ) - default boolean showBloatIndicator() + default boolean showBloatIndicator() { return true; } @@ -75,7 +72,7 @@ public interface TheatreConfig extends Config description = "Highlights the falling hands inside Bloat.", group = "Bloat" ) - default boolean showBloatHands() + default boolean showBloatHands() { return true; } @@ -87,8 +84,8 @@ public interface TheatreConfig extends Config description = "", group = "Bloat" ) - default boolean BloatFeetIndicatorRaveEdition() - { + default boolean BloatFeetIndicatorRaveEdition() + { return false; } @@ -135,45 +132,40 @@ public interface TheatreConfig extends Config description = "An overlay will appear that counts the amount of Nylocas in the room.", group = "Nylocas" ) - default boolean showNylocasAmount() + default boolean showNylocasAmount() { return true; } /** - @ConfigItem( - position = 8, - keyName = "showNylocasSpawns", - name = "Show Nylocas Pre-spawns", - description = "Know the contents of the next upcoming wave." - ) - default boolean showNylocasSpawns() - { - return true; - } - - @ConfigItem( - position = 9, - keyName = "highlightNyloRoles", - name = "Highlight Nylo Prespawns", - description = "Highlights the next upcoming wave based on role. FOR BEGINNERS" - ) - default NYLOCAS highlightNyloRoles() - { - return NYLOCAS.NONE; - } - - @ConfigItem( - position = 10, - keyName = "highlightNyloParents", - name = "Show Nylo Parents (Un-used)", - description = "Highlight the Nylocas that spawn outside the center." - ) - default boolean highlightNyloParents() - { - return true; - } - **/ + * @ConfigItem( position = 8, + * keyName = "showNylocasSpawns", + * name = "Show Nylocas Pre-spawns", + * description = "Know the contents of the next upcoming wave." + * ) + * default boolean showNylocasSpawns() + * { + * return true; + * } + * @ConfigItem( position = 9, + * keyName = "highlightNyloRoles", + * name = "Highlight Nylo Prespawns", + * description = "Highlights the next upcoming wave based on role. FOR BEGINNERS" + * ) + * default NYLOCAS highlightNyloRoles() + * { + * return NYLOCAS.NONE; + * } + * @ConfigItem( position = 10, + * keyName = "highlightNyloParents", + * name = "Show Nylo Parents (Un-used)", + * description = "Highlight the Nylocas that spawn outside the center." + * ) + * default boolean highlightNyloParents() + * { + * return true; + * } + **/ @ConfigItem( position = 11, @@ -218,7 +210,7 @@ public interface TheatreConfig extends Config description = "Marks the tiles of Sotetseg's maze while in the underworld.", group = "Sotetseg" ) - default boolean showSotetsegSolo() + default boolean showSotetsegSolo() { return true; } @@ -234,6 +226,7 @@ public interface TheatreConfig extends Config { return Color.WHITE; } + @ConfigItem( position = 15, keyName = "showXarpusHeals", @@ -302,10 +295,10 @@ public interface TheatreConfig extends Config group = "Verzik" ) default boolean VerzikTankTile() - { + { return false; } - + @ConfigItem( position = 22, keyName = "verzikrangeattacks", @@ -314,10 +307,10 @@ public interface TheatreConfig extends Config group = "Verzik" ) default boolean verzikRangeAttacks() - { - return true; + { + return true; } - + @ConfigItem( position = 23, keyName = "extratimers", @@ -329,7 +322,7 @@ public interface TheatreConfig extends Config { return false; } - + @ConfigItem( position = 24, keyName = "p1attacks", @@ -341,7 +334,7 @@ public interface TheatreConfig extends Config { return true; } - + @ConfigItem( position = 25, keyName = "p2attacks", @@ -353,7 +346,7 @@ public interface TheatreConfig extends Config { return true; } - + @ConfigItem( position = 26, keyName = "p3attacks", @@ -365,4 +358,19 @@ public interface TheatreConfig extends Config { return true; } + + enum NYLOCAS + { + NONE, + MAGE, + MELEE, + RANGER + } + + enum NYLOOPTION + { + NONE, + TILE, + TIMER + } } \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/TheatreConstant.java b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/TheatreConstant.java index 90e47bd242..0724fb099e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/TheatreConstant.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/TheatreConstant.java @@ -1,6 +1,6 @@ package net.runelite.client.plugins.theatre; -public class TheatreConstant +public class TheatreConstant { public static final int MAIDEN_BLOOD_THROW = 1579; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/TheatreOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/TheatreOverlay.java index 492e9a25c4..e4dc6c2683 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/TheatreOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/TheatreOverlay.java @@ -8,28 +8,30 @@ package net.runelite.client.plugins.theatre; -import java.awt.*; -import java.util.*; +import java.awt.Dimension; +import java.awt.Graphics2D; import javax.inject.Inject; -import net.runelite.api.*; +import net.runelite.api.Client; +import net.runelite.client.graphics.ModelOutlineRenderer; import net.runelite.client.ui.overlay.Overlay; import net.runelite.client.ui.overlay.OverlayLayer; import net.runelite.client.ui.overlay.OverlayPosition; import net.runelite.client.ui.overlay.OverlayPriority; -public class TheatreOverlay extends Overlay +public class TheatreOverlay extends Overlay { - private final Client client; private final TheatrePlugin plugin; private final TheatreConfig config; + private final ModelOutlineRenderer modelOutline; @Inject - private TheatreOverlay(Client client, TheatrePlugin plugin, TheatreConfig config) + private TheatreOverlay(Client client, TheatrePlugin plugin, TheatreConfig config, ModelOutlineRenderer modelOutline) { this.client = client; this.plugin = plugin; this.config = config; + this.modelOutline = modelOutline; setPosition(OverlayPosition.DYNAMIC); setPriority(OverlayPriority.HIGH); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/TheatrePlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/TheatrePlugin.java index 0fe357d9e3..5f975d675e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/TheatrePlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/TheatrePlugin.java @@ -9,32 +9,43 @@ package net.runelite.client.plugins.theatre; import com.google.inject.Provides; +import java.awt.Color; +import java.util.LinkedList; +import java.util.List; +import javax.inject.Inject; import lombok.AccessLevel; import lombok.Getter; import lombok.Setter; +import lombok.extern.slf4j.Slf4j; import net.runelite.api.Client; -import java.util.LinkedList; -import java.util.List; -import net.runelite.api.events.*; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.plugins.Plugin; +import net.runelite.api.events.AnimationChanged; +import net.runelite.api.events.ChatMessage; +import net.runelite.api.events.ConfigChanged; +import net.runelite.api.events.GameTick; +import net.runelite.api.events.GroundObjectSpawned; +import net.runelite.api.events.NpcDespawned; +import net.runelite.api.events.NpcSpawned; +import net.runelite.api.events.ProjectileMoved; +import net.runelite.api.events.SpotAnimationChanged; +import net.runelite.api.events.VarbitChanged; +import net.runelite.api.events.WidgetLoaded; import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.WidgetID; import net.runelite.api.widgets.WidgetInfo; +import net.runelite.client.config.ConfigManager; +import net.runelite.client.eventbus.Subscribe; +import net.runelite.client.graphics.ModelOutlineRenderer; +import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginType; import net.runelite.client.plugins.theatre.rooms.BloatHandler; import net.runelite.client.plugins.theatre.rooms.MaidenHandler; import net.runelite.client.plugins.theatre.rooms.SotetsegHandler; import net.runelite.client.plugins.theatre.rooms.VerzikHandler; -import net.runelite.client.plugins.theatre.rooms.xarpus.XarpusHandler; import net.runelite.client.plugins.theatre.rooms.nylocas.NyloHandler; +import net.runelite.client.plugins.theatre.rooms.xarpus.XarpusHandler; import net.runelite.client.ui.overlay.OverlayManager; -import javax.inject.Inject; -import java.awt.*; - @PluginDescriptor( name = "Theatre of Blood", description = "All-in-one plugin for Theatre of Blood.", @@ -43,9 +54,9 @@ import java.awt.*; enabledByDefault = false ) -public class TheatrePlugin extends Plugin +@Slf4j +public class TheatrePlugin extends Plugin { - @Getter(AccessLevel.PUBLIC) @Setter(AccessLevel.PUBLIC) private TheatreRoom room; @@ -83,6 +94,9 @@ public class TheatrePlugin extends Plugin @Inject private TheatreConfig config; + @Inject + private ModelOutlineRenderer modelOutline; + @Provides TheatreConfig getConfig(ConfigManager configManager) { @@ -94,7 +108,7 @@ public class TheatrePlugin extends Plugin { room = TheatreRoom.UNKNOWN; - maidenHandler = new MaidenHandler(client, this, config); + maidenHandler = new MaidenHandler(client, this, config, modelOutline); bloatHandler = new BloatHandler(client, this, config); nyloHandler = new NyloHandler(client, this, config); sotetsegHandler = new SotetsegHandler(client, this, config); @@ -131,26 +145,47 @@ public class TheatrePlugin extends Plugin overlayManager.remove(overlay); } + @Subscribe + public void onSpotAnimationChanged(SpotAnimationChanged event) + { + if (maidenHandler != null) + { + maidenHandler.onSpotAnimationChanged(event); + } + } + @Subscribe public void onNpcSpawned(NpcSpawned event) { if (maidenHandler != null) + { maidenHandler.onNpcSpawned(event); + } if (bloatHandler != null) + { bloatHandler.onNpcSpawned(event); + } if (nyloHandler != null) + { nyloHandler.onNpcSpawned(event); + } if (sotetsegHandler != null) + { sotetsegHandler.onNpcSpawned(event); + } if (xarpusHandler != null) + { xarpusHandler.onNpcSpawned(event); + } if (verzikHandler != null) + { verzikHandler.onNpcSpawned(event); + } } @@ -158,19 +193,29 @@ public class TheatrePlugin extends Plugin public void onNpcDespawned(NpcDespawned event) { if (maidenHandler != null) + { maidenHandler.onNpcDespawned(event); + } if (bloatHandler != null) + { bloatHandler.onNpcDespawned(event); + } if (nyloHandler != null) + { nyloHandler.onNpcDespawned(event); + } if (sotetsegHandler != null) + { sotetsegHandler.onNpcDespawned(event); + } if (xarpusHandler != null) + { xarpusHandler.onNpcDespawned(event); + } } @@ -178,7 +223,18 @@ public class TheatrePlugin extends Plugin public void onAnimationChanged(AnimationChanged event) { if (verzikHandler != null) + { verzikHandler.onAnimationChanged(event); + } + } + + @Subscribe + public void onChatMessage(ChatMessage event) + { + if (maidenHandler != null) + { + maidenHandler.onChatMessage(event); + } } @Subscribe @@ -204,22 +260,34 @@ public class TheatrePlugin extends Plugin public void onGameTick(GameTick event) { if (maidenHandler != null) + { maidenHandler.onGameTick(); + } if (bloatHandler != null) + { bloatHandler.onGameTick(); + } if (nyloHandler != null) + { nyloHandler.onGameTick(); + } if (sotetsegHandler != null) + { sotetsegHandler.onGameTick(); + } if (xarpusHandler != null) + { xarpusHandler.onGameTick(); + } if (verzikHandler != null) + { verzikHandler.onGameTick(); + } if (widget == null) { @@ -315,27 +383,37 @@ public class TheatrePlugin extends Plugin public void onGroundObjectSpawned(GroundObjectSpawned event) { if (sotetsegHandler != null) + { sotetsegHandler.onGroundObjectSpawned(event); + } if (xarpusHandler != null) + { xarpusHandler.onGroundObjectSpawned(event); + } } @Subscribe public void onConfigChanged(ConfigChanged event) { if (nyloHandler != null) + { nyloHandler.onConfigChanged(); + } } @Subscribe public void onVarbitChanged(VarbitChanged event) { if (bloatHandler != null) + { bloatHandler.onVarbitChanged(event); + } if (xarpusHandler != null) + { xarpusHandler.onVarbitChanged(event); + } } @Subscribe diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/TheatreRoom.java b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/TheatreRoom.java index e13635b13f..4da8512503 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/TheatreRoom.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/TheatreRoom.java @@ -1,6 +1,6 @@ package net.runelite.client.plugins.theatre; -public enum TheatreRoom +public enum TheatreRoom { MAIDEN, BLOAT, @@ -8,5 +8,5 @@ public enum TheatreRoom SOTETSEG, XARPUS, VERSIK, - UNKNOWN; + UNKNOWN } \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/BloatHandler.java b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/BloatHandler.java index 98e229a58b..b62b979012 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/BloatHandler.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/BloatHandler.java @@ -1,42 +1,36 @@ package net.runelite.client.plugins.theatre.rooms; +import java.awt.Color; +import java.awt.Font; +import java.awt.Graphics2D; +import java.util.Random; import lombok.AccessLevel; import lombok.Getter; -import net.runelite.api.*; +import net.runelite.api.Client; +import net.runelite.api.GraphicsObject; +import net.runelite.api.NPC; +import net.runelite.api.NpcID; import net.runelite.api.Point; +import net.runelite.api.Varbits; import net.runelite.api.coords.WorldPoint; import net.runelite.api.events.NpcDespawned; import net.runelite.api.events.NpcSpawned; import net.runelite.api.events.VarbitChanged; import net.runelite.client.eventbus.Subscribe; +import net.runelite.client.plugins.theatre.RoomHandler; import net.runelite.client.plugins.theatre.TheatreConfig; import net.runelite.client.plugins.theatre.TheatrePlugin; import net.runelite.client.plugins.theatre.TheatreRoom; -import net.runelite.client.plugins.theatre.RoomHandler; - -import java.awt.*; -import java.util.Random; public class BloatHandler extends RoomHandler { - public static enum BloatState - { - DOWN, - UP, - WARN; - } - + private int bloatTimer; @Getter(AccessLevel.PUBLIC) private NPC bloat; - private int counter; - - //My variables private boolean bloatFlag; - int bloatTimer; private Color color; - @Getter(AccessLevel.PUBLIC) private BloatState bloatState; @@ -49,7 +43,9 @@ public class BloatHandler extends RoomHandler public void onStart() { if (this.plugin.getRoom() == TheatreRoom.BLOAT) + { return; + } this.reset(); this.plugin.setRoom(TheatreRoom.BLOAT); @@ -106,8 +102,8 @@ public class BloatHandler extends RoomHandler WorldPoint point = WorldPoint.fromLocal(client, object.getLocation()); if (!config.BloatFeetIndicatorRaveEdition()) { - drawTile(graphics, point, new Color(36, 248, 229), 2, 255, 10); - } + drawTile(graphics, point, new Color(36, 248, 229), 2, 255, 10); + } else { drawTile(graphics, point, color, 2, 255, 10); @@ -120,15 +116,15 @@ public class BloatHandler extends RoomHandler if (config.showBloatTimer()) { final String tickCounter = String.valueOf(bloatTimer); - int secondConversion = (int)(bloatTimer * .6); + int secondConversion = (int) (bloatTimer * .6); if (bloat != null) { Point canvasPoint = bloat.getCanvasTextLocation(graphics, tickCounter, 60); - if (bloatTimer <= 37) + if (bloatTimer <= 37) { renderTextLocation(graphics, tickCounter + "( " + secondConversion + " )", 15, Font.BOLD, Color.WHITE, canvasPoint); - } - else + } + else { renderTextLocation(graphics, tickCounter + "( " + secondConversion + " )", 15, Font.BOLD, Color.RED, canvasPoint); } @@ -139,9 +135,9 @@ public class BloatHandler extends RoomHandler @Subscribe public void onVarbitChanged(VarbitChanged event) { - if (client.getVar(Varbits.BLOAT_DOOR) == 1) + if (client.getVar(Varbits.BLOAT_DOOR) == 1) { - if (!bloatFlag) + if (!bloatFlag) { bloatTimer = 0; bloatFlag = true; @@ -149,12 +145,12 @@ public class BloatHandler extends RoomHandler } } - public void onNpcSpawned(NpcSpawned event) + public void onNpcSpawned(NpcSpawned event) { NPC npc = event.getNpc(); int id = npc.getId(); - if (id == NpcID.PESTILENT_BLOAT) + if (id == NpcID.PESTILENT_BLOAT) { this.onStart(); bloatTimer = 0; @@ -162,12 +158,12 @@ public class BloatHandler extends RoomHandler } } - public void onNpcDespawned(NpcDespawned event) + public void onNpcDespawned(NpcDespawned event) { NPC npc = event.getNpc(); int id = npc.getId(); - if (id == NpcID.PESTILENT_BLOAT) + if (id == NpcID.PESTILENT_BLOAT) { this.onStop(); bloatTimer = 0; @@ -175,9 +171,9 @@ public class BloatHandler extends RoomHandler } } - public void onGameTick() + public void onGameTick() { - if (plugin.getRoom() != TheatreRoom.BLOAT) + if (plugin.getRoom() != TheatreRoom.BLOAT) { return; } @@ -196,39 +192,46 @@ public class BloatHandler extends RoomHandler counter++; - if (bloat.getAnimation() == -1) + if (bloat.getAnimation() == -1) { bloatTimer++; counter = 0; if (bloat.getHealth() == 0) { bloatState = BloatState.DOWN; - } - else + } + else { bloatState = BloatState.UP; } - } - else + } + else { - if (25 < counter && counter < 35) + if (25 < counter && counter < 35) { bloatState = BloatState.WARN; - } - else if (counter < 26) + } + else if (counter < 26) { bloatTimer = 0; bloatState = BloatState.DOWN; - } - else if (bloat.getModelHeight() == 568) + } + else if (bloat.getModelHeight() == 568) { bloatTimer = 0; bloatState = BloatState.DOWN; - } - else + } + else { bloatState = BloatState.UP; } } } + + public enum BloatState + { + DOWN, + UP, + WARN + } } \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/MaidenHandler.java b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/MaidenHandler.java index 5c926e127b..4f109e80c6 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/MaidenHandler.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/MaidenHandler.java @@ -1,162 +1,298 @@ package net.runelite.client.plugins.theatre.rooms; -import lombok.AccessLevel; -import lombok.Getter; +import com.google.common.collect.ImmutableSet; +import java.awt.Color; +import java.awt.Graphics2D; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import lombok.extern.slf4j.Slf4j; import net.runelite.api.ChatMessageType; import net.runelite.api.Client; import net.runelite.api.GraphicsObject; import net.runelite.api.NPC; -import net.runelite.api.NpcID; import net.runelite.api.coords.WorldPoint; +import net.runelite.api.events.ChatMessage; import net.runelite.api.events.NpcDespawned; import net.runelite.api.events.NpcSpawned; +import net.runelite.api.events.SpotAnimationChanged; +import net.runelite.client.graphics.ModelOutlineRenderer; import net.runelite.client.plugins.theatre.RoomHandler; import net.runelite.client.plugins.theatre.TheatreConfig; import net.runelite.client.plugins.theatre.TheatreConstant; import net.runelite.client.plugins.theatre.TheatrePlugin; import net.runelite.client.plugins.theatre.TheatreRoom; +import net.runelite.client.util.Text; -import java.awt.*; -import java.util.ArrayList; -import java.util.List; - -public class MaidenHandler extends RoomHandler +@Slf4j +public class MaidenHandler extends RoomHandler { - - @Getter(AccessLevel.PACKAGE) + private static final ImmutableSet N1 = ImmutableSet.of( + new WorldPoint(3182, 4457, 0), + new WorldPoint(3174, 4457, 0) + ); + private static final ImmutableSet N2 = ImmutableSet.of( + new WorldPoint(3178, 4457, 0), + new WorldPoint(3186, 4455, 0), + new WorldPoint(3186, 4457, 0) + ); + private static final ImmutableSet S1 = ImmutableSet.of( + new WorldPoint(3174, 4437, 0), + new WorldPoint(3182, 4437, 0) + ); + private static final ImmutableSet S2 = ImmutableSet.of( + new WorldPoint(3186, 4439, 0), + new WorldPoint(3186, 4437, 0), + new WorldPoint(3178, 4437, 0) + ); + private static final ImmutableSet FREEZEANIMS = ImmutableSet.of( + 361, + 363, + 367, + 369 + ); + private static final Color TRANSPARENT = new Color(0, 0, 0, 0); + private static final Color FREEZE = new Color(0, 226, 255, 255); private List bloodThrows = new ArrayList<>(); - - @Getter(AccessLevel.PACKAGE) private List bloodSpawns = new ArrayList<>(); - - @Getter(AccessLevel.PACKAGE) private List bloodSpawnLocation = new ArrayList<>(); - - @Getter(AccessLevel.PACKAGE) private List bloodSpawnTarget = new ArrayList<>(); - + private NPC maiden; + private String nyloCall = "n1"; + private Set nylos = new HashSet<>(); private List healers = new ArrayList<>(); private int healerCount = 0; private int wave = 1; private long startTime = 0; + private ModelOutlineRenderer modelOutline; - public MaidenHandler(Client client, TheatrePlugin plugin, TheatreConfig config) + public MaidenHandler(Client client, TheatrePlugin plugin, TheatreConfig config, ModelOutlineRenderer modelOutline) { super(client, plugin, config); + this.modelOutline = modelOutline; } @Override - public void onStart() + public void onStart() { if (this.plugin.getRoom() == TheatreRoom.MAIDEN) + { return; - + } this.reset(); - this.plugin.setRoom(TheatreRoom.MAIDEN); this.startTime = System.currentTimeMillis(); - System.out.println("Starting Maiden Room"); + log.debug("Starting Maiden Room"); } @Override - public void onStop() + public void onStop() { this.reset(); this.plugin.setRoom(TheatreRoom.UNKNOWN); - System.out.println("Stopping Maiden Room"); + log.debug("Stopping Maiden Room"); } - public void reset() + public void reset() { this.bloodThrows.clear(); this.bloodSpawns.clear(); this.bloodSpawnLocation.clear(); this.bloodSpawnTarget.clear(); - this.healers.clear(); this.healerCount = 0; this.startTime = -1; this.wave = 1; } - public void render(Graphics2D graphics) + public void render(Graphics2D graphics) { - if (config.showMaidenBloodToss()) + for (Nylos nylo : nylos) { - for (WorldPoint point : bloodThrows) + if (nylo.getNpc() == null || nylo.getNpc().getId() == -1) + { + continue; + } + + final String location = nylo.getSpawnLocation().getName(); + + if (location.equals(nyloCall)) + { + Color color = Color.WHITE; + int width = 4; + + if (nylo.getNpc().getWorldArea().distanceTo(maiden.getWorldArea()) <= 3) + { + color = FREEZE; + width = 8; + } + + modelOutline.drawOutline(nylo.getNpc(), width, color, TRANSPARENT); + } + } + + if (config.showMaidenBloodToss()) + { + for (WorldPoint point : bloodThrows) { drawTile(graphics, point, new Color(36, 248, 229), 2, 150, 10); } } - if (config.showMaidenBloodSpawns()) + if (config.showMaidenBloodSpawns()) { - for (WorldPoint point : bloodSpawnLocation) + for (WorldPoint point : bloodSpawnLocation) { drawTile(graphics, point, new Color(36, 248, 229), 2, 180, 20); } - for (WorldPoint point : bloodSpawnTarget) + for (WorldPoint point : bloodSpawnTarget) { drawTile(graphics, point, new Color(36, 248, 229), 1, 120, 10); } } } - public void onNpcSpawned(NpcSpawned event) + public void onSpotAnimationChanged(SpotAnimationChanged event) { - NPC npc = event.getNpc(); - String name = npc.getName(); - int id = npc.getId(); + if (event.getActor() instanceof NPC) + { + NPC npc = (NPC) event.getActor(); - if (npc.getName() != null && name.equals("The Maiden of Sugadinti")) - { - this.onStart(); - } - else if (plugin.getRoom() == TheatreRoom.MAIDEN) - { - if (id == NpcID.BLOOD_SPAWN) + if (npc.getId() != 8366) { - if (!bloodSpawns.contains(npc)) - bloodSpawns.add(npc); - } - else if (name != null && name.equalsIgnoreCase("Nylocas Matomenos")) + return; + } + + int anim = npc.getSpotAnimation(); + + if (FREEZEANIMS.contains(anim)) { - this.healers.add(npc); + nylos.removeIf(c -> c.getNpc() == npc); } } } - public void onNpcDespawned(NpcDespawned event) + public void onNpcSpawned(NpcSpawned event) { NPC npc = event.getNpc(); - String name = npc.getName(); - int id = npc.getId(); - if (npc.getName() != null && name.equals("The Maiden of Sugadinti")) - { - this.onStop(); - } - else if (plugin.getRoom() == TheatreRoom.MAIDEN) - { - if (id == NpcID.BLOOD_SPAWN) - { - bloodSpawns.remove(npc); - } - } - } - - public void onGameTick() - { - if (plugin.getRoom() != TheatreRoom.MAIDEN) + if (npc.getName() == null) { return; } - bloodThrows.clear(); - for (GraphicsObject o : client.getGraphicsObjects()) + switch (npc.getName()) { - if (o.getId() == TheatreConstant.MAIDEN_BLOOD_THROW) + case "The Maiden of Sugadinti": + this.onStart(); + maiden = npc; + break; + case "Nylocas Matomenos": + if (!config.showNyloFreezeHighlights()) + { + return; + } + + this.healers.add(npc); + + WorldPoint wp = WorldPoint.fromLocalInstance(client, npc.getLocalLocation()); + + if (N1.contains(wp)) + { + addNylo(npc, Nylos.SpawnLocation.N1); + } + if (N2.contains(wp)) + { + addNylo(npc, Nylos.SpawnLocation.N2); + } + if (S1.contains(wp)) + { + addNylo(npc, Nylos.SpawnLocation.S1); + } + if (S2.contains(wp)) + { + addNylo(npc, Nylos.SpawnLocation.S2); + } + if (!N1.contains(wp) && !N2.contains(wp) && !S1.contains(wp) && !S2.contains(wp)) + { + log.debug("------------------------"); + log.debug("No World Points Matched"); + log.debug("Dumping Location"); + log.debug("Instance Loc: " + wp); + log.debug("------------------------"); + } + break; + case "Blood spawn": + if (!bloodSpawns.contains(npc)) + { + bloodSpawns.add(npc); + } + break; + } + } + + public void onChatMessage(ChatMessage event) + { + if (event.getSender() != null && !event.getSender().equals(client.getLocalPlayer().getName())) + { + return; + } + + String msg = Text.standardize(event.getMessageNode().getValue()); + + switch (msg) + { + case "n1": + case "n2": + case "s1": + case "s2": + nyloCall = msg; + break; + } + } + + public void onNpcDespawned(NpcDespawned event) + { + NPC npc = event.getNpc(); + + if (npc.getName() == null) + { + return; + } + + switch (npc.getName()) + { + case "The Maiden of Sugadinti": + this.onStop(); + break; + case "Blood Spawn": + bloodSpawns.remove(npc); + break; + } + } + + public void onGameTick() + { + if (plugin.getRoom() != TheatreRoom.MAIDEN) + { + return; + } + + if (!nylos.isEmpty()) + { + for (Nylos nylo : nylos) + { + nylos.removeIf(c -> c.getNpc().getId() == -1); + } + } + + bloodThrows.clear(); + + for (GraphicsObject o : client.getGraphicsObjects()) + { + if (o.getId() == TheatreConstant.MAIDEN_BLOOD_THROW) { bloodThrows.add(WorldPoint.fromLocal(client, o.getLocation())); } @@ -164,12 +300,13 @@ public class MaidenHandler extends RoomHandler bloodSpawnLocation = new ArrayList<>(bloodSpawnTarget); bloodSpawnTarget.clear(); - for (NPC spawn : bloodSpawns) + + for (NPC spawn : bloodSpawns) { bloodSpawnTarget.add(spawn.getWorldLocation()); } - if (this.healerCount != this.healers.size()) + if (this.healerCount != this.healers.size()) { this.healerCount = this.healers.size(); @@ -181,7 +318,15 @@ public class MaidenHandler extends RoomHandler int percentage = 70 - (20 * ((wave++) - 1)); if (config.extraTimers()) - this.client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "Wave 'The Maiden of Sugadinti - " + percentage + "%' completed! Duration: " + minutes + ":" + twoDigitString(seconds), null); + { + this.client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "Wave 'The Maiden of Sugadinti - " + percentage + "%' completed! Duration: " + minutes + ":" + twoDigitString(seconds), null); + } } } + + + private void addNylo(NPC npc, Nylos.SpawnLocation spawnLocation) + { + nylos.add(new Nylos(npc, spawnLocation)); + } } \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/Nylos.java b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/Nylos.java new file mode 100644 index 0000000000..53469f3fe4 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/Nylos.java @@ -0,0 +1,36 @@ +package net.runelite.client.plugins.theatre.rooms; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; +import net.runelite.api.NPC; + +class Nylos +{ + @Getter + private NPC npc; + @Getter + private int npcIndex; + @Getter + @Setter + private SpawnLocation spawnLocation; + + Nylos(NPC npc, SpawnLocation spawnLocation) + { + this.npc = npc; + this.npcIndex = npc.getIndex(); + this.spawnLocation = spawnLocation; + } + + @Getter + @AllArgsConstructor + enum SpawnLocation + { + N1("n1"), + N2("n2"), + S1("s1"), + S2("s2"); + + private String name; + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/SotetsegHandler.java b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/SotetsegHandler.java index 03c706c154..13551b9ec4 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/SotetsegHandler.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/SotetsegHandler.java @@ -1,9 +1,23 @@ package net.runelite.client.plugins.theatre.rooms; +import java.awt.BasicStroke; +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.Polygon; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; import lombok.AccessLevel; import lombok.Getter; -import net.runelite.api.*; +import net.runelite.api.Client; +import net.runelite.api.GroundObject; +import net.runelite.api.NPC; +import net.runelite.api.NpcID; import net.runelite.api.Point; +import net.runelite.api.Projectile; +import net.runelite.api.Tile; import net.runelite.api.coords.WorldPoint; import net.runelite.api.events.GroundObjectSpawned; import net.runelite.api.events.NpcDespawned; @@ -16,33 +30,24 @@ import net.runelite.client.plugins.theatre.TheatrePlugin; import net.runelite.client.plugins.theatre.TheatreRoom; import net.runelite.client.ui.overlay.OverlayUtil; -import java.awt.*; -import java.util.*; -import java.util.List; - public class SotetsegHandler extends RoomHandler { @Getter(AccessLevel.PUBLIC) private final Map redTiles = new LinkedHashMap<>(); - + //My variables + private int playerX; + private int playerY; @Getter(AccessLevel.PUBLIC) private List redOverworld = new ArrayList<>(); - private List blackOverworld = new ArrayList<>(); - private List blackUnderworld = new ArrayList<>(); - private List redUnderworld = new ArrayList<>(); - private List gridPath = new ArrayList<>(); - - //My variables - int playerX; - int playerY; private Map soteyProjectiles = new HashMap<>(); private NPC npc; private long startTime = 0; + public SotetsegHandler(Client client, TheatrePlugin plugin, TheatreConfig config) { super(client, plugin, config); @@ -52,7 +57,9 @@ public class SotetsegHandler extends RoomHandler public void onStart() { if (this.plugin.getRoom() == TheatreRoom.SOTETSEG) + { return; + } this.reset(); this.plugin.setRoom(TheatreRoom.SOTETSEG); @@ -125,68 +132,16 @@ public class SotetsegHandler extends RoomHandler String countdownStr; if (id == 1607) { - countdownStr = "R " + String.valueOf(ticksRemaining); + countdownStr = "R " + ticksRemaining; } else { - countdownStr = "M " + String.valueOf(ticksRemaining); + countdownStr = "M " + ticksRemaining; } projectileMap.put(p, countdownStr); } renderProjectiles(graphics, projectileMap); - //Legacy code from yuri, works great but shows all projectiles not just ones targetting local player - /** - for (Projectile projectile : client.getProjectiles()) - { - int id = projectile.getId(); - - String name = null; - Color color = null; - - double millis = projectile.getRemainingCycles(); - double ticks = millis / 60; // 10 millis per cycle, 0.6 ticks per second, 10/0.6 = 60 - double round = Math.round(ticks * 10d) / 10d; - if (id == TheatreConstant.SOTETSEG_BOMB) - { - name = "" + round; - color = Color.WHITE; - } - else if (id == TheatreConstant.SOTETSEG_MAGE) - { - - name = "" + round; - color = new Color(64, 224, 208, 255); - } - else if (id == TheatreConstant.SOTETSEG_RANGE) - { - name = "" + round; - color = new Color(57, 255, 20, 255); - } - - if (name != null) - { - int x = (int) projectile.getX(); - int y = (int) projectile.getY(); - - LocalPoint point = new LocalPoint(x, y); - Point loc = Perspective.getCanvasTextLocation(client, graphics, point, name, 0); - - if (loc != null) - { - if (id == TheatreConstant.SOTETSEG_BOMB) - { - graphics.setFont(new Font("Arial", Font.BOLD, 20)); - } - else - { - graphics.setFont(new Font("Arial", Font.BOLD, 17)); - } - - OverlayUtil.renderTextLocation(graphics, loc, name, color); - } - } - }**/ } } @@ -242,12 +197,16 @@ public class SotetsegHandler extends RoomHandler if (t.getPlane() == 0) { if (!blackOverworld.contains(p)) + { blackOverworld.add(p); + } } else { if (!blackUnderworld.contains(p)) + { blackUnderworld.add(p); + } } } @@ -265,7 +224,9 @@ public class SotetsegHandler extends RoomHandler else { if (!redUnderworld.contains(p)) + { redUnderworld.add(p); + } } } } @@ -282,19 +243,10 @@ public class SotetsegHandler extends RoomHandler playerY = client.getLocalPlayer().getLocalLocation().getY(); - - //Remove projectiles that are about to die if (!soteyProjectiles.isEmpty()) { - for (Iterator it = soteyProjectiles.keySet().iterator(); it.hasNext(); ) - { - Projectile projectile = it.next(); - if (projectile.getRemainingCycles() < 1) - { - it.remove(); - } - } + soteyProjectiles.keySet().removeIf(p -> p.getRemainingCycles() < 1); } boolean sotetsegFighting = false; @@ -338,7 +290,7 @@ public class SotetsegHandler extends RoomHandler WorldPoint pW = new WorldPoint(p.getX() - 1, p.getY(), p.getPlane()); if (!((redUnderworld.contains(pN) && redUnderworld.contains(pS)) || - (redUnderworld.contains(pE) && redUnderworld.contains(pW)))) + (redUnderworld.contains(pE) && redUnderworld.contains(pW)))) { gridPath.add(new Point(p.getX() - minX, p.getY() - minY)); if (!messageSent) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/VerzikHandler.java b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/VerzikHandler.java index 7b02a32106..0f92345fa4 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/VerzikHandler.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/VerzikHandler.java @@ -1,5 +1,12 @@ package net.runelite.client.plugins.theatre.rooms; +import java.awt.Color; +import java.awt.Font; +import java.awt.Graphics2D; +import java.util.HashMap; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import lombok.AccessLevel; import lombok.Getter; import net.runelite.api.Actor; @@ -22,38 +29,26 @@ import net.runelite.client.plugins.theatre.TheatreConfig; import net.runelite.client.plugins.theatre.TheatreConstant; import net.runelite.client.plugins.theatre.TheatrePlugin; import net.runelite.client.plugins.theatre.TheatreRoom; -import java.awt.*; -import java.util.*; -import java.util.regex.Matcher; -import java.util.regex.Pattern; public class VerzikHandler extends RoomHandler { @Getter(AccessLevel.PACKAGE) private final Map Verzik_RangeProjectiles = new HashMap<>(); - + //My variables + private int redCrabsTimer; @Getter(AccessLevel.PUBLIC) private int versikCounter = 0; private int attacksLeft = 0; - @Getter(AccessLevel.PUBLIC) private NPC npc; - private int lastId = -1; - private int autosSinceYellows; private int yellows; - private boolean tornados; - private int attackTick = -1; - private long startTime = 0; - //My variables - int redCrabsTimer; - public VerzikHandler(Client client, TheatrePlugin plugin, TheatreConfig config) { super(client, plugin, config); @@ -63,7 +58,9 @@ public class VerzikHandler extends RoomHandler public void onStart() { if (this.plugin.getRoom() == TheatreRoom.VERSIK) + { return; + } this.reset(); this.plugin.setRoom(TheatreRoom.VERSIK); @@ -117,10 +114,10 @@ public class VerzikHandler extends RoomHandler if (this.versikCounter >= 0) { String str = Integer.toString(versikCounter); - + LocalPoint lp = npc.getLocalLocation(); Point point = Perspective.getCanvasTextLocation(client, graphics, lp, str, 0); - + renderTextLocation(graphics, str, 20, Font.BOLD, Color.CYAN, point); } } @@ -141,19 +138,6 @@ public class VerzikHandler extends RoomHandler } } -/* - if (npc.getAnimation() == 8117){ - if (this.redCrabsTimer > 0){ - String str = Integer.toString(redCrabsTimer); - - LocalPoint lp = npc.getLocalLocation(); - Point point = Perspective.getCanvasTextLocation(client, graphics, lp, str, 60); - renderTextLocation(graphics, str, 15, Font.BOLD, Color.WHITE, point); - } - - - }*/ - else if (id == TheatreConstant.VERZIK_ID_P3) { if (config.p3attacks()) @@ -162,10 +146,10 @@ public class VerzikHandler extends RoomHandler if (versikCounter > 0 && versikCounter < 8) { String str = Math.max(versikCounter, 0) + "";// + " | " + model.getModelHeight();// + " | " + model.getRadius(); - + LocalPoint lp = npc.getLocalLocation(); Point point = Perspective.getCanvasTextLocation(client, graphics, lp, str, 0); - + renderTextLocation(graphics, str, 15, Font.BOLD, Color.WHITE, point); } } @@ -210,16 +194,22 @@ public class VerzikHandler extends RoomHandler for (NPC npc : client.getNpcs()) { if (npc.getName() == null) + { continue; + } Pattern p = Pattern.compile("Nylocas (Hagios|Toxobolos|Ischyros)"); Matcher m = p.matcher(npc.getName()); if (!m.matches()) + { continue; + } Actor target = npc.getInteracting(); if (target == null || target.getName() == null) + { continue; + } LocalPoint lp = npc.getLocalLocation(); Color color = local.getName().equals(target.getName()) ? Color.RED : Color.GREEN; @@ -231,15 +221,17 @@ public class VerzikHandler extends RoomHandler } } -public void onProjectileMoved(ProjectileMoved event) -{ - Projectile projectile = event.getProjectile(); - if (projectile.getId() == 1583) + + public void onProjectileMoved(ProjectileMoved event) { - WorldPoint p = WorldPoint.fromLocal(client, event.getPosition()); - Verzik_RangeProjectiles.put(projectile, p); + Projectile projectile = event.getProjectile(); + if (projectile.getId() == 1583) + { + WorldPoint p = WorldPoint.fromLocal(client, event.getPosition()); + Verzik_RangeProjectiles.put(projectile, p); + } } -} + public void onNpcSpawned(NpcSpawned event) { NPC npc = event.getNpc(); @@ -282,7 +274,9 @@ public void onProjectileMoved(ProjectileMoved event) Actor actor = event.getActor(); if (!(actor instanceof NPC)) + { return; + } NPC npc = (NPC) actor; int id = npc.getId(); @@ -325,29 +319,22 @@ public void onProjectileMoved(ProjectileMoved event) } if (!Verzik_RangeProjectiles.isEmpty()) { - for (Iterator it = Verzik_RangeProjectiles.keySet().iterator(); it.hasNext();) - { - Projectile projectile = it.next(); - if (projectile.getRemainingCycles() < 1) - { - it.remove(); - } - } + Verzik_RangeProjectiles.keySet().removeIf(p -> p.getRemainingCycles() < 1); } if (this.yellows == 0) { //if (this.autosSinceYellows > 0){ - for (GraphicsObject object : client.getGraphicsObjects()) + for (GraphicsObject object : client.getGraphicsObjects()) + { + if (object.getId() == TheatreConstant.GRAPHIC_ID_YELLOWS) { - if (object.getId() == TheatreConstant.GRAPHIC_ID_YELLOWS) - { - this.yellows = 14; + this.yellows = 14; // this.versikCounter = 22; - this.autosSinceYellows = 0; - System.out.println("Yellows have spawned."); - break; - } + this.autosSinceYellows = 0; + System.out.println("Yellows have spawned."); + break; } + } //} } else @@ -380,7 +367,9 @@ public void onProjectileMoved(ProjectileMoved event) } if (foundTornado && foundVerzik) + { break; + } } if (!foundVerzik) @@ -390,7 +379,9 @@ public void onProjectileMoved(ProjectileMoved event) } if (npc == null) + { return; + } int id = npc.getId(); @@ -410,7 +401,9 @@ public void onProjectileMoved(ProjectileMoved event) long minutes = seconds / 60L; seconds = seconds % 60; if (config.extraTimers()) - this.client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "Wave 'The Final Challenge - Part 1' completed! Duration: " + minutes + ":" + twoDigitString(seconds), null); + { + this.client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "Wave 'The Final Challenge - Part 1' completed! Duration: " + minutes + ":" + twoDigitString(seconds), null); + } } else if (id == TheatreConstant.VERZIK_ID_P2_TRANSFORM && this.startTime != 0) { @@ -424,7 +417,9 @@ public void onProjectileMoved(ProjectileMoved event) this.versikCounter = -1; this.attacksLeft = 9; if (config.extraTimers()) - this.client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "Wave 'The Final Challenge - Part 2' completed! Duration: " + minutes + ":" + twoDigitString(seconds), null); + { + this.client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "Wave 'The Final Challenge - Part 2' completed! Duration: " + minutes + ":" + twoDigitString(seconds), null); + } } } @@ -443,7 +438,9 @@ public void onProjectileMoved(ProjectileMoved event) { versikCounter--; if (versikCounter < 0) + { versikCounter = 0; + } } else if (id == TheatreConstant.VERZIK_ID_P3) { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/nylocas/NyloHandler.java b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/nylocas/NyloHandler.java index 1e84e21eb6..4ff3c17ae7 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/nylocas/NyloHandler.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/nylocas/NyloHandler.java @@ -1,5 +1,17 @@ package net.runelite.client.plugins.theatre.rooms.nylocas; +import java.awt.BasicStroke; +import java.awt.Color; +import java.awt.Font; +import java.awt.Graphics2D; +import java.awt.Polygon; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import lombok.AccessLevel; import lombok.Getter; import lombok.Setter; @@ -18,41 +30,26 @@ import net.runelite.client.plugins.theatre.TheatreConstant; import net.runelite.client.plugins.theatre.TheatrePlugin; import net.runelite.client.plugins.theatre.TheatreRoom; -import java.awt.*; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public class NyloHandler extends RoomHandler +public class NyloHandler extends RoomHandler { + public long startTime = 0L; + int startTick = 0; + ArrayList waveSpawns = new ArrayList(); + ArrayList waveAgros = new ArrayList(); @Getter(AccessLevel.PUBLIC) private Map pillars = new HashMap<>(); - @Getter(AccessLevel.PUBLIC) private Map spiders = new HashMap<>(); - @Getter @Setter private int wave = 0; - private NyloOverlay overlay = null; private NyloPredictor predictor = null; - private Point south = new Point(64, 41); private Point west = new Point(49, 56); private Point east = new Point(78, 56); - public long startTime = 0L; - public int startTick = 0; - - public ArrayList waveSpawns = new ArrayList(); - public ArrayList waveAgros = new ArrayList(); - public NyloHandler(Client client, TheatrePlugin plugin, TheatreConfig config) { super(client, plugin, config); @@ -62,7 +59,9 @@ public class NyloHandler extends RoomHandler public void onStart() { if (this.plugin.getRoom() == TheatreRoom.NYLOCAS) + { return; + } this.reset(); @@ -102,7 +101,9 @@ public class NyloHandler extends RoomHandler if (this.startTime != 0) { if (config.extraTimers()) - this.client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "Wave 'The Nylocas - Waves' completed! Duration: " + minutes + ":" + twoDigitString(seconds), null); + { + this.client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "Wave 'The Nylocas - Waves' completed! Duration: " + minutes + ":" + twoDigitString(seconds), null); + } } System.out.println("Stopping Nylocas Room"); } @@ -159,7 +160,7 @@ public class NyloHandler extends RoomHandler for (NPC npc : pillars.keySet()) { final int health = pillars.get(npc); - final String healthStr = String.valueOf(health) + "%"; + final String healthStr = health + "%"; WorldPoint p = npc.getWorldLocation(); LocalPoint lp = LocalPoint.fromWorld(client, p.getX() + 1, p.getY() + 1); @@ -203,45 +204,21 @@ public class NyloHandler extends RoomHandler Set toHighlight = new HashSet(); - /** - if (config.highlightNyloParents()) - { - for (NPC npc : new ArrayList(this.waveSpawns)) - { - try - { - if (npc.getHealthRatio() == 0 || npc.isDead()) - { - this.waveSpawns.remove(npc); - continue; - } - - if (!toHighlight.contains(npc)) - toHighlight.add(npc); - } - catch (Exception ex) - { - - } - } - }**/ - - if (config.highlightNyloAgros()) + if (config.highlightNyloAgros()) { for (NPC npc : new ArrayList(this.waveAgros)) { try { - if (npc.getHealthRatio() == 0 || npc.isDead()) + if (npc.getHealthRatio() == 0 || npc.isDead()) { this.waveAgros.remove(npc); continue; } - if (!toHighlight.contains(npc)) - toHighlight.add(npc); - } - catch (Exception ex) + toHighlight.add(npc); + } + catch (Exception ex) { } @@ -258,58 +235,25 @@ public class NyloHandler extends RoomHandler String name = npc.getName() != null ? npc.getName() : ""; if (name.contains("Hagios")) + { color = Color.CYAN; + } else if (name.contains("Toxobolos")) + { color = Color.GREEN; + } else + { color = Color.LIGHT_GRAY; + } renderPoly(graphics, color, objectClickbox); - } + } catch (Exception ex) { } } -/** - if (config.showNylocasSpawns() && predictor != null) - { - NyloPredictor.Wave nextWave = predictor.getNextWave(); - if (nextWave != null) - { - TheatreConfig.NYLOCAS mark = config.highlightNyloRoles(); - - String southStr = predictor.getSpawnStr(NyloPredictor.Spawn.SOUTH, nextWave); - if (southStr != null && south != null) - { - LocalPoint lp = LocalPoint.fromScene(south.getX(), south.getY()); - Point point = Perspective.getCanvasTextLocation(client, graphics, lp, southStr, 1); - Color color = mark != TheatreConfig.NYLOCAS.NONE ? (((southStr.contains("Mage") && mark == TheatreConfig.NYLOCAS.MAGE) || (southStr.contains("Range") && mark == TheatreConfig.NYLOCAS.RANGER) || (southStr.contains("Melee") && mark == TheatreConfig.NYLOCAS.MELEE)) ? Color.MAGENTA : Color.RED) : Color.RED; - renderTextLocation(graphics, southStr, 18, Font.BOLD, color, point); -// drawTile(graphics, WorldPoint.fromLocal(client, lp), new Color(0, 150, 200), 2, 150, 10); - } - - String westStr = predictor.getSpawnStr(NyloPredictor.Spawn.WEST, nextWave); - if (westStr != null && west != null) - { - LocalPoint lp = LocalPoint.fromScene(west.getX(), west.getY()); - Point point = Perspective.getCanvasTextLocation(client, graphics, lp, westStr, 1); - Color color = mark != TheatreConfig.NYLOCAS.NONE ? (((westStr.contains("Mage") && mark == TheatreConfig.NYLOCAS.MAGE) || (westStr.contains("Range") && mark == TheatreConfig.NYLOCAS.RANGER) || (westStr.contains("Melee") && mark == TheatreConfig.NYLOCAS.MELEE)) ? Color.MAGENTA : Color.RED) : Color.RED; - renderTextLocation(graphics, westStr, 18, Font.BOLD, color, point); -// drawTile(graphics, WorldPoint.fromLocal(client, lp), new Color(0, 150, 200), 2, 150, 10); - } - - String eastStr = predictor.getSpawnStr(NyloPredictor.Spawn.EAST, nextWave); - if (eastStr != null && east != null) - { - LocalPoint lp = LocalPoint.fromScene(east.getX(), east.getY()); - Point point = Perspective.getCanvasTextLocation(client, graphics, lp, eastStr, 1); - Color color = mark != TheatreConfig.NYLOCAS.NONE ? (((eastStr.contains("Mage") && mark == TheatreConfig.NYLOCAS.MAGE) || (eastStr.contains("Range") && mark == TheatreConfig.NYLOCAS.RANGER) || (eastStr.contains("Melee") && mark == TheatreConfig.NYLOCAS.MELEE)) ? Color.MAGENTA : Color.RED) : Color.RED; - renderTextLocation(graphics, eastStr, 18, Font.BOLD, color, point); -// drawTile(graphics, WorldPoint.fromLocal(client, lp), new Color(0, 150, 200), 2, 150, 10); - } - } - }**/ } public void onNpcSpawned(NpcSpawned event) @@ -351,15 +295,9 @@ public class NyloHandler extends RoomHandler NPC npc = event.getNpc(); int id = npc.getId(); - if (this.waveSpawns.contains(npc)) - { - this.waveSpawns.remove(npc); - } + this.waveSpawns.remove(npc); - if (this.waveAgros.contains(npc)) - { - this.waveAgros.remove(npc); - } + this.waveAgros.remove(npc); if (id == TheatreConstant.NPC_ID_NYLOCAS_PILLAR) { @@ -393,7 +331,7 @@ public class NyloHandler extends RoomHandler if (plugin.getRoom() != TheatreRoom.NYLOCAS) { return; - } + } else { boolean findPillar = false; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/nylocas/NyloOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/nylocas/NyloOverlay.java index 0f3e4dd26d..9c57485f26 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/nylocas/NyloOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/nylocas/NyloOverlay.java @@ -43,18 +43,17 @@ import net.runelite.client.ui.overlay.components.table.TableAlignment; import net.runelite.client.ui.overlay.components.table.TableComponent; import net.runelite.client.util.ColorUtil; -class NyloOverlay extends Overlay +class NyloOverlay extends Overlay { private final Client client; private final TheatrePlugin plugin; - private final TheatreConfig config; private final PanelComponent panelComponent = new PanelComponent(); private NyloHandler nylohandler; - public NyloOverlay(Client client, TheatrePlugin plugin, TheatreConfig config, NyloHandler nylohandler) + NyloOverlay(Client client, TheatrePlugin plugin, TheatreConfig config, NyloHandler nylohandler) { super(plugin); @@ -63,7 +62,6 @@ class NyloOverlay extends Overlay this.client = client; this.plugin = plugin; - this.config = config; this.nylohandler = nylohandler; getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Nylocas Overlay")); @@ -111,14 +109,14 @@ class NyloOverlay extends Overlay if (nyloCount > 12) { tableComponent.addRow("Total Nylocas:", ColorUtil.prependColorTag(nyloCount + " / 12", Color.RED)); - } + } else { tableComponent.addRow("Total Nylocas:", ColorUtil.prependColorTag(nyloCount + " / 12", Color.GREEN)); } - } - else + } + else { if (nyloCount > 24) { @@ -132,23 +130,6 @@ class NyloOverlay extends Overlay panelComponent.getChildren().add(tableComponent); - - /** - panelComponent.getChildren().add(LineComponent.builder() - .left("Ischyros:") - .right(Integer.toString(ischyros)) - .build()); - - panelComponent.getChildren().add(LineComponent.builder() - .left("Toxobolos:") - .right(Integer.toString(toxobolos)) - .build()); - - panelComponent.getChildren().add(LineComponent.builder() - .left("Hagios:") - .right(Integer.toString(hagios)) - .build()); - **/ return panelComponent.render(graphics); } } \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/nylocas/NyloPredictor.java b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/nylocas/NyloPredictor.java index 75042fa328..b9d3e19b44 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/nylocas/NyloPredictor.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/nylocas/NyloPredictor.java @@ -1,91 +1,19 @@ package net.runelite.client.plugins.theatre.rooms.nylocas; -import net.runelite.api.Client; -import net.runelite.api.NPC; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.events.NpcSpawned; - import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import net.runelite.api.Client; +import net.runelite.api.NPC; +import net.runelite.api.coords.LocalPoint; +import net.runelite.api.events.NpcSpawned; public class NyloPredictor { - public enum NylocasType - { - MELEE_162, - RANGE_162, - MAGE_162, - MELEE_260, - RANGE_260, - MAGE_260; - } - - public enum Spawn - { - WEST, - SOUTH, - EAST; - } - - public static class Nylocas - { - - private NylocasType type; - private Spawn spawn; - - public Nylocas(NylocasType type, Spawn spawn) + private static final Wave[] NYLOCAS_WAVES = new Wave[] { - this.type = type; - this.spawn = spawn; - } - - public NylocasType getType() - { - return this.type; - } - - public Spawn getSpawn() - { - return this.spawn; - } - - @Override - public boolean equals(Object object) - { - if (object != null && (object instanceof Nylocas)) - { - Nylocas nylo = (Nylocas) object; - if (nylo.getType() == this.type && nylo.getSpawn() == this.spawn) - { - return true; - } - } - - return false; - } - } - - public static class Wave - { - - private Nylocas[] spawns; - - public Wave(Nylocas... nylocas) - { - this.spawns = nylocas; - } - - public Nylocas[] getSpawns() - { - return this.spawns; - } - } - - public static final Wave[] NYLOCAS_WAVES = new Wave[] - { new Wave(new Nylocas(NylocasType.RANGE_162, Spawn.WEST), new Nylocas(NylocasType.MAGE_162, Spawn.SOUTH), new Nylocas(NylocasType.MELEE_162, Spawn.EAST)), new Wave(new Nylocas(NylocasType.MAGE_162, Spawn.WEST), new Nylocas(NylocasType.MELEE_162, Spawn.SOUTH), new Nylocas(NylocasType.RANGE_162, Spawn.EAST)), new Wave(new Nylocas(NylocasType.MELEE_162, Spawn.WEST), new Nylocas(NylocasType.RANGE_162, Spawn.SOUTH), new Nylocas(NylocasType.MAGE_162, Spawn.EAST)), @@ -117,15 +45,16 @@ public class NyloPredictor new Wave(new Nylocas(NylocasType.MELEE_162, Spawn.WEST), new Nylocas(NylocasType.RANGE_162, Spawn.WEST), new Nylocas(NylocasType.MELEE_260, Spawn.SOUTH), new Nylocas(NylocasType.RANGE_162, Spawn.EAST), new Nylocas(NylocasType.MAGE_162, Spawn.EAST)), new Wave(new Nylocas(NylocasType.RANGE_260, Spawn.WEST), new Nylocas(NylocasType.MAGE_162, Spawn.SOUTH), new Nylocas(NylocasType.MELEE_162, Spawn.SOUTH), new Nylocas(NylocasType.MAGE_260, Spawn.EAST)), new Wave(new Nylocas(NylocasType.MELEE_162, Spawn.WEST), new Nylocas(NylocasType.RANGE_162, Spawn.WEST), new Nylocas(NylocasType.MAGE_162, Spawn.SOUTH), new Nylocas(NylocasType.MELEE_162, Spawn.SOUTH), new Nylocas(NylocasType.RANGE_162, Spawn.EAST), new Nylocas(NylocasType.MAGE_162, Spawn.EAST)) - }; - + }; public Client client; - public NyloHandler handler; + int westBound = 50; + int eastBound = 77; + int southBound = 42; + private NyloHandler handler; + private Map currentSpawns = new HashMap(); + private int currentIndex = -1; - public Map currentSpawns = new HashMap(); - public int currentIndex = -1; - - public NyloPredictor(Client client, NyloHandler handler) + NyloPredictor(Client client, NyloHandler handler) { this.client = client; this.handler = handler; @@ -138,12 +67,6 @@ public class NyloPredictor this.currentIndex = -1; } - public int westBound = 50; - - public int eastBound = 77; - - public int southBound = 42; - public void onNpcSpawned(NpcSpawned event) { NPC npc = event.getNpc(); @@ -157,11 +80,11 @@ public class NyloPredictor if (x <= westBound) { spawn = Spawn.WEST; - } + } else if (x >= eastBound) { spawn = Spawn.EAST; - } + } else if (y <= southBound) { spawn = Spawn.SOUTH; @@ -175,11 +98,11 @@ public class NyloPredictor if (name.contains("Hagios")) { type = NylocasType.valueOf("MAGE_" + level); - } + } else if (name.contains("Toxobolos")) { type = NylocasType.valueOf("RANGE_" + level); - } + } else if (name.contains("Ischyros")) { type = NylocasType.valueOf("MELEE_" + level); @@ -213,7 +136,7 @@ public class NyloPredictor int index = queue.indexOf(nylocas); Nylocas hashed = queue.remove(index); npcs.put(currentSpawns.get(hashed), hashed); - } + } else { found = false; @@ -257,12 +180,14 @@ public class NyloPredictor for (NPC npc : client.getNpcs()) { if (npc.getHealthRatio() == 0) + { continue; + } if (npc.getName().equalsIgnoreCase("Nylocas Hagios")) { mage_level += npc.getCombatLevel(); mage_count += 1; - } + } else if (npc.getName().equalsIgnoreCase("Nylocas Toxobolos")) { range_level += npc.getCombatLevel(); @@ -300,7 +225,7 @@ public class NyloPredictor } } - public boolean isAgressive(NylocasType type, Spawn spawn, int wave) + private boolean isAgressive(NylocasType type, Spawn spawn, int wave) { if (wave == 0 && spawn == Spawn.WEST) { @@ -329,9 +254,13 @@ public class NyloPredictor else if (wave == 9) { if (spawn == Spawn.EAST && type == NylocasType.RANGE_162) + { return true; - else if (spawn == Spawn.WEST) - return true; + } + else + { + return spawn == Spawn.WEST; + } } else if (wave == 10 && (spawn == Spawn.EAST || spawn == Spawn.WEST)) { @@ -344,23 +273,35 @@ public class NyloPredictor else if (wave == 12) { if (spawn == Spawn.WEST && type == NylocasType.MAGE_162) + { return true; - else if (spawn == Spawn.EAST) - return true; + } + else + { + return spawn == Spawn.EAST; + } } else if (wave == 13) { if (spawn == Spawn.WEST && type == NylocasType.MELEE_162) + { return true; - else if (spawn == Spawn.EAST) - return true; + } + else + { + return spawn == Spawn.EAST; + } } else if (wave == 14) { if (spawn == Spawn.WEST && type == NylocasType.RANGE_162) + { return true; - else if (spawn == Spawn.EAST && type == NylocasType.MAGE_162) - return true; + } + else + { + return spawn == Spawn.EAST && type == NylocasType.MAGE_162; + } } else if (wave == 17 && spawn == Spawn.WEST) { @@ -405,17 +346,20 @@ public class NyloPredictor else if (wave == 28) { if (spawn == Spawn.EAST && type == NylocasType.RANGE_162) + { return true; - else if (spawn == Spawn.WEST && type == NylocasType.MELEE_162) - return true; + } + else + { + return spawn == Spawn.WEST && type == NylocasType.MELEE_162; + } } - else if (wave == 29 && spawn == Spawn.EAST) + else { - return true; + return wave == 29 && spawn == Spawn.EAST; } - return false; } public int getCurrentWave() @@ -487,4 +431,72 @@ public class NyloPredictor return types.length() > 0 ? types : null; } } + + public enum NylocasType + { + MELEE_162, + RANGE_162, + MAGE_162, + MELEE_260, + RANGE_260, + MAGE_260 + } + + public enum Spawn + { + WEST, + SOUTH, + EAST + } + + public static class Nylocas + { + + private NylocasType type; + private Spawn spawn; + + public Nylocas(NylocasType type, Spawn spawn) + { + this.type = type; + this.spawn = spawn; + } + + public NylocasType getType() + { + return this.type; + } + + public Spawn getSpawn() + { + return this.spawn; + } + + @Override + public boolean equals(Object object) + { + if (object != null && (object instanceof Nylocas)) + { + Nylocas nylo = (Nylocas) object; + return nylo.getType() == this.type && nylo.getSpawn() == this.spawn; + } + + return false; + } + } + + public static class Wave + { + + private Nylocas[] spawns; + + public Wave(Nylocas... nylocas) + { + this.spawns = nylocas; + } + + public Nylocas[] getSpawns() + { + return this.spawns; + } + } } \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/xarpus/XarpusCounter.java b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/xarpus/XarpusCounter.java index 3b39af4640..2be0d90109 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/xarpus/XarpusCounter.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/xarpus/XarpusCounter.java @@ -22,10 +22,8 @@ public class XarpusCounter extends Overlay private final Client client; private final TheatrePlugin plugin; private final TheatreConfig config; - - private XarpusHandler xarpusHandler; - PanelComponent panelComponent = new PanelComponent(); + private XarpusHandler xarpusHandler; public XarpusCounter(Client client, TheatrePlugin plugin, TheatreConfig config, XarpusHandler xarpushandler) { @@ -51,13 +49,13 @@ public class XarpusCounter extends Overlay // Build overlay title panelComponent.getChildren().add(TitleComponent.builder() - .text(overlayTitle) - .color(Color.GREEN) - .build()); + .text(overlayTitle) + .color(Color.GREEN) + .build()); //Set the size of overlay panelComponent.setPreferredSize(new Dimension( - graphics.getFontMetrics().stringWidth(overlayTitle) + 30, 0 + graphics.getFontMetrics().stringWidth(overlayTitle) + 30, 0 )); TableComponent tableComponent = new TableComponent(); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/xarpus/XarpusHandler.java b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/xarpus/XarpusHandler.java index f8395e14b4..d2c278806e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/xarpus/XarpusHandler.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/xarpus/XarpusHandler.java @@ -1,5 +1,13 @@ package net.runelite.client.plugins.theatre.rooms.xarpus; +import java.awt.BasicStroke; +import java.awt.Color; +import java.awt.Font; +import java.awt.Graphics2D; +import java.awt.Polygon; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; import lombok.Getter; import net.runelite.api.ChatMessageType; import net.runelite.api.Client; @@ -19,20 +27,13 @@ import net.runelite.client.plugins.theatre.TheatreConfig; import net.runelite.client.plugins.theatre.TheatreConstant; import net.runelite.client.plugins.theatre.TheatrePlugin; import net.runelite.client.plugins.theatre.TheatreRoom; -import java.awt.*; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; public class XarpusHandler extends RoomHandler { - private int previousTurn; - - private boolean staring; - private final Map exhumes = new HashMap<>(); - + private int previousTurn; + private boolean staring; private int ticksUntilShoot = 8; @Getter @@ -56,7 +57,9 @@ public class XarpusHandler extends RoomHandler public void onStart() { if (this.plugin.getRoom() == TheatreRoom.XARPUS) + { return; + } this.reset(); this.plugin.setRoom(TheatreRoom.XARPUS); @@ -102,7 +105,9 @@ public class XarpusHandler extends RoomHandler public void render(Graphics2D graphics) { if (npc == null) + { return; + } if (npc.getId() == NpcID.XARPUS_8340) //&& !staring&& config.showXarpusTick()) { @@ -111,13 +116,15 @@ public class XarpusHandler extends RoomHandler this.up = true; long elapsedTime = System.currentTimeMillis() - this.startTime; long seconds = elapsedTime / 1000L; - + long minutes = seconds / 60L; seconds = seconds % 60; - + this.ticksUntilShoot = 8; if (config.extraTimers()) - this.client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "Wave 'Xarpus - Recovery' completed! Duration: " + minutes + ":" + twoDigitString(seconds), null); + { + this.client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "Wave 'Xarpus - Recovery' completed! Duration: " + minutes + ":" + twoDigitString(seconds), null); + } } final String ticksLeftStr = String.valueOf(ticksUntilShoot); @@ -257,7 +264,9 @@ public class XarpusHandler extends RoomHandler long minutes = seconds / 60L; seconds = seconds % 60; if (config.extraTimers()) - this.client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "Wave 'Xarpus - Acid' completed! Duration: " + minutes + ":" + twoDigitString(seconds), null); + { + this.client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "Wave 'Xarpus - Acid' completed! Duration: " + minutes + ":" + twoDigitString(seconds), null); + } } ticksUntilShoot = 6; @@ -275,7 +284,7 @@ public class XarpusHandler extends RoomHandler if (staring) { ticksUntilShoot = 8; - } + } else { ticksUntilShoot = 4; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/timers/RoomTimer.java b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/timers/RoomTimer.java index 9fb911a542..3a9c13252f 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/timers/RoomTimer.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/timers/RoomTimer.java @@ -1,18 +1,20 @@ package net.runelite.client.plugins.theatre.timers; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics2D; +import javax.inject.Inject; import net.runelite.api.Client; +import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG; import net.runelite.api.Player; import net.runelite.client.plugins.theatre.TheatrePlugin; import net.runelite.client.ui.overlay.Overlay; +import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE; import net.runelite.client.ui.overlay.OverlayMenuEntry; import net.runelite.client.ui.overlay.OverlayPosition; import net.runelite.client.ui.overlay.OverlayPriority; import net.runelite.client.ui.overlay.components.PanelComponent; import net.runelite.client.ui.overlay.components.TitleComponent; -import javax.inject.Inject; -import java.awt.*; -import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG; -import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE; public class RoomTimer extends Overlay { @@ -25,9 +27,9 @@ public class RoomTimer extends Overlay @Inject - public RoomTimer (Client client, TheatrePlugin plugin) + public RoomTimer(Client client, TheatrePlugin plugin) { - super (plugin); + super(plugin); setPosition(OverlayPosition.ABOVE_CHATBOX_RIGHT); setPriority(OverlayPriority.HIGH); @@ -40,15 +42,17 @@ public class RoomTimer extends Overlay @Override - public Dimension render(Graphics2D graphics) + public Dimension render(Graphics2D graphics) { panelComponent.getChildren().clear(); Player local = client.getLocalPlayer(); if (local == null || local.getName() == null) + { return null; + } - switch (plugin.getRoom()) + switch (plugin.getRoom()) { case MAIDEN: plugin.getMaidenHandler().render(graphics); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/timers/Timeable.java b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/timers/Timeable.java index e19452b435..04c5a1a6c5 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/timers/Timeable.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/timers/Timeable.java @@ -4,5 +4,5 @@ import java.util.HashMap; public interface Timeable { - public abstract HashMap getTimes(); + HashMap getTimes(); } \ No newline at end of file From 049ac9b22a7dfae79bbdb7a72d2c7e7e53532b19 Mon Sep 17 00:00:00 2001 From: GeChallengeM <52377234+GeChallengeM@users.noreply.github.com> Date: Mon, 1 Jul 2019 07:08:59 +0200 Subject: [PATCH 46/58] Add a new function to the WorldArea api. Add npcstatus plugin. (#833) * Add a new function to the WorldArea api. Add npcstatus plugin. * Ganom adds his mentioned changes (thanks!), and a fix for splash flinching is added. --- .../net/runelite/api/coords/WorldArea.java | 19 ++ .../plugins/npcstatus/MemorizedNPC.java | 84 +++++++ .../plugins/npcstatus/NpcStatusConfig.java | 43 ++++ .../plugins/npcstatus/NpcStatusOverlay.java | 89 +++++++ .../plugins/npcstatus/NpcStatusPlugin.java | 231 ++++++++++++++++++ 5 files changed, 466 insertions(+) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/npcstatus/MemorizedNPC.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/npcstatus/NpcStatusConfig.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/npcstatus/NpcStatusOverlay.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/npcstatus/NpcStatusPlugin.java diff --git a/runelite-api/src/main/java/net/runelite/api/coords/WorldArea.java b/runelite-api/src/main/java/net/runelite/api/coords/WorldArea.java index 105bf9fa89..7156045eb8 100644 --- a/runelite-api/src/main/java/net/runelite/api/coords/WorldArea.java +++ b/runelite-api/src/main/java/net/runelite/api/coords/WorldArea.java @@ -184,6 +184,25 @@ public class WorldArea return isInMeleeDistance(new WorldArea(other, 1, 1)); } + /** + * Checks whether this area is within melee distance of another without blocking in-between. + * + * @param client the client to test in + * @param other the other area + * @return true if in melee distance without blocking, false otherwise + */ + public boolean canMelee(Client client, WorldArea other) + { + if (isInMeleeDistance(other)) + { + Point p1 = this.getComparisonPoint(other); + Point p2 = other.getComparisonPoint(this); + WorldArea w1 = new WorldArea(p1.getX(), p1.getY() , 1, 1, this.getPlane()); + return (w1.canTravelInDirection(client, p2.getX() - p1.getX(), p2.getY() - p1.getY())); + } + return false; + } + /** * Checks whether this area intersects with another. * diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/npcstatus/MemorizedNPC.java b/runelite-client/src/main/java/net/runelite/client/plugins/npcstatus/MemorizedNPC.java new file mode 100644 index 0000000000..4a746e63db --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/npcstatus/MemorizedNPC.java @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2019, GeChallengeM + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.npcstatus; + +import java.awt.Color; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; +import net.runelite.api.NPC; +import net.runelite.api.coords.WorldArea; +import net.runelite.api.Actor; + +@Getter +class MemorizedNPC +{ + private NPC npc; + private int npcIndex; + private String npcName; + private int attackSpeed; + @Setter + private int combatTimerEnd; + @Setter + private int timeLeft; + @Setter + private int flinchTimerEnd; + @Setter + private Status status; + @Setter + private WorldArea lastnpcarea; + @Setter + private Actor lastinteracted; + @Setter + private int lastspotanimation; + + MemorizedNPC(NPC npc, int attackSpeed, WorldArea worldArea) + { + this.npc = npc; + this.npcIndex = npc.getIndex(); + this.npcName = npc.getName(); + this.attackSpeed = attackSpeed; + this.combatTimerEnd = -1; + this.flinchTimerEnd = -1; + this.timeLeft = 0; + this.status = Status.OUT_OF_COMBAT; + this.lastnpcarea = worldArea; + this.lastinteracted = null; + this.lastspotanimation = -1; + } + + @Getter + @AllArgsConstructor + enum Status + { + FLINCHING("Flinching", Color.GREEN), + IN_COMBAT_DELAY("In Combat Delay", Color.ORANGE), + IN_COMBAT("In Combat", Color.RED), + OUT_OF_COMBAT("Out of Combat", Color.BLUE); + + private String name; + private Color color; + } +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/npcstatus/NpcStatusConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/npcstatus/NpcStatusConfig.java new file mode 100644 index 0000000000..bf0495fae5 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/npcstatus/NpcStatusConfig.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2019, GeChallengeM + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.npcstatus; + +import net.runelite.client.config.Config; +import net.runelite.client.config.ConfigGroup; +import net.runelite.client.config.ConfigItem; + +@ConfigGroup("npcstatus") +public interface NpcStatusConfig extends Config +{ + @ConfigItem( + keyName = "AttackRange", + name = "NPC Attack range", + description = "The attack range of the NPC" + ) + default int getRange() + { + return 1; + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/npcstatus/NpcStatusOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/npcstatus/NpcStatusOverlay.java new file mode 100644 index 0000000000..7b948f24c0 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/npcstatus/NpcStatusOverlay.java @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2018, GeChallengeM + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.npcstatus; + +import java.awt.Dimension; +import java.awt.Graphics2D; +import javax.inject.Inject; +import net.runelite.api.Client; +import net.runelite.api.Point; +import net.runelite.client.ui.overlay.Overlay; +import net.runelite.client.ui.overlay.OverlayLayer; +import net.runelite.client.ui.overlay.OverlayPosition; +import net.runelite.client.ui.overlay.OverlayUtil; + +public class NpcStatusOverlay extends Overlay +{ + private final Client client; + private final NpcStatusPlugin plugin; + + @Inject + NpcStatusOverlay(Client client, NpcStatusPlugin plugin) + { + this.client = client; + this.plugin = plugin; + setPosition(OverlayPosition.DYNAMIC); + setLayer(OverlayLayer.ABOVE_SCENE); + } + + @Override + public Dimension render(Graphics2D graphics) + { + for (MemorizedNPC npc : plugin.getMemorizedNPCs()) + { + if (npc.getNpc().getInteracting() == null) + { + continue; + } + if (npc.getNpc().getInteracting() == client.getLocalPlayer() || client.getLocalPlayer().getInteracting() == npc.getNpc()) + { + switch (npc.getStatus()) + { + case FLINCHING: + npc.setTimeLeft(Math.max(0, npc.getFlinchTimerEnd() - client.getTickCount())); + break; + case IN_COMBAT_DELAY: + npc.setTimeLeft(Math.max(0, npc.getCombatTimerEnd() - client.getTickCount() - 7)); + break; + case IN_COMBAT: + npc.setTimeLeft(Math.max(0, npc.getCombatTimerEnd() - client.getTickCount())); + break; + case OUT_OF_COMBAT: + default: + npc.setTimeLeft(0); + break; + } + + Point textLocation = npc.getNpc().getCanvasTextLocation(graphics, Integer.toString(npc.getTimeLeft()), npc.getNpc().getLogicalHeight() + 40); + + if (textLocation != null) + { + OverlayUtil.renderTextLocation(graphics, textLocation, Integer.toString(npc.getTimeLeft()), npc.getStatus().getColor()); + } + } + } + return null; + } +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/npcstatus/NpcStatusPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/npcstatus/NpcStatusPlugin.java new file mode 100644 index 0000000000..0f1a59a17a --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/npcstatus/NpcStatusPlugin.java @@ -0,0 +1,231 @@ +/* + * Copyright (c) 2019, GeChallengeM + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.npcstatus; + +import com.google.inject.Provides; +import java.time.Instant; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; +import javax.inject.Inject; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.extern.slf4j.Slf4j; +import net.runelite.api.Client; +import net.runelite.api.GameState; +import net.runelite.api.GraphicID; +import net.runelite.api.Hitsplat; +import net.runelite.api.NPC; +import net.runelite.api.coords.WorldArea; +import net.runelite.api.events.GameStateChanged; +import net.runelite.api.events.GameTick; +import net.runelite.api.events.HitsplatApplied; +import net.runelite.api.events.NpcDespawned; +import net.runelite.api.events.NpcSpawned; +import net.runelite.client.config.ConfigManager; +import net.runelite.client.eventbus.Subscribe; +import net.runelite.client.game.ItemManager; +import net.runelite.client.game.NPCManager; +import net.runelite.client.plugins.Plugin; +import net.runelite.client.plugins.PluginDescriptor; +import net.runelite.client.ui.overlay.OverlayManager; + +@Slf4j +@PluginDescriptor( + name = "NPC Status Timer", + description = "Adds a timer on NPC's for their attacks and flinching.", + tags = {"flinch", "npc"}, + enabledByDefault = false +) +public class NpcStatusPlugin extends Plugin +{ + @Getter(AccessLevel.PACKAGE) + private final Set memorizedNPCs = new HashSet<>(); + @Inject + private Client client; + @Inject + private OverlayManager overlayManager; + @Inject + private ItemManager itemManager; + @Inject + private NPCManager npcManager; + @Inject + private NpcStatusConfig config; + @Inject + private NpcStatusOverlay npcStatusOverlay; + @Getter(AccessLevel.PACKAGE) + private Instant lastTickUpdate; + private WorldArea lastPlayerLocation; + + @Provides + NpcStatusConfig provideConfig(ConfigManager configManager) + { + return configManager.getConfig(NpcStatusConfig.class); + } + + @Override + protected void startUp() throws Exception + { + overlayManager.add(npcStatusOverlay); + } + + @Override + protected void shutDown() throws Exception + { + overlayManager.remove(npcStatusOverlay); + memorizedNPCs.clear(); + } + + @Subscribe + public void onNpcSpawned(NpcSpawned npcSpawned) + { + final NPC npc = npcSpawned.getNpc(); + final String npcName = npc.getName(); + + if (npcName == null || !Arrays.asList(npc.getDefinition().getActions()).contains("Attack")) + { + return; + } + memorizedNPCs.add(new MemorizedNPC(npc, npcManager.getAttackSpeed(npc.getId()), npc.getWorldArea())); + } + + @Subscribe + public void onNpcDespawned(NpcDespawned npcDespawned) + { + final NPC npc = npcDespawned.getNpc(); + memorizedNPCs.removeIf(c -> c.getNpc() == npc); + } + + @Subscribe + public void onGameStateChanged(GameStateChanged event) + { + if (event.getGameState() == GameState.LOGIN_SCREEN || + event.getGameState() == GameState.HOPPING) + { + memorizedNPCs.clear(); + } + } + + @Subscribe + public void onHitsplatApplied(HitsplatApplied event) + { + if (event.getActor().getInteracting() != client.getLocalPlayer()) + { + return; + } + final Hitsplat hitsplat = event.getHitsplat(); + if (hitsplat.getHitsplatType() == Hitsplat.HitsplatType.DAMAGE || hitsplat.getHitsplatType() == Hitsplat.HitsplatType.BLOCK) + { + if (event.getActor() instanceof NPC) + { + for (MemorizedNPC mn : memorizedNPCs) + { + if (mn.getStatus() == MemorizedNPC.Status.OUT_OF_COMBAT || (mn.getStatus() == MemorizedNPC.Status.IN_COMBAT && mn.getCombatTimerEnd() - client.getTickCount() < 1) || mn.getLastinteracted() == null) + { + mn.setStatus(MemorizedNPC.Status.FLINCHING); + mn.setCombatTimerEnd(-1); + mn.setFlinchTimerEnd(client.getTickCount() + mn.getAttackSpeed() / 2 + 1); + } + } + } + } + } + + private void checkStatus() + { + for (MemorizedNPC npc : memorizedNPCs) + { + final int ATTACK_SPEED = npc.getAttackSpeed(); + final double CombatTime = npc.getCombatTimerEnd() - client.getTickCount(); + final double FlinchTime = npc.getFlinchTimerEnd() - client.getTickCount(); + if (npc.getNpc().getWorldArea() == null) + { + continue; + } + if (npc.getNpc().getInteracting() == client.getLocalPlayer()) + { + if (npc.getLastspotanimation() == GraphicID.SPLASH && npc.getNpc().getSpotAnimation() == GraphicID.SPLASH) //For splash flinching + { + npc.setLastspotanimation(-1); + if ((npc.getStatus() == MemorizedNPC.Status.OUT_OF_COMBAT ) || npc.getLastinteracted() == null) + { + npc.setStatus(MemorizedNPC.Status.FLINCHING); + npc.setCombatTimerEnd(-1); + npc.setFlinchTimerEnd(client.getTickCount() + ATTACK_SPEED / 2 + 1); + npc.setLastnpcarea(npc.getNpc().getWorldArea()); + npc.setLastinteracted(npc.getNpc().getInteracting()); + continue; + } + } + //Checks: will the NPC attack this tick? + if (((npc.getNpc().getWorldArea().canMelee(client, lastPlayerLocation) && config.getRange() == 1) //Separate mechanics for meleerange-only NPC's because they have extra collisiondata checks (fences etc.) and can't attack diagonally + || (lastPlayerLocation.hasLineOfSightTo(client, npc.getNpc().getWorldArea()) && npc.getNpc().getWorldArea().distanceTo(lastPlayerLocation) <= config.getRange() && config.getRange() > 1)) + && ((npc.getStatus() != MemorizedNPC.Status.FLINCHING && CombatTime < 9) || (npc.getStatus() == MemorizedNPC.Status.FLINCHING && FlinchTime < 2)) + && npc.getNpc().getAnimation() != -1 //Failsafe, attacking NPC's always have an animation. + && !(npc.getLastnpcarea().distanceTo(lastPlayerLocation) == 0 && npc.getLastnpcarea() != npc.getNpc().getWorldArea())) //Weird mechanic: NPC's can't attack on the tick they do a random move + { + npc.setCombatTimerEnd(client.getTickCount() + ATTACK_SPEED + 8); + npc.setStatus(MemorizedNPC.Status.IN_COMBAT_DELAY); + npc.setLastnpcarea(npc.getNpc().getWorldArea()); + npc.setLastspotanimation(npc.getNpc().getSpotAnimation()); + npc.setLastinteracted(npc.getNpc().getInteracting()); + continue; + } + } + switch (npc.getStatus()) + { + case IN_COMBAT: + if (CombatTime < 2) + { + npc.setStatus(MemorizedNPC.Status.OUT_OF_COMBAT); + } + break; + case IN_COMBAT_DELAY: + if (CombatTime < 9) + { + npc.setStatus(MemorizedNPC.Status.IN_COMBAT); + } + break; + case FLINCHING: + if (FlinchTime < 2) + { + npc.setStatus(MemorizedNPC.Status.IN_COMBAT); + npc.setCombatTimerEnd(client.getTickCount() + 8); + } + } + npc.setLastnpcarea(npc.getNpc().getWorldArea()); + npc.setLastspotanimation(npc.getNpc().getSpotAnimation()); + npc.setLastinteracted(npc.getNpc().getInteracting()); + } + } + + @Subscribe + public void onGameTick(GameTick event) + { + lastTickUpdate = Instant.now(); + checkStatus(); + lastPlayerLocation = client.getLocalPlayer().getWorldArea(); + } +} From 659b13e36af786f28c53ad77c382134c3452526e Mon Sep 17 00:00:00 2001 From: Ganom Date: Mon, 1 Jul 2019 02:12:50 -0400 Subject: [PATCH 47/58] Revert "fixes some bugs with menu entry swapper (#831)" (#840) This reverts commit 8cf1262414b2ed70de80b22011bcc49321432f47. --- .../MenuEntrySwapperConfig.java | 30 +- .../MenuEntrySwapperPlugin.java | 504 +++++++++--------- 2 files changed, 256 insertions(+), 278 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java index 989bce98a6..e6497432aa 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java @@ -328,7 +328,7 @@ public interface MenuEntrySwapperConfig extends Config { return true; } - + @ConfigItem( keyName = "swapQuestCape", name = "Swap Quest Cape", @@ -651,20 +651,20 @@ public interface MenuEntrySwapperConfig extends Config description = "Don't open implings if bank has a clue.", position = 23, group = "Miscellaneous" - ) - default boolean swapImps() +) +default boolean swapImps() { return false; } - @ConfigItem( +@ConfigItem( keyName = "charterOption", name = "Trader Crew", description = "Configure whether you want Charter or Trade to be the first option of Trader Crewmembers.", position = 24, group = "Miscellaneous" - ) - default CharterOption charterOption() +) +default CharterOption charterOption() { return CharterOption.TRADE; } @@ -1671,25 +1671,23 @@ public interface MenuEntrySwapperConfig extends Config keyName = "removeFreezePlayerToB", name = "Remove freeze in ToB", description = "Removes the freeze option for ice barrage, ice blitz, entangle etc. in ToB", - position = 0, - group = "PVM" + position = 0 ) default boolean getRemoveFreezePlayerToB() - { - return true; - } + { + return true; + } @ConfigItem( keyName = "removeFreezePlayerCoX", name = "Remove freeze in CoX", description = "Removes the freeze option for ice barrage, ice blitz, entangle etc. in CoX", - position = 1, - group = "PVM" + position = 1 ) default boolean getRemoveFreezePlayerCoX() - { - return true; - } + { + return true; + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java index 661ad95d18..f7f04ddef9 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java @@ -98,29 +98,45 @@ import org.apache.commons.lang3.ArrayUtils; public class MenuEntrySwapperPlugin extends Plugin { - public static final HashSet CAST_OPTIONS_KEYWORDS = new HashSet<>(); private static final String CONFIGURE = "Configure"; private static final String SAVE = "Save"; private static final String RESET = "Reset"; private static final String MENU_TARGET = "Shift-click"; + private List bankItemNames = new ArrayList<>(); private static final String CONFIG_GROUP = "shiftclick"; private static final String ITEM_KEY_PREFIX = "item_"; private static final int PURO_PURO_REGION_ID = 10307; private static final String WALK_HERE = "WALK HERE"; private static final String CANCEL = "CANCEL"; private static final String CAST_OPTIONS_ATTACK = "CAST"; + public static final HashSet CAST_OPTIONS_KEYWORDS = new HashSet<>(); + static + { + CAST_OPTIONS_KEYWORDS.add(CAST_OPTIONS_ATTACK); + } + + private MenuEntry[] entries; + private final Set leftClickConstructionItems = new HashSet<>(); + private boolean buildingMode; + private static final WidgetMenuOption FIXED_INVENTORY_TAB_CONFIGURE = new WidgetMenuOption(CONFIGURE, MENU_TARGET, WidgetInfo.FIXED_VIEWPORT_INVENTORY_TAB); + private static final WidgetMenuOption FIXED_INVENTORY_TAB_SAVE = new WidgetMenuOption(SAVE, MENU_TARGET, WidgetInfo.FIXED_VIEWPORT_INVENTORY_TAB); + private static final WidgetMenuOption RESIZABLE_INVENTORY_TAB_CONFIGURE = new WidgetMenuOption(CONFIGURE, MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_INVENTORY_TAB); + private static final WidgetMenuOption RESIZABLE_INVENTORY_TAB_SAVE = new WidgetMenuOption(SAVE, MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_INVENTORY_TAB); + private static final WidgetMenuOption RESIZABLE_BOTTOM_LINE_INVENTORY_TAB_CONFIGURE = new WidgetMenuOption(CONFIGURE, MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_INVENTORY_TAB); + private static final WidgetMenuOption RESIZABLE_BOTTOM_LINE_INVENTORY_TAB_SAVE = new WidgetMenuOption(SAVE, MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_INVENTORY_TAB); + private static final Set NPC_MENU_TYPES = ImmutableSet.of( MenuAction.NPC_FIRST_OPTION, MenuAction.NPC_SECOND_OPTION, @@ -128,21 +144,14 @@ public class MenuEntrySwapperPlugin extends Plugin MenuAction.NPC_FOURTH_OPTION, MenuAction.NPC_FIFTH_OPTION, MenuAction.EXAMINE_NPC); + private static final Splitter NEWLINE_SPLITTER = Splitter .on("\n") .omitEmptyStrings() .trimResults(); - static - { - CAST_OPTIONS_KEYWORDS.add(CAST_OPTIONS_ATTACK); - } - - private final Set leftClickConstructionItems = new HashSet<>(); private final Map customSwaps = new HashMap<>(); - private List bankItemNames = new ArrayList<>(); - private MenuEntry[] entries; - private boolean buildingMode; + @Inject private Client client; @@ -372,19 +381,19 @@ public class MenuEntrySwapperPlugin extends Plugin { continue; } - else if (config.hideDestroyCoalbag() && entry.getTarget().contains("Coal bag")) + if (config.hideDestroyCoalbag() && entry.getTarget().contains("Coal bag")) { continue; } - else if (config.hideDestroyHerbsack() && entry.getTarget().contains("Herb sack")) + if (config.hideDestroyHerbsack() && entry.getTarget().contains("Herb sack")) { continue; } - else if (config.hideDestroyBoltpouch() && entry.getTarget().contains("Bolt pouch")) + if (config.hideDestroyBoltpouch() && entry.getTarget().contains("Bolt pouch")) { continue; } - else if (config.hideDestroyGembag() && entry.getTarget().contains("Gem bag")) + if (config.hideDestroyGembag() && entry.getTarget().contains("Gem bag")) { continue; } @@ -393,10 +402,10 @@ public class MenuEntrySwapperPlugin extends Plugin if (option.contains("drop")) { if (config.hideDropRunecraftingPouch() && ( - entry.getTarget().contains("Small pouch") - || entry.getTarget().contains("Medium pouch") - || entry.getTarget().contains("Large pouch") - || entry.getTarget().contains("Giant pouch"))) + entry.getTarget().contains("Small pouch") + || entry.getTarget().contains("Medium pouch") + || entry.getTarget().contains("Large pouch") + || entry.getTarget().contains("Giant pouch"))) { continue; } @@ -476,7 +485,7 @@ public class MenuEntrySwapperPlugin extends Plugin return; } - int itemId = event.getType(); + int itemId = event.getIdentifier(); if (itemId == -1) { @@ -534,7 +543,7 @@ public class MenuEntrySwapperPlugin extends Plugin } final String pOptionToReplace = Text.removeTags(event.getOption()).toUpperCase(); - final int eventId = event.getType(); + final int eventId = event.getIdentifier(); final String option = Text.standardize(event.getOption()); final String target = Text.standardize(event.getTarget()); final NPC hintArrowNpc = client.getHintArrowNpc(); @@ -554,7 +563,7 @@ public class MenuEntrySwapperPlugin extends Plugin } } - else if (config.getWithdrawFive()) + if (config.getWithdrawFive()) { for (String item : Text.fromCSV(config.getWithdrawFiveItems())) { @@ -566,7 +575,7 @@ public class MenuEntrySwapperPlugin extends Plugin } } - else if (config.getWithdrawTen()) + if (config.getWithdrawTen()) { for (String item : Text.fromCSV(config.getWithdrawTenItems())) { @@ -578,7 +587,7 @@ public class MenuEntrySwapperPlugin extends Plugin } } - else if (config.getWithdrawX()) + if (config.getWithdrawX()) { for (String item : Text.fromCSV(config.getWithdrawXItems())) { @@ -590,7 +599,7 @@ public class MenuEntrySwapperPlugin extends Plugin } } - else if (config.getWithdrawAll()) + if (config.getWithdrawAll()) { for (String item : Text.fromCSV(config.getWithdrawAllItems())) { @@ -619,7 +628,7 @@ public class MenuEntrySwapperPlugin extends Plugin } } - else if (config.getSwapBuyFive() && !config.getBuyFiveItems().equals("")) + if (config.getSwapBuyFive() && !config.getBuyFiveItems().equals("")) { for (String item : Text.fromCSV(config.getBuyFiveItems())) { @@ -630,7 +639,7 @@ public class MenuEntrySwapperPlugin extends Plugin } } - else if (config.getSwapBuyTen() && !config.getBuyTenItems().equals("")) + if (config.getSwapBuyTen() && !config.getBuyTenItems().equals("")) { for (String item : Text.fromCSV(config.getBuyTenItems())) { @@ -641,7 +650,7 @@ public class MenuEntrySwapperPlugin extends Plugin } } - else if (config.getSwapBuyFifty() && !config.getBuyFiftyItems().equals("")) + if (config.getSwapBuyFifty() && !config.getBuyFiftyItems().equals("")) { for (String item : Text.fromCSV(config.getBuyFiftyItems())) { @@ -652,7 +661,7 @@ public class MenuEntrySwapperPlugin extends Plugin } } } - if ((option.contains("sell") || option.contains("value")) && Arrays.stream(entries).anyMatch(menuEntry -> + else if ((option.contains("sell") || option.contains("value")) && Arrays.stream(entries).anyMatch(menuEntry -> { return menuEntry.getOption().toLowerCase().contains("sell"); })) @@ -668,7 +677,7 @@ public class MenuEntrySwapperPlugin extends Plugin } } - else if (config.getSwapSellFive() && !Strings.isNullOrEmpty(config.getSellFiveItems())) + if (config.getSwapSellFive() && !Strings.isNullOrEmpty(config.getSellFiveItems())) { for (String item : Text.fromCSV(config.getSellFiveItems())) { @@ -679,7 +688,7 @@ public class MenuEntrySwapperPlugin extends Plugin } } - else if (config.getSwapSellTen() && !Strings.isNullOrEmpty(config.getSellTenItems())) + if (config.getSwapSellTen() && !Strings.isNullOrEmpty(config.getSellTenItems())) { for (String item : Text.fromCSV(config.getSellTenItems())) { @@ -690,7 +699,7 @@ public class MenuEntrySwapperPlugin extends Plugin } } - else if (config.getSwapSellFifty() && !Strings.isNullOrEmpty(config.getSellFiftyItems())) + if (config.getSwapSellFifty() && !Strings.isNullOrEmpty(config.getSellFiftyItems())) { for (String item : Text.fromCSV(config.getSellFiftyItems())) { @@ -709,20 +718,20 @@ public class MenuEntrySwapperPlugin extends Plugin removed = Text.standardize(removed); if (target.contains("(") && target.split(" \\(")[0].equals(removed)) { - delete(event.getType()); + delete(event.getIdentifier()); } else if (target.contains("->")) { String trimmed = target.split("->")[1].trim(); if (trimmed.length() >= removed.length() && trimmed.substring(0, removed.length()).equalsIgnoreCase(removed)) { - delete(event.getType()); + delete(event.getIdentifier()); break; } } else if (target.length() >= removed.length() && target.substring(0, removed.length()).equalsIgnoreCase(removed)) { - delete(event.getType()); + delete(event.getIdentifier()); break; } } @@ -747,7 +756,7 @@ public class MenuEntrySwapperPlugin extends Plugin } } - if (config.getSwapSmithing() && option.contains("smith")) + else if (config.getSwapSmithing() && option.contains("smith")) { if (option.equalsIgnoreCase("Smith 1")) { @@ -759,48 +768,48 @@ public class MenuEntrySwapperPlugin extends Plugin } } - if (config.getSwapTanning() && option.equalsIgnoreCase("Tan 1")) + else if (config.getSwapTanning() && option.equalsIgnoreCase("Tan 1")) { swap(client, "Tan All", option, target); } - if (config.getSwapSawmill() && target.equalsIgnoreCase("Sawmill operator")) + else if (config.getSwapSawmill() && target.equalsIgnoreCase("Sawmill operator")) { swap(client, "Buy-plank", option, target); } - if (config.getSwapSawmillPlanks() && option.equalsIgnoreCase("Buy 1")) + else if (config.getSwapSawmillPlanks() && option.equalsIgnoreCase("Buy 1")) { swap(client, "Buy All", option, target); } - if (option.equalsIgnoreCase("Clear-All") && target.equalsIgnoreCase("Bank Filler")) + else if (option.equalsIgnoreCase("Clear-All") && target.equalsIgnoreCase("Bank Filler")) { swap(client, "Clear", option, target); } - if (config.getSwapArdougneCape() && target.contains("ardougne cloak")) + else if (target.contains("ardougne cloak") && config.getSwapArdougneCape()) { swap(client, "Kandarin Monastery", option, target); swap(client, "Monastery Teleport", option, target); } - if (config.getSwapCraftingCape() && target.contains("crafting cape")) + else if (target.contains("crafting cape") && config.getSwapCraftingCape()) { swap(client, "Teleport", option, target); } - if (config.getSwapConstructionCape() && target.contains("construct. cape")) + else if (target.contains("construct. cape") && config.getSwapConstructionCape()) { swap(client, "Tele to poh", option, target); } - if (config.getSwapMagicCape() && target.contains("magic cape")) + else if (target.contains("magic cape") && config.getSwapMagicCape()) { swap(client, "Spellbook", option, target); } - if (config.getSwapExplorersRing() && target.contains("explorer's ring")) + else if (target.contains("explorer's ring") && config.getSwapExplorersRing()) { swap(client, "Teleport", option, target); } @@ -824,79 +833,77 @@ public class MenuEntrySwapperPlugin extends Plugin } } List invItemNames = new ArrayList<>(); - - switch (target) + if (target.equals("gourmet impling jar")) { - case "gourmet impling jar": - if (client.getItemContainer(InventoryID.INVENTORY) != null) + if (client.getItemContainer(InventoryID.INVENTORY) != null) + { + for (Item i : Objects.requireNonNull(client.getItemContainer(InventoryID.INVENTORY)).getItems()) { - for (Item i : Objects.requireNonNull(client.getItemContainer(InventoryID.INVENTORY)).getItems()) - { - invItemNames.add(client.getItemDefinition((i.getId())).getName()); - } - if ((invItemNames.contains("Clue scroll (easy)") || bankItemNames.contains("Clue scroll (easy)"))) - { - menuManager.addSwap("loot", target, "use"); - } - else - { - menuManager.removeSwaps(target); - } + invItemNames.add(client.getItemDefinition((i.getId())).getName()); } - break; - case "eclectic impling jar": - if (client.getItemContainer(InventoryID.INVENTORY) != null) + if ((invItemNames.contains("Clue scroll (easy)") || bankItemNames.contains("Clue scroll (easy)"))) { - for (Item i : Objects.requireNonNull(client.getItemContainer(InventoryID.INVENTORY)).getItems()) - { - invItemNames.add(client.getItemDefinition((i.getId())).getName()); - } - if ((invItemNames.contains("Clue scroll (medium)") || bankItemNames.contains("Clue scroll (medium)"))) - { - menuManager.addSwap("loot", target, "use"); - } - else - { - menuManager.removeSwaps(target); - } + menuManager.addSwap("loot", target, "use"); } - break; - case "magpie impling jar": - case "nature impling jar": - case "ninja impling jar": - if (client.getItemContainer(InventoryID.INVENTORY) != null) + else { - for (Item i : Objects.requireNonNull(client.getItemContainer(InventoryID.INVENTORY)).getItems()) - { - invItemNames.add(client.getItemDefinition((i.getId())).getName()); - } - if ((invItemNames.contains("Clue scroll (hard)") || bankItemNames.contains("Clue scroll (hard)"))) - { - menuManager.addSwap("loot", target, "use"); - } - else - { - menuManager.removeSwaps(target); - } + menuManager.removeSwaps(target); } - break; - case "dragon impling jar": - if (client.getItemContainer(InventoryID.INVENTORY) != null) + } + } + if (target.equals("eclectic impling jar")) + { + if (client.getItemContainer(InventoryID.INVENTORY) != null) + { + for (Item i : Objects.requireNonNull(client.getItemContainer(InventoryID.INVENTORY)).getItems()) { - for (Item i : Objects.requireNonNull(client.getItemContainer(InventoryID.INVENTORY)).getItems()) - { - invItemNames.add(client.getItemDefinition((i.getId())).getName()); - } - if ((invItemNames.contains("Clue scroll (elite)") || bankItemNames.contains("Clue scroll (elite)"))) - { - menuManager.addSwap("loot", target, "use"); - } - else - { - menuManager.removeSwaps(target); - } + invItemNames.add(client.getItemDefinition((i.getId())).getName()); } - break; + if ((invItemNames.contains("Clue scroll (medium)") || bankItemNames.contains("Clue scroll (medium)"))) + { + menuManager.addSwap("loot", target, "use"); + } + else + { + menuManager.removeSwaps(target); + } + } + } + else if (target.equals("magpie impling jar") || (target.equals("nature impling jar")) || (target.equals("ninja impling jar"))) + { + if (client.getItemContainer(InventoryID.INVENTORY) != null) + { + for (Item i : Objects.requireNonNull(client.getItemContainer(InventoryID.INVENTORY)).getItems()) + { + invItemNames.add(client.getItemDefinition((i.getId())).getName()); + } + if ((invItemNames.contains("Clue scroll (hard)") || bankItemNames.contains("Clue scroll (hard)"))) + { + menuManager.addSwap("loot", target, "use"); + } + else + { + menuManager.removeSwaps(target); + } + } + } + else if (target.equals("dragon impling jar")) + { + if (client.getItemContainer(InventoryID.INVENTORY) != null) + { + for (Item i : Objects.requireNonNull(client.getItemContainer(InventoryID.INVENTORY)).getItems()) + { + invItemNames.add(client.getItemDefinition((i.getId())).getName()); + } + if ((invItemNames.contains("Clue scroll (elite)") || bankItemNames.contains("Clue scroll (elite)"))) + { + menuManager.addSwap("loot", target, "use"); + } + else + { + menuManager.removeSwaps(target); + } + } } } @@ -904,16 +911,16 @@ public class MenuEntrySwapperPlugin extends Plugin if (!pOptionToReplace.equals(CANCEL) && !pOptionToReplace.equals(WALK_HERE)) { Player[] players = client.getCachedPlayers(); - int identifier = event.getType(); + int identifier = event.getIdentifier(); if (identifier >= 0 && identifier < players.length) { Player player = players[identifier]; if (player != null) { - if (((config.getRemoveFreezePlayerCoX() && client.getVar(Varbits.IN_RAID) == 1) - || (config.getRemoveFreezePlayerToB() && client.getVar(Varbits.THEATRE_OF_BLOOD) == 2)) - && (player.isFriend() || player.isClanMember()) + if (((config.getRemoveFreezePlayerCoX() && client.getVar(Varbits.IN_RAID) == 1) + || (config.getRemoveFreezePlayerToB() && client.getVar(Varbits.THEATRE_OF_BLOOD) == 2)) + && (player.isFriend() || player.isClanMember()) && CAST_OPTIONS_KEYWORDS.contains(pOptionToReplace)) { addswap(pOptionToReplace); @@ -929,29 +936,22 @@ public class MenuEntrySwapperPlugin extends Plugin swap(client, "pickpocket", option, target, true); } - else if (config.swapHardWoodGrove()) + if (config.swapHardWoodGrove() && target.contains("rionasta")) { - if (target.contains("rionasta")) - { - swap(client, "send-parcel", option, target, true); - } - else if (option.equals("open") && target.equals("hardwood grove doors")) - { - swap(client, "quick-pay(100)", option, target, true); - } + swap(client, "send-parcel", option, target, true); } - else if (config.swapBankExchange()) + if (config.swapBankExchange()) { swap(client, "bank", option, target, true); swap(client, "exchange", option, target, true); } - else if (config.swapContract()) + if (config.swapContract()) { swap(client, "contract", option, target, true); } - else if (config.swapInteract()) + if (config.swapInteract()) { swap(client, "repairs", option, target, true); swap(client, "claim-slime", option, target, true); @@ -962,24 +962,24 @@ public class MenuEntrySwapperPlugin extends Plugin } // make sure assignment swap is higher priority than trade swap for slayer masters - else if (config.swapAssignment()) + if (config.swapAssignment()) { swap(client, "assignment", option, target, true); } - else if (config.swapPlank()) + if (config.swapPlank()) { swap(client, "buy-plank", option, target, true); } - else if (config.swapTrade() && (!(target.equals("trader crewmember") || target.equals("trader stan")) || config.charterOption().equals(CharterOption.TRADE))) + if (config.swapTrade() && (!(target.equals("trader crewmember") || target.equals("trader stan")) || config.charterOption().equals(CharterOption.TRADE))) { swap(client, "trade", option, target, true); swap(client, "trade-with", option, target, true); swap(client, "shop", option, target, true); } - else if (config.swapMinigame()) + if (config.swapMinigame()) { swap(client, "story", option, target, true); swap(client, "escort", option, target, true); @@ -987,46 +987,7 @@ public class MenuEntrySwapperPlugin extends Plugin swap(client, "start-minigame", option, target, true); } - else if (config.swapAbyssTeleport() && target.contains("mage of zamorak")) - { - swap(client, "teleport", option, target, true); - } - - else if (config.swapPay()) - { - swap(client, "pay", option, target, true); - swap(client, "pay (", option, target, false); - } - - else if (config.swapQuick()) - { - swap(client, "quick-travel", option, target, true); - } - - else if (config.swapEnchant()) - { - swap(client, "enchant", option, target, true); - } - - } - - if (config.swapWildernessLever() && target.equals("lever") && option.equals("ardougne")) - { - swap(client, "edgeville", option, target, true); - } - - if (config.swapMetamorphosis() && target.contains("baby chinchompa")) - { - swap(client, "metamorphosis", option, target, true); - } - - if (config.swapStun() && target.contains("hoop snake")) - { - swap(client, "stun", option, target, true); - } - - if (config.swapTravel()) - { + if (config.swapTravel()) { swap(client, "travel", option, target, true); swap(client, "pay-fare", option, target, true); @@ -1038,43 +999,71 @@ public class MenuEntrySwapperPlugin extends Plugin swap(client, "rellekka", option, target, true); swap(client, "follow", option, target, true); swap(client, "transport", option, target, true); + + if (config.swapAbyssTeleport() && target.contains("mage of zamorak")) + { + swap(client, "teleport", option, target, true); + } + + if (!(target.equals("trader crewmember") || target.equals("trader stan")) || config.charterOption().equals(CharterOption.CHARTER)) + { + swap(client, "charter", option, target, true); + } } - if (!(target.equals("trader crewmember") || target.equals("trader stan")) || config.charterOption().equals(CharterOption.CHARTER)) + if (config.swapPay()) { - swap(client, "charter", option, target, true); + swap(client, "pay", option, target, true); + swap(client, "pay (", option, target, false); } - else if ((option.equals("pass") && target.equals("energy barrier"))) + if (config.swapQuick()) { - swap(client, "pay-toll(2-ecto)", option, target, true); + swap(client, "quick-travel", option, target, true); } - else if (option.equals("open") && target.equals("gate")) + if (config.swapEnchant()) { - swap(client, "pay-toll(10gp)", option, target, true); + swap(client, "enchant", option, target, true); } - else if (option.equals("inspect") && target.equals("trapdoor")) - { - swap(client, "travel", option, target, true); - } } - if (config.swapHarpoon()) + else if (config.swapWildernessLever() && target.equals("lever") && option.equals("ardougne")) { - - if (option.equals("cage")) - { - swap(client, "harpoon", option, target, true); - } - else if (option.equals("big net") || option.equals("net")) - { - swap(client, "harpoon", option, target, true); - } + swap(client, "edgeville", option, target, true); } - if (config.swapOccultMode() != OccultAltarMode.VENERATE && option.equals("venerate")) + else if (config.swapMetamorphosis() && target.contains("baby chinchompa")) + { + swap(client, "metamorphosis", option, target, true); + } + + else if (config.swapStun() && target.contains("hoop snake")) + { + swap(client, "stun", option, target, true); + } + + else if (config.swapTravel() && (option.equals("pass") || option.equals("open"))) + { + swap(client, "pay-toll", option, target, false); + } + else if (config.swapTravel() && option.equals("inspect") && target.equals("trapdoor")) + { + swap(client, "travel", option, target, true); + } + + else if (config.swapHarpoon() && option.equals("cage")) + { + swap(client, "harpoon", option, target, true); + } + + else if (config.swapHarpoon() && (option.equals("big net") || option.equals("net"))) + { + swap(client, "harpoon", option, target, true); + } + + else if (config.swapOccultMode() != OccultAltarMode.VENERATE && option.equals("venerate")) { switch (config.swapOccultMode()) { @@ -1093,7 +1082,7 @@ public class MenuEntrySwapperPlugin extends Plugin } - if (config.swapObeliskMode() != ObeliskMode.ACTIVATE && option.equals("activate")) + else if (config.swapObeliskMode() != ObeliskMode.ACTIVATE && option.equals("activate")) { switch (config.swapObeliskMode()) { @@ -1109,7 +1098,7 @@ public class MenuEntrySwapperPlugin extends Plugin } } - if (config.swapHomePortalMode() != HouseMode.ENTER && option.equals("enter")) + else if (config.swapHomePortalMode() != HouseMode.ENTER && option.equals("enter")) { switch (config.swapHomePortalMode()) { @@ -1124,8 +1113,7 @@ public class MenuEntrySwapperPlugin extends Plugin break; } } - - if (config.swapFairyRingMode() != FairyRingMode.OFF && config.swapFairyRingMode() != FairyRingMode.ZANARIS + else if (config.swapFairyRingMode() != FairyRingMode.OFF && config.swapFairyRingMode() != FairyRingMode.ZANARIS && (option.equals("zanaris") || option.equals("configure") || option.equals("tree"))) { if (config.swapFairyRingMode() == FairyRingMode.LAST_DESTINATION) @@ -1138,95 +1126,89 @@ public class MenuEntrySwapperPlugin extends Plugin } } - if (config.swapFairyRingMode() == FairyRingMode.ZANARIS && option.equals("tree")) + else if (config.swapFairyRingMode() == FairyRingMode.ZANARIS && option.equals("tree")) { swap(client, "zanaris", option, target, false); } - if (config.swapBoxTrap()) + else if (config.swapBoxTrap() && (option.equals("check") || option.equals("dismantle"))) { - if (option.equals("check") || option.equals("dismantle")) - { - swap(client, "reset", option, target, true); - } - - else if (option.equals("take")) - { - swap(client, "lay", option, target, true); - swap(client, "activate", option, target, true); - } + swap(client, "reset", option, target, true); } + else if (config.swapBoxTrap() && option.equals("take")) + { + swap(client, "lay", option, target, true); + swap(client, "activate", option, target, true); + } - if (config.swapChase() && option.equals("pick-up")) + else if (config.swapChase() && option.equals("pick-up")) { swap(client, "chase", option, target, true); } - if (config.swapBirdhouseEmpty() && option.equals("interact") && target.contains("birdhouse")) + else if (config.swapBirdhouseEmpty() && option.equals("interact") && target.contains("birdhouse")) { swap(client, "empty", option, target, true); } - if (config.swapQuick()) + else if (config.swapQuick() && option.equals("ring")) { - if (option.equals("ring")) - { - swap(client, "quick-start", option, target, true); - } - - else if (option.equals("pass")) - { - swap(client, "quick-pass", option, target, true); - } - - else if (option.equals("open")) - { - swap(client, "quick-open", option, target, true); - } - else if (option.equals("enter")) - { - swap(client, "quick-enter", option, target, true); - } - else if (option.equals("leave tomb")) - { - swap(client, "quick-leave", option, target, true); - } + swap(client, "quick-start", option, target, true); } - if (config.swapAdmire() && option.equals("admire")) + + else if (config.swapQuick() && option.equals("pass")) + { + swap(client, "quick-pass", option, target, true); + swap(client, "quick pass", option, target, true); + } + + else if (config.swapQuick() && option.equals("open")) + { + swap(client, "quick-open", option, target, true); + } + else if (config.swapQuick() && option.equals("enter")) + { + swap(client, "quick-enter", option, target, true); + } + else if (config.swapQuick() && option.equals("leave tomb")) + { + swap(client, "quick-leave", option, target, true); + } + else if (config.swapAdmire() && option.equals("admire")) { swap(client, "teleport", option, target, true); swap(client, "spellbook", option, target, true); swap(client, "perks", option, target, true); } - if (config.swapPrivate() && option.equals("shared")) + else if (config.swapPrivate() && option.equals("shared")) { swap(client, "private", option, target, true); } - if (config.swapPick() && option.equals("pick")) + else if (config.swapPick() && option.equals("pick")) { swap(client, "pick-lots", option, target, true); } - if (config.swapSearch() && (option.equals("close") || option.equals("shut"))) + else if (config.swapSearch() && (option.equals("close") || option.equals("shut"))) { swap(client, "search", option, target, true); } - if (config.swapRogueschests() && target.contains("chest")) + else if (config.swapRogueschests() && target.contains("chest")) { swap(client, "search for traps", option, target, true); } - if (config.rockCake() && option.equals("eat")) + else if (config.rockCake() && option.equals("eat")) { swap(client, "guzzle", option, target, true); } - if (config.shiftClickCustomization() && shiftModifier && !option.equals("use")) + else if (config.shiftClickCustomization() && shiftModifier && !option.equals("use")) { Integer customOption = getSwapConfig(eventId); @@ -1237,20 +1219,20 @@ public class MenuEntrySwapperPlugin extends Plugin } // Put all item-related swapping after shift-click - if (config.swapTeleportItem() && (option.equals("wear") || option.equals("wield"))) + else if (config.swapTeleportItem() && (option.equals("wear") || option.equals("wield"))) { swap(client, "rub", option, target, true); swap(client, "teleport", option, target, true); } - if (config.swapCoalBag() && option.contains("deposit") && target.equals("coal bag")) + else if (config.swapCoalBag() && option.contains("deposit") && target.equals("coal bag")) { swap(client, "empty", option, target, true); } - if (config.swapBones() && option.equals("bury")) + else if (config.swapBones() && option.equals("bury")) { swap(client, "use", option, target, true); } - if (config.swapNexus() && target.contains("portal nexus")) + else if (config.swapNexus() && target.contains("portal nexus")) { swap(client, "teleport menu", option, target, true); } @@ -1467,7 +1449,7 @@ public class MenuEntrySwapperPlugin extends Plugin menuManager.removeSwaps("ring of wealth"); menuManager.removeSwaps("max cape"); menuManager.removeSwaps("quest point cape"); - + } private void delete(int target) @@ -1566,11 +1548,10 @@ public class MenuEntrySwapperPlugin extends Plugin menuManager.removePriorityEntry("climb-down"); } - /** - * Swaps menu entries if the entries could be found. This places Walk Here where the top level menu option was. - * - * @param pOptionToReplace The String containing the Menu Option that needs to be replaced. IE: "Attack", "Chop Down". - */ +/** + * Swaps menu entries if the entries could be found. This places Walk Here where the top level menu option was. + * @param pOptionToReplace The String containing the Menu Option that needs to be replaced. IE: "Attack", "Chop Down". + */ private void addswap(String pOptionToReplace) { MenuEntry[] entries = client.getMenuEntries(); @@ -1578,36 +1559,35 @@ public class MenuEntrySwapperPlugin extends Plugin Integer entryToReplace = searchIndex(entries, pOptionToReplace); if (walkHereEntry != null - && entryToReplace != null) - { + && entryToReplace != null) + { MenuEntry walkHereMenuEntry = entries[walkHereEntry]; entries[walkHereEntry] = entries[entryToReplace]; entries[entryToReplace] = walkHereMenuEntry; client.setMenuEntries(entries); - } + } } - /** - * Finds the index of the menu that contains the verbiage we are looking for. - * - * @param pMenuEntries The list of {@link MenuEntry}s. - * @param pMenuEntryToSearchFor The Option in the menu to search for. - * @return The index location or null if it was not found. - */ +/** + * Finds the index of the menu that contains the verbiage we are looking for. + * @param pMenuEntries The list of {@link MenuEntry}s. + * @param pMenuEntryToSearchFor The Option in the menu to search for. + * @return The index location or null if it was not found. + */ private Integer searchIndex(MenuEntry[] pMenuEntries, String pMenuEntryToSearchFor) { Integer indexLocation = 0; for (MenuEntry menuEntry : pMenuEntries) - { + { String entryOption = Text.removeTags(menuEntry.getOption()).toUpperCase(); if (entryOption.equals(pMenuEntryToSearchFor)) - { + { return indexLocation; - } + } indexLocation++; - } + } return null; } -} \ No newline at end of file +} From 09bad58e35a3c6edb1aeea54a4236f084b859fd0 Mon Sep 17 00:00:00 2001 From: sdburns1998 Date: Mon, 1 Jul 2019 08:11:01 +0200 Subject: [PATCH 48/58] Use NpcCompositionChanged in SlayerPlugin Hopefully fixes highlighting at Kraken, Cerb, other NPCs that change composition --- .../client/plugins/slayer/SlayerPlugin.java | 45 +++++++------------ .../plugins/slayer/TargetClickboxOverlay.java | 4 +- .../plugins/slayer/TargetMinimapOverlay.java | 10 ++--- 3 files changed, 21 insertions(+), 38 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerPlugin.java index 79dca36797..d54b21f7dd 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerPlugin.java @@ -36,6 +36,7 @@ import java.time.Instant; import java.time.temporal.ChronoUnit; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; @@ -66,6 +67,7 @@ import net.runelite.api.events.ExperienceChanged; import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameTick; import net.runelite.api.events.InteractingChanged; +import net.runelite.api.events.NpcCompositionChanged; import net.runelite.api.events.NpcDespawned; import net.runelite.api.events.NpcSpawned; import net.runelite.api.events.VarbitChanged; @@ -79,7 +81,6 @@ import net.runelite.client.chat.ChatCommandManager; import net.runelite.client.chat.ChatMessageBuilder; import net.runelite.client.chat.ChatMessageManager; import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe; import net.runelite.client.events.ChatInput; import net.runelite.client.game.AsyncBufferedImage; @@ -215,11 +216,8 @@ public class SlayerPlugin extends Plugin @Inject private ChatClient chatClient; - @Inject - private EventBus eventBus; - @Getter(AccessLevel.PACKAGE) - private List highlightedTargets = new ArrayList<>(); + private final Set highlightedTargets = new HashSet<>(); @Getter(AccessLevel.PACKAGE) @Setter(AccessLevel.PACKAGE) @@ -349,8 +347,17 @@ public class SlayerPlugin extends Plugin if (isTarget(npc, targetNames)) { highlightedTargets.add(npc); - NPCPresence newPresence = NPCPresence.buildPresence(npc); - // log.debug("New presence of " + newPresence.toString()); + } + } + + @Subscribe + public void onNpcCompositionChanged(NpcCompositionChanged event) + { + NPC npc = event.getNpc(); + + if (isTarget(npc, targetNames)) + { + highlightedTargets.add(npc); } } @@ -363,7 +370,6 @@ public class SlayerPlugin extends Plugin { NPCPresence lingeringPresence = NPCPresence.buildPresence(npc); lingeringPresences.add(lingeringPresence); - // log.debug("Presence of " + lingeringPresence.toString() + " now lingering"); } } @@ -583,8 +589,6 @@ public class SlayerPlugin extends Plugin streak = 1; break; case 1: - streak = Integer.parseInt(matches.get(0)); - break; case 3: streak = Integer.parseInt(matches.get(0)); break; @@ -665,29 +669,13 @@ public class SlayerPlugin extends Plugin // this is not the initial xp sent on login so these are new xp gains int gains = slayerExp - cachedXp; - //log.debug("Slayer xp drop received"); - - //StringBuilder debugString = new StringBuilder(); - // potential npcs to give xp drop are current highlighted npcs and the lingering presences - List potentialNPCs = new ArrayList<>(); - //debugString.append("Lingering presences {"); - for (NPCPresence presence : lingeringPresences) - { - potentialNPCs.add(presence); - // debugString.append(presence.toString()); - // debugString.append(", "); - } - //debugString.append("}\nCurrent presences {"); + List potentialNPCs = new ArrayList<>(lingeringPresences); for (NPC npc : highlightedTargets) { NPCPresence currentPresence = NPCPresence.buildPresence(npc); potentialNPCs.add(currentPresence); - // debugString.append(currentPresence.toString()); - // debugString.append(", "); } - //debugString.append("}"); - //log.debug(debugString.toString()); int killCount = estimateKillCount(potentialNPCs, gains); for (int i = 0; i < killCount; i++) @@ -906,8 +894,7 @@ public class SlayerPlugin extends Plugin if (task != null) { - task.getNpcIds().stream() - .forEach(targetIds::add); + targetIds.addAll(task.getNpcIds()); } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TargetClickboxOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TargetClickboxOverlay.java index c5bd4f1130..12eeac7ead 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TargetClickboxOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TargetClickboxOverlay.java @@ -30,7 +30,7 @@ import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.Polygon; -import java.util.List; +import java.util.Set; import javax.inject.Inject; import net.runelite.api.Client; import net.runelite.api.NPC; @@ -71,7 +71,7 @@ public class TargetClickboxOverlay extends Overlay { if (config.highlightTargets()) { - List targets = plugin.getHighlightedTargets(); + Set targets = plugin.getHighlightedTargets(); for (NPC target : targets) { if (target == null || target.getName() == null) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TargetMinimapOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TargetMinimapOverlay.java index 57615b2a10..ceb81e6cd2 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TargetMinimapOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TargetMinimapOverlay.java @@ -29,9 +29,8 @@ package net.runelite.client.plugins.slayer; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics2D; -import java.util.List; +import java.util.Set; import javax.inject.Inject; -import net.runelite.api.Client; import net.runelite.api.NPC; import net.runelite.api.Point; import net.runelite.client.ui.overlay.Overlay; @@ -41,15 +40,12 @@ import net.runelite.client.ui.overlay.OverlayUtil; public class TargetMinimapOverlay extends Overlay { - - private final Client client; private final SlayerConfig config; private final SlayerPlugin plugin; @Inject - TargetMinimapOverlay(Client client, SlayerConfig config, SlayerPlugin plugin) + TargetMinimapOverlay(SlayerConfig config, SlayerPlugin plugin) { - this.client = client; this.config = config; this.plugin = plugin; setPosition(OverlayPosition.DYNAMIC); @@ -64,7 +60,7 @@ public class TargetMinimapOverlay extends Overlay return null; } - List targets = plugin.getHighlightedTargets(); + Set targets = plugin.getHighlightedTargets(); for (NPC target : targets) { if (target == null || target.getName() == null) From d191db8a35753709fb1bef8c2f19975c34836d2c Mon Sep 17 00:00:00 2001 From: Owain van Brakel Date: Mon, 1 Jul 2019 16:00:10 +0200 Subject: [PATCH 49/58] Use NpcCompositionChanged in NpcIndicatorsPlugin (#839) --- .../client/graphics/ModelOutlineRenderer.java | 5 + .../plugins/npchighlight/MemorizedNpc.java | 7 +- .../npchighlight/NpcIndicatorsPlugin.java | 131 +++++++++++------- 3 files changed, 93 insertions(+), 50 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/graphics/ModelOutlineRenderer.java b/runelite-client/src/main/java/net/runelite/client/graphics/ModelOutlineRenderer.java index 203f16fdab..0093315bfa 100644 --- a/runelite-client/src/main/java/net/runelite/client/graphics/ModelOutlineRenderer.java +++ b/runelite-client/src/main/java/net/runelite/client/graphics/ModelOutlineRenderer.java @@ -620,6 +620,11 @@ public class ModelOutlineRenderer */ private boolean projectVertices(Model model, final int localX, final int localY, final int localZ, final int vertexOrientation) { + if (model == null) + { + return false; + } + final int cameraX = client.getCameraX(); final int cameraY = client.getCameraY(); final int cameraZ = client.getCameraZ(); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/MemorizedNpc.java b/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/MemorizedNpc.java index 09531c4cfc..404748db74 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/MemorizedNpc.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/MemorizedNpc.java @@ -25,7 +25,9 @@ package net.runelite.client.plugins.npchighlight; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; +import java.util.Set; import lombok.Getter; import lombok.Setter; import net.runelite.api.NPC; @@ -38,7 +40,7 @@ class MemorizedNpc private int npcIndex; @Getter - private String npcName; + private Set npcNames; @Getter private int npcSize; @@ -63,7 +65,8 @@ class MemorizedNpc MemorizedNpc(NPC npc) { - this.npcName = npc.getName(); + this.npcNames = new HashSet<>(); + this.npcNames.add(npc.getName()); this.npcIndex = npc.getIndex(); this.possibleRespawnLocations = new ArrayList<>(); this.respawnTime = -1; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcIndicatorsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcIndicatorsPlugin.java index 34d89e1944..07b877e1a8 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcIndicatorsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcIndicatorsPlugin.java @@ -34,6 +34,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; +import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; @@ -58,6 +59,7 @@ import net.runelite.api.events.GameTick; import net.runelite.api.events.GraphicsObjectCreated; import net.runelite.api.events.MenuEntryAdded; import net.runelite.api.events.MenuOptionClicked; +import net.runelite.api.events.NpcCompositionChanged; import net.runelite.api.events.NpcDespawned; import net.runelite.api.events.NpcSpawned; import net.runelite.client.callback.ClientThread; @@ -304,14 +306,15 @@ public class NpcIndicatorsPlugin extends Plugin if (removed) { - highlightedNpcs.remove(npc); - memorizedNpcs.remove(npc.getIndex()); + MemorizedNpc mn = memorizedNpcs.get(npc.getIndex()); + if (mn != null && isNpcMemorizationUnnecessary(mn)) + { + memorizedNpcs.remove(npc.getIndex()); + } } else { - memorizeNpc(npc); npcTags.add(id); - highlightedNpcs.add(npc); } click.consume(); @@ -320,30 +323,28 @@ public class NpcIndicatorsPlugin extends Plugin @Subscribe public void onNpcSpawned(NpcSpawned npcSpawned) { - final NPC npc = npcSpawned.getNpc(); - final String npcName = npc.getName(); + NPC npc = npcSpawned.getNpc(); + highlightNpcIfMatch(npc); - if (npcName == null) + if (memorizedNpcs.containsKey(npc.getIndex())) { - return; - } - - if (npcTags.contains(npc.getIndex())) - { - memorizeNpc(npc); - highlightedNpcs.add(npc); spawnedNpcsThisTick.add(npc); - return; } + } - for (String highlight : highlights) + @Subscribe + public void onNpcCompositionChanged(NpcCompositionChanged event) + { + NPC npc = event.getNpc(); + highlightNpcIfMatch(npc); + + MemorizedNpc mn = memorizedNpcs.get(npc.getIndex()); + if (mn != null) { - if (WildcardMatcher.matches(highlight, npcName)) + String npcName = npc.getName(); + if (npcName != null) { - memorizeNpc(npc); - highlightedNpcs.add(npc); - spawnedNpcsThisTick.add(npc); - break; + mn.getNpcNames().add(npcName); } } } @@ -428,12 +429,59 @@ public class NpcIndicatorsPlugin extends Plugin return new WorldPoint(currWP.getX() - dx, currWP.getY() - dy, currWP.getPlane()); } + private void highlightNpcIfMatch(final NPC npc) + { + if (npcTags.contains(npc.getIndex())) + { + memorizeNpc(npc); + highlightedNpcs.add(npc); + return; + } + + final String npcName = npc.getName(); + if (npcName != null) + { + for (String highlight : highlights) + { + if (WildcardMatcher.matches(highlight, npcName)) + { + memorizeNpc(npc); + highlightedNpcs.add(npc); + return; + } + } + } + + highlightedNpcs.remove(npc); + } + private void memorizeNpc(NPC npc) { final int npcIndex = npc.getIndex(); memorizedNpcs.putIfAbsent(npcIndex, new MemorizedNpc(npc)); } + private boolean isNpcMemorizationUnnecessary(final MemorizedNpc mn) + { + if (npcTags.contains(mn.getNpcIndex())) + { + return false; + } + + for (String npcName : mn.getNpcNames()) + { + for (String highlight : highlights) + { + if (WildcardMatcher.matches(highlight, npcName)) + { + return false; + } + } + } + + return true; + } + private void removeOldHighlightedRespawns() { deadNpcsToDisplay.values().removeIf(x -> x.getDiedOnTick() + x.getRespawnTime() <= client.getTickCount() + 1); @@ -464,34 +512,21 @@ public class NpcIndicatorsPlugin extends Plugin return; } - outer: + Iterator> it = memorizedNpcs.entrySet().iterator(); + while (it.hasNext()) + { + MemorizedNpc mn = it.next().getValue(); + + if (isNpcMemorizationUnnecessary(mn)) + { + deadNpcsToDisplay.remove(mn.getNpcIndex()); + it.remove(); + } + } + for (NPC npc : client.getNpcs()) { - final String npcName = npc.getName(); - - if (npcName == null) - { - continue; - } - - if (npcTags.contains(npc.getIndex())) - { - highlightedNpcs.add(npc); - continue; - } - - for (String highlight : highlights) - { - if (WildcardMatcher.matches(highlight, npcName)) - { - memorizeNpc(npc); - highlightedNpcs.add(npc); - continue outer; - } - } - - // NPC is not highlighted - memorizedNpcs.remove(npc.getIndex()); + highlightNpcIfMatch(npc); } } @@ -524,7 +559,7 @@ public class NpcIndicatorsPlugin extends Plugin if (!mn.getPossibleRespawnLocations().isEmpty()) { - log.debug("Starting {} tick countdown for {}", mn.getRespawnTime(), mn.getNpcName()); + log.debug("Starting {} tick countdown for {}", mn.getRespawnTime(), mn.getNpcNames().iterator().next()); deadNpcsToDisplay.put(mn.getNpcIndex(), mn); } } From c51efbbfd78332bdf7270c5f4e3e0e288b7432dc Mon Sep 17 00:00:00 2001 From: Owain van Brakel Date: Mon, 1 Jul 2019 16:00:32 +0200 Subject: [PATCH 50/58] Fixed npc despawn event (#843) --- .../src/main/java/net/runelite/mixins/RSNPCMixin.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSNPCMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSNPCMixin.java index 9b58f3eb2c..327886a637 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSNPCMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSNPCMixin.java @@ -112,13 +112,7 @@ public abstract class RSNPCMixin implements RSNPC { client.getCallbacks().post(new NpcDespawned(this)); } - } - - @FieldHook("definition") - @Inject - public void afterCompositionChanged(int idx) - { - if (this.getDefinition() != null && this.getId() != -1) + else if (this.getId() != -1) { client.getCallbacks().post(new NpcCompositionChanged(this)); } From cd62c44ff471b8e0d050853661bf10f12ddfabb8 Mon Sep 17 00:00:00 2001 From: sdburns1998 Date: Mon, 1 Jul 2019 16:07:33 +0200 Subject: [PATCH 51/58] Remove this band aid 'fix' --- .../net/runelite/client/graphics/ModelOutlineRenderer.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/graphics/ModelOutlineRenderer.java b/runelite-client/src/main/java/net/runelite/client/graphics/ModelOutlineRenderer.java index 0093315bfa..203f16fdab 100644 --- a/runelite-client/src/main/java/net/runelite/client/graphics/ModelOutlineRenderer.java +++ b/runelite-client/src/main/java/net/runelite/client/graphics/ModelOutlineRenderer.java @@ -620,11 +620,6 @@ public class ModelOutlineRenderer */ private boolean projectVertices(Model model, final int localX, final int localY, final int localZ, final int vertexOrientation) { - if (model == null) - { - return false; - } - final int cameraX = client.getCameraX(); final int cameraY = client.getCameraY(); final int cameraZ = client.getCameraZ(); From 4cbfc8dda00a59d9d7fb0e7074b2da6c7ff346be Mon Sep 17 00:00:00 2001 From: Ganom Date: Mon, 1 Jul 2019 16:12:00 -0400 Subject: [PATCH 52/58] Refactor NpcCompositionChanged to NpcDefinitionChanged to stay consistent with mixin naming. --- .../{NpcCompositionChanged.java => NpcDefinitionChanged.java} | 2 +- .../client/plugins/npchighlight/NpcIndicatorsPlugin.java | 4 ++-- .../java/net/runelite/client/plugins/slayer/SlayerPlugin.java | 4 ++-- .../src/main/java/net/runelite/mixins/RSNPCMixin.java | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) rename runelite-api/src/main/java/net/runelite/api/events/{NpcCompositionChanged.java => NpcDefinitionChanged.java} (97%) diff --git a/runelite-api/src/main/java/net/runelite/api/events/NpcCompositionChanged.java b/runelite-api/src/main/java/net/runelite/api/events/NpcDefinitionChanged.java similarity index 97% rename from runelite-api/src/main/java/net/runelite/api/events/NpcCompositionChanged.java rename to runelite-api/src/main/java/net/runelite/api/events/NpcDefinitionChanged.java index 29cdd890b6..7d9569f5bd 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/NpcCompositionChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/NpcDefinitionChanged.java @@ -31,7 +31,7 @@ import net.runelite.api.NPC; * Fires after the composition of an {@link NPC} changes. */ @Value -public class NpcCompositionChanged +public class NpcDefinitionChanged { /** * The NPC of which the composition changed. diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcIndicatorsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcIndicatorsPlugin.java index 07b877e1a8..63ec966f6d 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcIndicatorsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcIndicatorsPlugin.java @@ -59,7 +59,7 @@ import net.runelite.api.events.GameTick; import net.runelite.api.events.GraphicsObjectCreated; import net.runelite.api.events.MenuEntryAdded; import net.runelite.api.events.MenuOptionClicked; -import net.runelite.api.events.NpcCompositionChanged; +import net.runelite.api.events.NpcDefinitionChanged; import net.runelite.api.events.NpcDespawned; import net.runelite.api.events.NpcSpawned; import net.runelite.client.callback.ClientThread; @@ -333,7 +333,7 @@ public class NpcIndicatorsPlugin extends Plugin } @Subscribe - public void onNpcCompositionChanged(NpcCompositionChanged event) + public void onNpcDefinitionChanged(NpcDefinitionChanged event) { NPC npc = event.getNpc(); highlightNpcIfMatch(npc); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerPlugin.java index d54b21f7dd..b805edd030 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerPlugin.java @@ -67,7 +67,7 @@ import net.runelite.api.events.ExperienceChanged; import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameTick; import net.runelite.api.events.InteractingChanged; -import net.runelite.api.events.NpcCompositionChanged; +import net.runelite.api.events.NpcDefinitionChanged; import net.runelite.api.events.NpcDespawned; import net.runelite.api.events.NpcSpawned; import net.runelite.api.events.VarbitChanged; @@ -351,7 +351,7 @@ public class SlayerPlugin extends Plugin } @Subscribe - public void onNpcCompositionChanged(NpcCompositionChanged event) + public void onNpcDefinitionChanged(NpcDefinitionChanged event) { NPC npc = event.getNpc(); diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSNPCMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSNPCMixin.java index 327886a637..e33afa700b 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSNPCMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSNPCMixin.java @@ -29,7 +29,7 @@ import net.runelite.api.AnimationID; import net.runelite.api.NPCDefinition; import net.runelite.api.Perspective; import net.runelite.api.coords.LocalPoint; -import net.runelite.api.events.NpcCompositionChanged; +import net.runelite.api.events.NpcDefinitionChanged; import net.runelite.api.events.NpcDespawned; import net.runelite.api.mixins.Copy; import net.runelite.api.mixins.FieldHook; @@ -114,7 +114,7 @@ public abstract class RSNPCMixin implements RSNPC } else if (this.getId() != -1) { - client.getCallbacks().post(new NpcCompositionChanged(this)); + client.getCallbacks().post(new NpcDefinitionChanged(this)); } } From 65f7d0f6b1f8c6180900bd3dc235391a1685282e Mon Sep 17 00:00:00 2001 From: Ganom Date: Mon, 1 Jul 2019 16:33:35 -0400 Subject: [PATCH 53/58] Maiden Handler now utilizes npc definition changed for nylos. --- .../client/plugins/theatre/TheatrePlugin.java | 10 ++++++ .../plugins/theatre/rooms/MaidenHandler.java | 31 +++++++++++++------ 2 files changed, 32 insertions(+), 9 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/TheatrePlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/TheatrePlugin.java index 5f975d675e..2a08416e84 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/TheatrePlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/TheatrePlugin.java @@ -23,6 +23,7 @@ import net.runelite.api.events.ChatMessage; import net.runelite.api.events.ConfigChanged; import net.runelite.api.events.GameTick; import net.runelite.api.events.GroundObjectSpawned; +import net.runelite.api.events.NpcDefinitionChanged; import net.runelite.api.events.NpcDespawned; import net.runelite.api.events.NpcSpawned; import net.runelite.api.events.ProjectileMoved; @@ -154,6 +155,15 @@ public class TheatrePlugin extends Plugin } } + @Subscribe + public void onNpcDefinitionChanged(NpcDefinitionChanged event) + { + if (maidenHandler != null) + { + maidenHandler.onNpcDefinitionChanged(event); + } + } + @Subscribe public void onNpcSpawned(NpcSpawned event) { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/MaidenHandler.java b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/MaidenHandler.java index 4f109e80c6..628d6d8a71 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/MaidenHandler.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/MaidenHandler.java @@ -14,6 +14,7 @@ import net.runelite.api.GraphicsObject; import net.runelite.api.NPC; import net.runelite.api.coords.WorldPoint; import net.runelite.api.events.ChatMessage; +import net.runelite.api.events.NpcDefinitionChanged; import net.runelite.api.events.NpcDespawned; import net.runelite.api.events.NpcSpawned; import net.runelite.api.events.SpotAnimationChanged; @@ -59,7 +60,7 @@ public class MaidenHandler extends RoomHandler private List bloodSpawnLocation = new ArrayList<>(); private List bloodSpawnTarget = new ArrayList<>(); private NPC maiden; - private String nyloCall = "n1"; + private String nyloCall; private Set nylos = new HashSet<>(); private List healers = new ArrayList<>(); private int healerCount = 0; @@ -101,6 +102,7 @@ public class MaidenHandler extends RoomHandler this.bloodSpawnLocation.clear(); this.bloodSpawnTarget.clear(); this.healers.clear(); + this.nylos.clear(); this.healerCount = 0; this.startTime = -1; this.wave = 1; @@ -117,6 +119,11 @@ public class MaidenHandler extends RoomHandler final String location = nylo.getSpawnLocation().getName(); + if (nyloCall == null || nyloCall.equals("")) + { + nyloCall = "n1"; + } + if (location.equals(nyloCall)) { Color color = Color.WHITE; @@ -233,6 +240,19 @@ public class MaidenHandler extends RoomHandler } } + public void onNpcDefinitionChanged(NpcDefinitionChanged event) + { + NPC npc = event.getNpc(); + + if (npc.getName() != null && npc.getName().equals("Nylocas Matomenos")) + { + if (npc.getId() == -1) + { + nylos.removeIf(c -> c.getNpc() == npc); + } + } + } + public void onChatMessage(ChatMessage event) { if (event.getSender() != null && !event.getSender().equals(client.getLocalPlayer().getName())) @@ -249,6 +269,7 @@ public class MaidenHandler extends RoomHandler case "s1": case "s2": nyloCall = msg; + log.debug("Nylo Call Assigned: " + msg); break; } } @@ -280,14 +301,6 @@ public class MaidenHandler extends RoomHandler return; } - if (!nylos.isEmpty()) - { - for (Nylos nylo : nylos) - { - nylos.removeIf(c -> c.getNpc().getId() == -1); - } - } - bloodThrows.clear(); for (GraphicsObject o : client.getGraphicsObjects()) From 9e0dc2bcc95f650c36ec7183f7f2c35a48fa3e9e Mon Sep 17 00:00:00 2001 From: Ganom Date: Mon, 1 Jul 2019 16:46:06 -0400 Subject: [PATCH 54/58] Change logging for maiden so it actually outputs if not using debug. --- .../client/plugins/theatre/rooms/MaidenHandler.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/MaidenHandler.java b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/MaidenHandler.java index 628d6d8a71..68115623fa 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/MaidenHandler.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/MaidenHandler.java @@ -224,11 +224,8 @@ public class MaidenHandler extends RoomHandler } if (!N1.contains(wp) && !N2.contains(wp) && !S1.contains(wp) && !S2.contains(wp)) { - log.debug("------------------------"); - log.debug("No World Points Matched"); - log.debug("Dumping Location"); - log.debug("Instance Loc: " + wp); - log.debug("------------------------"); + log.info("No World Points Matched"); + log.info("Instance Loc: " + wp); } break; case "Blood spawn": From 74da8a883f3ee6e0095281b21cbf2753aa76420f Mon Sep 17 00:00:00 2001 From: Zeruth Date: Mon, 1 Jul 2019 18:10:13 -0400 Subject: [PATCH 55/58] bringup to current runelite-master --- .../net/runelite/cache/item/SpritePixels.java | 2 +- .../java/net/runelite/cache/AreaDumper.java | 2 +- .../animation/AnimationController.java | 92 ------ .../runelite/client/game/AgilityShortcut.java | 2 +- .../cluescrolls/clues/CrypticClue.java | 2 +- .../cluescrolls/clues/HotColdClue.java | 293 +++++++----------- .../clues/hotcold/HotColdLocation.java | 19 +- .../clues/hotcold/HotColdSolver.java | 167 ++++++++++ .../clues/hotcold/HotColdTemperature.java | 112 +++++++ .../hotcold/HotColdTemperatureChange.java | 55 ++++ .../plugins/itemcharges/ItemChargeConfig.java | 48 ++- .../itemcharges/ItemChargeOverlay.java | 7 +- .../plugins/itemcharges/ItemChargeType.java | 4 +- .../plugins/itemcharges/ItemWithCharge.java | 186 ++++------- .../MenuEntrySwapperConfig.java | 2 +- .../screenmarkers/ui/ScreenMarkerPanel.java | 84 ++++- .../worldhopper/WorldHopperPlugin.java | 2 +- .../hotcold/BeginnerHotColdLocationTest.java | 50 +++ .../clues/hotcold/HotColdSolverTest.java | 259 ++++++++++++++++ .../hotcold/HotColdTemperatureChangeTest.java | 68 ++++ .../clues/hotcold/HotColdTemperatureTest.java | 77 +++++ .../hotcold/MasterHotColdLocationTest.java | 49 +++ 22 files changed, 1148 insertions(+), 434 deletions(-) delete mode 100644 http-service/src/main/java/net/runelite/http/service/animation/AnimationController.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdSolver.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdTemperature.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdTemperatureChange.java create mode 100644 runelite-client/src/test/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/BeginnerHotColdLocationTest.java create mode 100644 runelite-client/src/test/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdSolverTest.java create mode 100644 runelite-client/src/test/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdTemperatureChangeTest.java create mode 100644 runelite-client/src/test/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdTemperatureTest.java create mode 100644 runelite-client/src/test/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/MasterHotColdLocationTest.java diff --git a/cache/src/main/java/net/runelite/cache/item/SpritePixels.java b/cache/src/main/java/net/runelite/cache/item/SpritePixels.java index ed8be85a18..a1b3c026b9 100644 --- a/cache/src/main/java/net/runelite/cache/item/SpritePixels.java +++ b/cache/src/main/java/net/runelite/cache/item/SpritePixels.java @@ -108,7 +108,7 @@ class Sprite } - public void drawAtOn(Rasterizer2D graphics, int x, int y) + public void drawAtOn(Rasterizer2D graphics, int x, int y) { x += this.offsetX; y += this.offsetY; diff --git a/cache/src/test/java/net/runelite/cache/AreaDumper.java b/cache/src/test/java/net/runelite/cache/AreaDumper.java index 2aab1db48b..0b276fcce1 100644 --- a/cache/src/test/java/net/runelite/cache/AreaDumper.java +++ b/cache/src/test/java/net/runelite/cache/AreaDumper.java @@ -64,7 +64,7 @@ public class AreaDumper for (AreaDefinition area : areaManager.getAreas()) { - Files.asCharSink(new File(outDir, area.id + ".json"), Charset.defaultCharset()).write(gson.toJson(area)); + Files.asCharSink(new File(outDir, area.id + ".json"), Charset.defaultCharset()).write(gson.toJson(area)); ++count; } } diff --git a/http-service/src/main/java/net/runelite/http/service/animation/AnimationController.java b/http-service/src/main/java/net/runelite/http/service/animation/AnimationController.java deleted file mode 100644 index c588b8193d..0000000000 --- a/http-service/src/main/java/net/runelite/http/service/animation/AnimationController.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2018, Adam - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.http.service.animation; - -import java.util.List; -import java.util.stream.Collectors; -import net.runelite.http.api.animation.AnimationKey; -import net.runelite.http.api.animation.AnimationRequest; -import net.runelite.http.service.util.exception.NotFoundException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import static org.springframework.web.bind.annotation.RequestMethod.POST; -import org.springframework.web.bind.annotation.RestController; - -@RestController -@RequestMapping("/animation") -public class AnimationController -{ - @Autowired - private AnimationEndpoint animationService; - - @RequestMapping(method = POST) - public void submit(@RequestBody AnimationRequest animationRequest) - { - animationService.submit(animationRequest); - } - - @GetMapping - public List get() - { - return animationService.get().stream() - .map(AnimationController::entryToKey) - .collect(Collectors.toList()); - } - - @GetMapping("/{npcid}") - public AnimationKey getRegion(@PathVariable int npcid) - { - AnimationEntry animationEntry = animationService.getNPC(npcid); - if (animationEntry == null) - { - throw new NotFoundException(); - } - - return entryToKey(animationEntry); - } - - private static AnimationKey entryToKey(AnimationEntry xe) - { - AnimationKey animationKey = new AnimationKey(); - animationKey.setNPCId(xe.getNPCId()); - animationKey.setAnimations(new int[] - { - xe.getAnimations()[0], - xe.getAnimations()[1], - xe.getAnimations()[2], - xe.getAnimations()[3], - xe.getAnimations()[4], - xe.getAnimations()[5], - xe.getAnimations()[6], - xe.getAnimations()[7], - xe.getAnimations()[8], - xe.getAnimations()[9], - }); - return animationKey; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/game/AgilityShortcut.java b/runelite-client/src/main/java/net/runelite/client/game/AgilityShortcut.java index 96a55f3e86..9c20fb9b8f 100644 --- a/runelite-client/src/main/java/net/runelite/client/game/AgilityShortcut.java +++ b/runelite-client/src/main/java/net/runelite/client/game/AgilityShortcut.java @@ -288,7 +288,7 @@ public enum AgilityShortcut GOBLIN_VILLAGE_WALL(14, "Wall", new WorldPoint(2925, 3523, 0), TIGHTGAP), CORSAIR_COVE_DUNGEON_PILLAR(15, "Pillar Jump", new WorldPoint(1980, 8996, 0), PILLAR_31809), EDGEVILLE_DUNGEON_MONKEYBARS(15, "Monkey Bars", null, MONKEYBARS_23566), - TROLLHEIM_ROCKS(15, "Rocks", null, new WorldPoint(2838, 3614, 0), ROCKS_3748), // No fixed world map location, but rocks near death plateau have a requirement of 15 + TROLLHEIM_ROCKS(15, "Rocks", null, new WorldPoint(2838, 3614, 0), ROCKS_3748), // No fixed world map location, but rocks near death plateau have a requirement of 15 YANILLE_UNDERWALL_TUNNEL(16, "Underwall Tunnel", new WorldPoint(2574, 3109, 0), HOLE_16520, CASTLE_WALL), YANILLE_WATCHTOWER_TRELLIS(18, "Trellis", null, TRELLIS_20056), COAL_TRUCKS_LOG_BALANCE(20, "Log Balance", new WorldPoint(2598, 3475, 0), LOG_BALANCE_23274), diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CrypticClue.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CrypticClue.java index 725d17622c..3d71281cd7 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CrypticClue.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CrypticClue.java @@ -80,7 +80,7 @@ public class CrypticClue extends ClueScroll implements TextClueScroll, NpcClueSc new CrypticClue("Speak to the bartender of the Blue Moon Inn in Varrock.", "Bartender", new WorldPoint(3226, 3399, 0), "Talk to the bartender in Blue Moon Inn in Varrock."), new CrypticClue("This aviator is at the peak of his profession.", "Captain Bleemadge", new WorldPoint(2846, 1749, 0), "Captain Bleemadge, the gnome glider pilot, is found at the top of White Wolf Mountain."), new CrypticClue("Search the crates in the shed just north of East Ardougne.", CRATE_355, new WorldPoint(2617, 3347, 0), "The crates in the shed north of the northern Ardougne bank."), - new CrypticClue("I wouldn't wear this jean on my legs.", "Father Jean", new WorldPoint(1697, 3574, 0), "Talk to father Jean in the Hosidius church"), + new CrypticClue("I wouldn't wear this jean on my legs.", "Father Jean", new WorldPoint(1734, 3576, 0), "Talk to father Jean in the Hosidius church"), new CrypticClue("Search the crate in the Toad and Chicken pub.", CRATE_354, new WorldPoint(2913, 3536, 0), "The Toad and Chicken pub is located in Burthorpe."), new CrypticClue("Search chests found in the upstairs of shops in Port Sarim.", CLOSED_CHEST_375, new WorldPoint(3016, 3205, 1), "Search the chest in the upstairs of Wydin's Food Store, on the east wall."), new CrypticClue("Right on the blessed border, cursed by the evil ones. On the spot inaccessible by both; I will be waiting. The bugs' imminent possession holds the answer.", new WorldPoint(3410, 3324, 0), "B I P. Dig right under the fairy ring."), diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/HotColdClue.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/HotColdClue.java index 762bda9ad9..8136d00117 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/HotColdClue.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/HotColdClue.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2018, Eadgars Ruse + * Copyright (c) 2019, Jordan Atwood * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -24,21 +25,19 @@ */ package net.runelite.client.plugins.cluescrolls.clues; -import com.google.common.collect.Lists; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics2D; -import java.awt.Point; -import java.awt.Rectangle; -import java.awt.geom.Rectangle2D; -import java.util.ArrayList; import java.util.Arrays; -import java.util.HashMap; -import java.util.List; +import java.util.Collection; +import java.util.EnumMap; import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; +import java.util.Set; +import java.util.stream.Collectors; +import javax.annotation.Nullable; +import lombok.EqualsAndHashCode; import lombok.Getter; +import lombok.extern.slf4j.Slf4j; import net.runelite.api.NPC; import net.runelite.api.coords.LocalPoint; import net.runelite.api.coords.WorldPoint; @@ -47,35 +46,45 @@ import net.runelite.client.plugins.cluescrolls.ClueScrollPlugin; import static net.runelite.client.plugins.cluescrolls.ClueScrollWorldOverlay.IMAGE_Z_OFFSET; import net.runelite.client.plugins.cluescrolls.clues.hotcold.HotColdArea; import net.runelite.client.plugins.cluescrolls.clues.hotcold.HotColdLocation; +import net.runelite.client.plugins.cluescrolls.clues.hotcold.HotColdSolver; +import net.runelite.client.plugins.cluescrolls.clues.hotcold.HotColdTemperature; +import net.runelite.client.plugins.cluescrolls.clues.hotcold.HotColdTemperatureChange; import net.runelite.client.ui.overlay.OverlayUtil; import net.runelite.client.ui.overlay.components.LineComponent; import net.runelite.client.ui.overlay.components.PanelComponent; import net.runelite.client.ui.overlay.components.TitleComponent; +@EqualsAndHashCode(callSuper = false, exclude = { "hotColdSolver", "location" }) @Getter +@Slf4j public class HotColdClue extends ClueScroll implements LocationClueScroll, LocationsClueScroll, TextClueScroll, NpcClueScroll { - private static final Pattern INITIAL_STRANGE_DEVICE_MESSAGE = Pattern.compile("The device is (.*)"); - private static final Pattern STRANGE_DEVICE_MESSAGE = Pattern.compile("The device is (.*), (.*) last time\\."); - private static final Pattern FINAL_STRANGE_DEVICE_MESSAGE = Pattern.compile("The device is visibly shaking.*"); - private static final HotColdClue CLUE = - new HotColdClue("Buried beneath the ground, who knows where it's found. Lucky for you, A man called Jorral may have a clue.", - "Jorral", - "Speak to Jorral to receive a strange device."); + private static final int HOT_COLD_PANEL_WIDTH = 200; + private static final HotColdClue BEGINNER_CLUE = new HotColdClue("Buried beneath the ground, who knows where it's found. Lucky for you, A man called Reldo may have a clue.", + "Reldo", + "Speak to Reldo to receive a strange device."); + private static final HotColdClue MASTER_CLUE = new HotColdClue("Buried beneath the ground, who knows where it's found. Lucky for you, A man called Jorral may have a clue.", + "Jorral", + "Speak to Jorral to receive a strange device."); - // list of potential places to dig - private List digLocations = new ArrayList<>(); private final String text; private final String npc; private final String solution; + @Nullable + private HotColdSolver hotColdSolver; private WorldPoint location; - private WorldPoint lastWorldPoint; public static HotColdClue forText(String text) { - if (CLUE.text.equalsIgnoreCase(text)) + if (BEGINNER_CLUE.text.equalsIgnoreCase(text)) { - return CLUE; + BEGINNER_CLUE.reset(); + return BEGINNER_CLUE; + } + else if (MASTER_CLUE.text.equalsIgnoreCase(text)) + { + MASTER_CLUE.reset(); + return MASTER_CLUE; } return null; @@ -87,24 +96,35 @@ public class HotColdClue extends ClueScroll implements LocationClueScroll, Locat this.npc = npc; this.solution = solution; setRequiresSpade(true); + initializeSolver(); } @Override public WorldPoint[] getLocations() { - return Lists.transform(digLocations, HotColdLocation::getWorldPoint).toArray(new WorldPoint[0]); + if (hotColdSolver == null) + { + return new WorldPoint[0]; + } + + return hotColdSolver.getPossibleLocations().stream().map(HotColdLocation::getWorldPoint).toArray(WorldPoint[]::new); } @Override public void makeOverlayHint(PanelComponent panelComponent, ClueScrollPlugin plugin) { + if (hotColdSolver == null) + { + return; + } + panelComponent.getChildren().add(TitleComponent.builder() .text("Hot/Cold Clue") .build()); - panelComponent.setPreferredSize(new Dimension(200, 0)); + panelComponent.setPreferredSize(new Dimension(HOT_COLD_PANEL_WIDTH, 0)); // strange device has not been tested yet, show how to get it - if (lastWorldPoint == null && location == null) + if (hotColdSolver.getLastWorldPoint() == null && location == null) { if (getNpc() != null) { @@ -131,7 +151,9 @@ public class HotColdClue extends ClueScroll implements LocationClueScroll, Locat panelComponent.getChildren().add(LineComponent.builder() .left("Possible areas:") .build()); - Map locationCounts = new HashMap<>(); + + final Map locationCounts = new EnumMap<>(HotColdArea.class); + final Collection digLocations = hotColdSolver.getPossibleLocations(); for (HotColdLocation hotColdLocation : digLocations) { @@ -159,17 +181,16 @@ public class HotColdClue extends ClueScroll implements LocationClueScroll, Locat } else { - for (HotColdArea s : locationCounts.keySet()) + for (HotColdArea area : locationCounts.keySet()) { panelComponent.getChildren().add(LineComponent.builder() - .left(s.getName() + ":") + .left(area.getName() + ':') .build()); for (HotColdLocation hotColdLocation : digLocations) { - if (hotColdLocation.getHotColdArea() == s) + if (hotColdLocation.getHotColdArea() == area) { - Rectangle2D r = hotColdLocation.getRect(); panelComponent.getChildren().add(LineComponent.builder() .left("- " + hotColdLocation.getArea()) .leftColor(Color.LIGHT_GRAY) @@ -184,8 +205,13 @@ public class HotColdClue extends ClueScroll implements LocationClueScroll, Locat @Override public void makeWorldOverlayHint(Graphics2D graphics, ClueScrollPlugin plugin) { + if (hotColdSolver == null) + { + return; + } + // when final location has been found - if (this.location != null) + if (location != null) { LocalPoint localLocation = LocalPoint.fromWorld(plugin.getClient(), getLocation()); @@ -197,20 +223,17 @@ public class HotColdClue extends ClueScroll implements LocationClueScroll, Locat return; } - // when strange device hasn't been activated yet, show Jorral - if (lastWorldPoint == null) + // when strange device hasn't been activated yet, show npc who gives you the strange device + if (hotColdSolver.getLastWorldPoint() == null && plugin.getNpcsToMark() != null) { - // Mark NPC - if (plugin.getNpcsToMark() != null) + for (NPC npcToMark : plugin.getNpcsToMark()) { - for (NPC npc : plugin.getNpcsToMark()) - { - OverlayUtil.renderActorOverlayImage(graphics, npc, plugin.getClueScrollImage(), Color.ORANGE, IMAGE_Z_OFFSET); - } + OverlayUtil.renderActorOverlayImage(graphics, npcToMark, plugin.getClueScrollImage(), Color.ORANGE, IMAGE_Z_OFFSET); } } // once the number of possible dig locations is below 10, show the dig spots + final Collection digLocations = hotColdSolver.getPossibleLocations(); if (digLocations.size() < 10) { // Mark potential dig locations @@ -231,171 +254,87 @@ public class HotColdClue extends ClueScroll implements LocationClueScroll, Locat public boolean update(final String message, final ClueScrollPlugin plugin) { - if (!message.startsWith("The device is")) + if (hotColdSolver == null) { return false; } - Matcher m1 = FINAL_STRANGE_DEVICE_MESSAGE.matcher(message); - Matcher m2 = STRANGE_DEVICE_MESSAGE.matcher(message); - Matcher m3 = INITIAL_STRANGE_DEVICE_MESSAGE.matcher(message); + final Set temperatureSet; - // the order that these pattern matchers are checked is important - if (m1.find()) + if (this.equals(BEGINNER_CLUE)) { - // final location for hot cold clue has been found - WorldPoint localWorld = plugin.getClient().getLocalPlayer().getWorldLocation(); - - if (localWorld != null) - { - markFinalSpot(localWorld); - return true; - } + temperatureSet = HotColdTemperature.BEGINNER_HOT_COLD_TEMPERATURES; } - else if (m2.find()) + else if (this.equals(MASTER_CLUE)) { - String temperature = m2.group(1); - String difference = m2.group(2); - WorldPoint localWorld = plugin.getClient().getLocalPlayer().getWorldLocation(); - - if (localWorld != null) - { - updatePossibleArea(localWorld, temperature, difference); - return true; - } + temperatureSet = HotColdTemperature.MASTER_HOT_COLD_TEMPERATURES; } - else if (m3.find()) + else { - String temperature = m3.group(1); - WorldPoint localWorld = plugin.getClient().getLocalPlayer().getWorldLocation(); - - if (localWorld != null) - { - updatePossibleArea(localWorld, temperature, ""); - return true; - } + temperatureSet = null; } - return false; + final HotColdTemperature temperature = HotColdTemperature.getFromTemperatureSet(temperatureSet, message); + + if (temperature == null) + { + return false; + } + + final WorldPoint localWorld = plugin.getClient().getLocalPlayer().getWorldLocation(); + + if (localWorld == null) + { + return false; + } + + if ((this.equals(BEGINNER_CLUE) && temperature == HotColdTemperature.BEGINNER_VISIBLY_SHAKING) + || (this.equals(MASTER_CLUE) && temperature == HotColdTemperature.MASTER_VISIBLY_SHAKING)) + { + markFinalSpot(localWorld); + } + else + { + location = null; + + final HotColdTemperatureChange temperatureChange = HotColdTemperatureChange.of(message); + hotColdSolver.signal(localWorld, temperature, temperatureChange); + } + + return true; } @Override public void reset() { - this.lastWorldPoint = null; - digLocations.clear(); + initializeSolver(); } - private void updatePossibleArea(WorldPoint currentWp, String temperature, String difference) + private void initializeSolver() { - this.location = null; + final boolean isBeginner; - if (digLocations.isEmpty()) + if (this.equals(BEGINNER_CLUE)) { - digLocations.addAll(Arrays.asList(HotColdLocation.values())); + isBeginner = true; + } + else if (this.equals(MASTER_CLUE)) + { + isBeginner = false; } - int maxSquaresAway = 5000; - int minSquaresAway = 0; - - switch (temperature) + else { - // when the strange device reads a temperature, that means that the center of the final dig location - // is a range of squares away from the player's current location (Chebyshev AKA Chess-board distance) - case "ice cold": - maxSquaresAway = 5000; - minSquaresAway = 500; - break; - case "very cold": - maxSquaresAway = 499; - minSquaresAway = 200; - break; - case "cold": - maxSquaresAway = 199; - minSquaresAway = 150; - break; - case "warm": - maxSquaresAway = 149; - minSquaresAway = 100; - break; - case "hot": - maxSquaresAway = 99; - minSquaresAway = 70; - break; - case "very hot": - maxSquaresAway = 69; - minSquaresAway = 30; - break; - case "incredibly hot": - maxSquaresAway = 29; - minSquaresAway = 5; - break; + log.warn("Hot cold solver could not be initialized, clue type is unknown; text: {}, npc: {}, solution: {}", + text, npc, solution); + hotColdSolver = null; + return; } - // rectangle r1 encompasses all of the points that are within the max possible distance from the player - Point p1 = new Point(currentWp.getX() - maxSquaresAway, currentWp.getY() - maxSquaresAway); - Rectangle r1 = new Rectangle((int) p1.getX(), (int) p1.getY(), 2 * maxSquaresAway + 1, 2 * maxSquaresAway + 1); - // rectangle r2 encompasses all of the points that are within the min possible distance from the player - Point p2 = new Point(currentWp.getX() - minSquaresAway, currentWp.getY() - minSquaresAway); - Rectangle r2 = new Rectangle((int) p2.getX(), (int) p2.getY(), 2 * minSquaresAway + 1, 2 * minSquaresAway + 1); - - // eliminate from consideration dig spots that lie entirely within the min range or entirely outside of the max range - digLocations.removeIf(entry -> r2.contains(entry.getRect()) || !r1.intersects(entry.getRect())); - - // if a previous world point has been recorded, we can consider the warmer/colder result from the strange device - if (lastWorldPoint != null) - { - switch (difference) - { - case "but colder than": - // eliminate spots that are absolutely warmer - digLocations.removeIf(entry -> isFirstPointCloserRect(currentWp, lastWorldPoint, entry.getRect())); - break; - case "and warmer than": - // eliminate spots that are absolutely colder - digLocations.removeIf(entry -> isFirstPointCloserRect(lastWorldPoint, currentWp, entry.getRect())); - break; - case "and the same temperature as": - // I couldn't figure out a clean implementation for this case - // not necessary for quickly determining final location - } - } - - lastWorldPoint = currentWp; - } - - private boolean isFirstPointCloserRect(WorldPoint firstWp, WorldPoint secondWp, Rectangle2D r) - { - WorldPoint p1 = new WorldPoint((int) r.getMaxX(), (int) r.getMaxY(), 0); - - if (!isFirstPointCloser(firstWp, secondWp, p1)) - { - return false; - } - - WorldPoint p2 = new WorldPoint((int) r.getMaxX(), (int) r.getMinY(), 0); - - if (!isFirstPointCloser(firstWp, secondWp, p2)) - { - return false; - } - - WorldPoint p3 = new WorldPoint((int) r.getMinX(), (int) r.getMaxY(), 0); - - if (!isFirstPointCloser(firstWp, secondWp, p3)) - { - return false; - } - - WorldPoint p4 = new WorldPoint((int) r.getMinX(), (int) r.getMinY(), 0); - return (isFirstPointCloser(firstWp, secondWp, p4)); - } - - private boolean isFirstPointCloser(WorldPoint firstWp, WorldPoint secondWp, WorldPoint wp) - { - int firstDistance = firstWp.distanceTo2D(wp); - int secondDistance = secondWp.distanceTo2D(wp); - return (firstDistance < secondDistance); + final Set locations = Arrays.stream(HotColdLocation.values()) + .filter(l -> l.isBeginnerClue() == isBeginner) + .collect(Collectors.toSet()); + hotColdSolver = new HotColdSolver(locations); } private void markFinalSpot(WorldPoint wp) @@ -408,4 +347,4 @@ public class HotColdClue extends ClueScroll implements LocationClueScroll, Locat { return new String[]{npc}; } -} \ No newline at end of file +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdLocation.java index e41fd5357e..b3bd0c91db 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdLocation.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdLocation.java @@ -1,6 +1,7 @@ /* * Copyright (c) 2018, Eadgars Ruse * Copyright (c) 2018, Adam + * Copyright (c) 2019, Jordan Atwood * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,7 +27,6 @@ package net.runelite.client.plugins.cluescrolls.clues.hotcold; import java.awt.Rectangle; -import java.awt.geom.Rectangle2D; import lombok.AllArgsConstructor; import lombok.Getter; import net.runelite.api.coords.WorldPoint; @@ -69,6 +69,8 @@ public enum HotColdLocation DESERT_POLLNIVNEACH(new WorldPoint(3287, 2975, 0), DESERT, "West of Pollnivneach."), DESERT_MTA(new WorldPoint(3350, 3293, 0), DESERT, "Next to Mage Training Arena."), DESERT_SHANTY(new WorldPoint(3294, 3106, 0), DESERT, "South-west of Shantay Pass."), + DRAYNOR_MANOR_MUSHROOMS(true, new WorldPoint(3096, 3379, 0), MISTHALIN, "Patch of mushrooms just northwest of Draynor Manor"), + DRAYNOR_WHEAT_FIELD(true, new WorldPoint(3120, 3282, 0), MISTHALIN, "Inside the wheat field next to Draynor Village"), FELDIP_HILLS_JIGGIG(new WorldPoint(2413, 3055, 0), FELDIP_HILLS, "West of Jiggig, east of the fairy ring bkp."), FELDIP_HILLS_SW(new WorldPoint(2582, 2895, 0), FELDIP_HILLS, "West of the southeasternmost lake in Feldip Hills."), FELDIP_HILLS_GNOME_GLITER(new WorldPoint(2553, 2972, 0), FELDIP_HILLS, "East of the gnome glider (Lemantolly Undri)."), @@ -91,6 +93,7 @@ public enum HotColdLocation FREMENNIK_PROVINCE_ASTRAL_ALTER(new WorldPoint(2147, 3862, 0), FREMENNIK_PROVINCE, "Astral altar"), FREMENNIK_PROVINCE_LUNAR_VILLAGE(new WorldPoint(2087, 3915, 0), FREMENNIK_PROVINCE, "Lunar Isle, inside the village."), FREMENNIK_PROVINCE_LUNAR_NORTH(new WorldPoint(2106, 3949, 0), FREMENNIK_PROVINCE, "Lunar Isle, north of the village."), + ICE_MOUNTAIN(true, new WorldPoint(3007, 3475, 0), MISTHALIN, "Atop Ice Mountain"), KANDARIN_SINCLAR_MANSION(new WorldPoint(2726, 3588, 0), KANDARIN, "North-west of the Sinclair Mansion, near the log balance shortcut."), KANDARIN_CATHERBY(new WorldPoint(2774, 3433, 0), KANDARIN, "Catherby, between the bank and the beehives, near small rock formation."), KANDARIN_GRAND_TREE(new WorldPoint(2444, 3503, 0), KANDARIN, "Grand Tree, just east of the terrorchick gnome enclosure."), @@ -115,6 +118,7 @@ public enum HotColdLocation KARAMJA_KHARAZI_NE(new WorldPoint(2904, 2925, 0), KARAMJA, "North-eastern part of Kharazi Jungle."), KARAMJA_KHARAZI_SW(new WorldPoint(2783, 2898, 0), KARAMJA, "South-western part of Kharazi Jungle."), KARAMJA_CRASH_ISLAND(new WorldPoint(2910, 2737, 0), KARAMJA, "Northern part of Crash Island."), + LUMBRIDGE_COW_FIELD(true, new WorldPoint(3174, 3336, 0), MISTHALIN, "Cow field north of Lumbridge"), MISTHALIN_VARROCK_STONE_CIRCLE(new WorldPoint(3225, 3355, 0), MISTHALIN, "South of the stone circle near Varrock's entrance."), MISTHALIN_LUMBRIDGE(new WorldPoint(3238, 3169, 0), MISTHALIN, "Just north-west of the Lumbridge Fishing tutor."), MISTHALIN_LUMBRIDGE_2(new WorldPoint(3170, 3278, 0), MISTHALIN, "North of the pond between Lumbridge and Draynor Village."), @@ -131,6 +135,7 @@ public enum HotColdLocation MORYTANIA_MOS_LES_HARMLESS_BAR(new WorldPoint(3670, 2974, 0), MORYTANIA, "Near Mos Le'Harmless southern bar."), MORYTANIA_DRAGONTOOTH_NORTH(new WorldPoint(3813, 3567, 0), MORYTANIA, "Northern part of Dragontooth Island."), MORYTANIA_DRAGONTOOTH_SOUTH(new WorldPoint(3803, 3532, 0), MORYTANIA, "Southern part of Dragontooth Island."), + NORTHEAST_OF_AL_KHARID_MINE(true, new WorldPoint(3332, 3313, 0), MISTHALIN, "Northeast of Al Kharid Mine"), WESTERN_PROVINCE_EAGLES_PEAK(new WorldPoint(2297, 3530, 0), WESTERN_PROVINCE, "North-west of Eagles' Peak."), WESTERN_PROVINCE_PISCATORIS(new WorldPoint(2337, 3689, 0), WESTERN_PROVINCE, "Piscatoris Fishing Colony"), WESTERN_PROVINCE_PISCATORIS_HUNTER_AREA(new WorldPoint(2361, 3566, 0), WESTERN_PROVINCE, "Eastern part of Piscatoris Hunter area, south-west of the Falconry."), @@ -176,12 +181,20 @@ public enum HotColdLocation ZEAH_DAIRY_COW(new WorldPoint(1320, 3718, 0), ZEAH, "North-east of the Kebos Lowlands, east of the dairy cow."), ZEAH_CRIMSON_SWIFTS(new WorldPoint(1186, 3583, 0), ZEAH, "South-west of the Kebos Swamp, below the crimson swifts."); + private final boolean beginnerClue; private final WorldPoint worldPoint; private final HotColdArea hotColdArea; private final String area; - public Rectangle2D getRect() + HotColdLocation(WorldPoint worldPoint, HotColdArea hotColdArea, String areaDescription) { - return new Rectangle(worldPoint.getX() - 4, worldPoint.getY() - 4, 9, 9); + this(false, worldPoint, hotColdArea, areaDescription); + } + + public Rectangle getRect() + { + final int digRadius = beginnerClue ? HotColdTemperature.BEGINNER_VISIBLY_SHAKING.getMaxDistance() : + HotColdTemperature.MASTER_VISIBLY_SHAKING.getMaxDistance(); + return new Rectangle(worldPoint.getX() - digRadius, worldPoint.getY() - digRadius, digRadius * 2 + 1, digRadius * 2 + 1); } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdSolver.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdSolver.java new file mode 100644 index 0000000000..87414f0387 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdSolver.java @@ -0,0 +1,167 @@ +/* + * Copyright (c) 2018, Eadgars Ruse + * Copyright (c) 2019, Jordan Atwood + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.cluescrolls.clues.hotcold; + +import com.google.common.annotations.VisibleForTesting; +import java.awt.Rectangle; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import lombok.Getter; +import net.runelite.api.coords.WorldPoint; + +/** + * Solution finder for hot-cold style puzzles. + *

    + * These puzzles are established by having some way to test the distance from the solution via "warmth", where being + * colder means one is farther away from the target, and being warmer means one is closer to it, with the goal being to + * reach the most warm value to discover the solution point. Hot-cold puzzles in Old School Runescape are implemented + * with specific set of solution points, so this solver will filter from a provided set of possible solutions as new + * signals of temperatures and temperature changes are provided. + */ +@Getter +public class HotColdSolver +{ + private final Set possibleLocations; + @Nullable + private WorldPoint lastWorldPoint; + + public HotColdSolver(Set possibleLocations) + { + this.possibleLocations = possibleLocations; + } + + /** + * Process a hot-cold update given a {@link WorldPoint} where a check occurred and the resulting temperature and + * temperature change discovered at that point. This will filter the set of possible locations which can be the + * solution. + * + * @param worldPoint The point where a hot-cold check occurred + * @param temperature The temperature of the checked point + * @param temperatureChange The change of temperature of the checked point compared to the previously-checked point + * @return A set of {@link HotColdLocation}s which are still possible after the filtering occurs. This return value + * is the same as would be returned by {@code getPossibleLocations()}. + */ + public Set signal(@Nonnull final WorldPoint worldPoint, @Nonnull final HotColdTemperature temperature, @Nullable final HotColdTemperatureChange temperatureChange) + { + // when the strange device reads a temperature, that means that the center of the final dig location + // is a range of squares away from the player's current location (Chebyshev AKA Chess-board distance) + int maxSquaresAway = temperature.getMaxDistance(); + int minSquaresAway = temperature.getMinDistance(); + + // maxDistanceArea encompasses all of the points that are within the max possible distance from the player + final Rectangle maxDistanceArea = new Rectangle( + worldPoint.getX() - maxSquaresAway, + worldPoint.getY() - maxSquaresAway, + 2 * maxSquaresAway + 1, + 2 * maxSquaresAway + 1); + // minDistanceArea encompasses all of the points that are within the min possible distance from the player + final Rectangle minDistanceArea = new Rectangle( + worldPoint.getX() - minSquaresAway, + worldPoint.getY() - minSquaresAway, + 2 * minSquaresAway + 1, + 2 * minSquaresAway + 1); + + // eliminate from consideration dig spots that lie entirely within the min range or entirely outside of the max range + possibleLocations.removeIf(entry -> minDistanceArea.contains(entry.getRect()) || !maxDistanceArea.intersects(entry.getRect())); + + // if a previous world point has been recorded, we can consider the warmer/colder result from the strange device + if (lastWorldPoint != null && temperatureChange != null) + { + switch (temperatureChange) + { + case COLDER: + // eliminate spots that are absolutely warmer + possibleLocations.removeIf(entry -> isFirstPointCloserRect(worldPoint, lastWorldPoint, entry.getRect())); + break; + case WARMER: + // eliminate spots that are absolutely colder + possibleLocations.removeIf(entry -> isFirstPointCloserRect(lastWorldPoint, worldPoint, entry.getRect())); + break; + case SAME: + // I couldn't figure out a clean implementation for this case + // not necessary for quickly determining final location + } + } + + lastWorldPoint = worldPoint; + return getPossibleLocations(); + } + + /** + * Determines whether the first point passed is closer to each corner of the given rectangle than the second point. + * + * @param firstPoint First point to test. Return result will be relating to this point's location. + * @param secondPoint Second point to test + * @param rect Rectangle, whose corner points will be compared to the first and second points passed + * @return {@code true} if {@code firstPoint} is closer to each of {@code rect}'s four corner points than + * {@code secondPoint}, {@code false} otherwise. + * @see WorldPoint#distanceTo2D + */ + @VisibleForTesting + static boolean isFirstPointCloserRect(final WorldPoint firstPoint, final WorldPoint secondPoint, final Rectangle rect) + { + final WorldPoint nePoint = new WorldPoint((rect.x + rect.width), (rect.y + rect.height), 0); + + if (!isFirstPointCloser(firstPoint, secondPoint, nePoint)) + { + return false; + } + + final WorldPoint sePoint = new WorldPoint((rect.x + rect.width), rect.y, 0); + + if (!isFirstPointCloser(firstPoint, secondPoint, sePoint)) + { + return false; + } + + final WorldPoint nwPoint = new WorldPoint(rect.x, (rect.y + rect.height), 0); + + if (!isFirstPointCloser(firstPoint, secondPoint, nwPoint)) + { + return false; + } + + final WorldPoint swPoint = new WorldPoint(rect.x, rect.y, 0); + return (isFirstPointCloser(firstPoint, secondPoint, swPoint)); + } + + /** + * Determines whether the first point passed is closer to the given point of comparison than the second point. + * + * @param firstPoint First point to test. Return result will be relating to this point's location. + * @param secondPoint Second point to test + * @param worldPoint Point to compare to the first and second points passed + * @return {@code true} if {@code firstPoint} is closer to {@code worldPoint} than {@code secondPoint}, + * {@code false} otherwise. + * @see WorldPoint#distanceTo2D + */ + @VisibleForTesting + static boolean isFirstPointCloser(final WorldPoint firstPoint, final WorldPoint secondPoint, final WorldPoint worldPoint) + { + return firstPoint.distanceTo2D(worldPoint) < secondPoint.distanceTo2D(worldPoint); + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdTemperature.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdTemperature.java new file mode 100644 index 0000000000..2dc5909000 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdTemperature.java @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2019, Jordan Atwood + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.cluescrolls.clues.hotcold; + +import com.google.common.collect.Sets; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; +import java.util.Set; +import javax.annotation.Nullable; +import lombok.AllArgsConstructor; +import lombok.Getter; + +@AllArgsConstructor +@Getter +public enum HotColdTemperature +{ + ICE_COLD("ice cold", 500, 5000), + VERY_COLD("very cold", 200, 499), + COLD("cold", 150, 199), + WARM("warm", 100, 149), + HOT("hot", 70, 99), + VERY_HOT("very hot", 30, 69), + BEGINNER_INCREDIBLY_HOT("incredibly hot", 4, 29), + BEGINNER_VISIBLY_SHAKING("visibly shaking", 0, 3), + MASTER_INCREDIBLY_HOT("incredibly hot", 5, 29), + MASTER_VISIBLY_SHAKING("visibly shaking", 0, 4); + + public static final Set BEGINNER_HOT_COLD_TEMPERATURES = Sets.immutableEnumSet( + ICE_COLD, + VERY_COLD, + COLD, + WARM, + HOT, + VERY_HOT, + BEGINNER_INCREDIBLY_HOT, + BEGINNER_VISIBLY_SHAKING + ); + public static final Set MASTER_HOT_COLD_TEMPERATURES = Sets.immutableEnumSet( + ICE_COLD, + VERY_COLD, + COLD, + WARM, + HOT, + VERY_HOT, + MASTER_INCREDIBLY_HOT, + MASTER_VISIBLY_SHAKING + ); + + private final String text; + private final int minDistance; + private final int maxDistance; + + private static final String DEVICE_USED_START_TEXT = "The device is "; + + /** + * Gets the temperature from a set of temperatures corresponding to the passed string. + * + * @param temperatureSet A set of temperature values to select from + * @param message A string containing a temperature value + * @return The corresponding enum from the given temperature set. + *

    + * Note that in cases where two temperature values in the given set are equally likely to be the given + * temperature (say, two temperatures with identical text values), the behavior is undefined. + */ + @Nullable + public static HotColdTemperature getFromTemperatureSet(final Set temperatureSet, final String message) + { + if (!message.startsWith(DEVICE_USED_START_TEXT) || temperatureSet == null) + { + return null; + } + + final List possibleTemperatures = new ArrayList<>(); + + for (final HotColdTemperature temperature : temperatureSet) + { + if (message.contains(temperature.getText())) + { + possibleTemperatures.add(temperature); + } + } + + return possibleTemperatures.stream() + // For messages such as "The device is very cold", this will choose the Enum with text of greatest length so + // that VERY_COLD would be selected over COLD, though both Enums have matching text for this message. + .max(Comparator.comparingInt(x -> (x.getText()).length())) + .orElse(null); + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdTemperatureChange.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdTemperatureChange.java new file mode 100644 index 0000000000..e9077bc9e1 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdTemperatureChange.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2019, Jordan Atwood + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.cluescrolls.clues.hotcold; + +import lombok.AllArgsConstructor; + +@AllArgsConstructor +public enum HotColdTemperatureChange +{ + WARMER("and warmer than"), + SAME("and the same temperature as"), + COLDER("but colder than"); + + private final String text; + + public static HotColdTemperatureChange of(final String message) + { + if (!message.endsWith(" last time.")) + { + return null; + } + + for (final HotColdTemperatureChange change : values()) + { + if (message.contains(change.text)) + { + return change; + } + } + + return null; + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeConfig.java index 18b9d6386b..a822cf74a8 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeConfig.java @@ -173,10 +173,10 @@ public interface ItemChargeConfig extends Config } @ConfigItem( - keyName = "showBellowCharges", - name = "Show Bellow Charges", - description = "Configures if ogre bellow item charge is shown", - position = 12 + keyName = "showBellowCharges", + name = "Show Bellow Charges", + description = "Configures if ogre bellow item charge is shown", + position = 12 ) default boolean showBellowCharges() { @@ -184,10 +184,32 @@ public interface ItemChargeConfig extends Config } @ConfigItem( - keyName = "showAbyssalBraceletCharges", - name = "Show Abyssal Bracelet Charges", - description = "Configures if abyssal bracelet item charge is shown", - position = 13 + keyName = "showBasketCharges", + name = "Show Basket Charges", + description = "Configures if fruit basket item charge is shown", + position = 13 + ) + default boolean showBasketCharges() + { + return true; + } + + @ConfigItem( + keyName = "showSackCharges", + name = "Show Sack Charges", + description = "Configures if sack item charge is shown", + position = 14 + ) + default boolean showSackCharges() + { + return true; + } + + @ConfigItem( + keyName = "showAbyssalBraceletCharges", + name = "Show Abyssal Bracelet Charges", + description = "Configures if abyssal bracelet item charge is shown", + position = 15 ) default boolean showAbyssalBraceletCharges() { @@ -198,7 +220,7 @@ public interface ItemChargeConfig extends Config keyName = "recoilNotification", name = "Ring of Recoil Notification", description = "Configures if the ring of recoil breaking notification is shown", - position = 14 + position = 16 ) default boolean recoilNotification() { @@ -209,7 +231,7 @@ public interface ItemChargeConfig extends Config keyName = "showBindingNecklaceCharges", name = "Show Binding Necklace Charges", description = "Configures if binding necklace item charge is shown", - position = 15 + position = 17 ) default boolean showBindingNecklaceCharges() { @@ -238,7 +260,7 @@ public interface ItemChargeConfig extends Config keyName = "bindingNotification", name = "Binding Necklace Notification", description = "Configures if the binding necklace breaking notification is shown", - position = 16 + position = 18 ) default boolean bindingNotification() { @@ -249,7 +271,7 @@ public interface ItemChargeConfig extends Config keyName = "showExplorerRingCharges", name = "Show Explorer's Ring Alch Charges", description = "Configures if explorer's ring alchemy charges are shown", - position = 17 + position = 19 ) default boolean showExplorerRingCharges() { @@ -278,7 +300,7 @@ public interface ItemChargeConfig extends Config keyName = "showInfoboxes", name = "Show Infoboxes", description = "Configures whether to show an infobox equipped charge items", - position = 18 + position = 20 ) default boolean showInfoboxes() { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeOverlay.java index 32f92da25e..ec140e2749 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeOverlay.java @@ -38,6 +38,8 @@ import static net.runelite.client.plugins.itemcharges.ItemChargeType.IMPBOX; import static net.runelite.client.plugins.itemcharges.ItemChargeType.TELEPORT; import static net.runelite.client.plugins.itemcharges.ItemChargeType.WATERCAN; import static net.runelite.client.plugins.itemcharges.ItemChargeType.WATERSKIN; +import static net.runelite.client.plugins.itemcharges.ItemChargeType.FRUIT_BASKET; +import static net.runelite.client.plugins.itemcharges.ItemChargeType.SACK; import net.runelite.client.ui.FontManager; import net.runelite.client.ui.overlay.WidgetItemOverlay; import net.runelite.client.ui.overlay.components.TextComponent; @@ -152,6 +154,8 @@ class ItemChargeOverlay extends WidgetItemOverlay || (type == WATERCAN && !config.showWateringCanCharges()) || (type == WATERSKIN && !config.showWaterskinCharges()) || (type == BELLOWS && !config.showBellowCharges()) + || (type == FRUIT_BASKET && !config.showBasketCharges()) + || (type == SACK && !config.showSackCharges()) || (type == ABYSSAL_BRACELET && !config.showAbyssalBraceletCharges())) { return; @@ -172,6 +176,7 @@ class ItemChargeOverlay extends WidgetItemOverlay { return config.showTeleportCharges() || config.showDodgyCount() || config.showFungicideCharges() || config.showImpCharges() || config.showWateringCanCharges() || config.showWaterskinCharges() - || config.showBellowCharges() || config.showAbyssalBraceletCharges() || config.showExplorerRingCharges(); + || config.showBellowCharges() || config.showBasketCharges() || config.showSackCharges() + || config.showAbyssalBraceletCharges() || config.showExplorerRingCharges(); } } \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeType.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeType.java index 3d131aec20..e219bae493 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeType.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeType.java @@ -37,5 +37,7 @@ enum ItemChargeType BRACELET_OF_SLAUGHTER, EXPEDITIOUS_BRACELET, BINDING_NECKLACE, - EXPLORER_RING + EXPLORER_RING, + FRUIT_BASKET, + SACK } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemWithCharge.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemWithCharge.java index 2f2fe76469..9e3113b85c 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemWithCharge.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemWithCharge.java @@ -29,133 +29,8 @@ import java.util.Map; import javax.annotation.Nullable; import lombok.AllArgsConstructor; import lombok.Getter; -import static net.runelite.api.ItemID.ABYSSAL_BRACELET1; -import static net.runelite.api.ItemID.ABYSSAL_BRACELET2; -import static net.runelite.api.ItemID.ABYSSAL_BRACELET3; -import static net.runelite.api.ItemID.ABYSSAL_BRACELET4; -import static net.runelite.api.ItemID.ABYSSAL_BRACELET5; -import static net.runelite.api.ItemID.AMULET_OF_GLORY1; -import static net.runelite.api.ItemID.AMULET_OF_GLORY2; -import static net.runelite.api.ItemID.AMULET_OF_GLORY3; -import static net.runelite.api.ItemID.AMULET_OF_GLORY4; -import static net.runelite.api.ItemID.AMULET_OF_GLORY5; -import static net.runelite.api.ItemID.AMULET_OF_GLORY6; -import static net.runelite.api.ItemID.AMULET_OF_GLORY_T1; -import static net.runelite.api.ItemID.AMULET_OF_GLORY_T2; -import static net.runelite.api.ItemID.AMULET_OF_GLORY_T3; -import static net.runelite.api.ItemID.AMULET_OF_GLORY_T4; -import static net.runelite.api.ItemID.AMULET_OF_GLORY_T5; -import static net.runelite.api.ItemID.AMULET_OF_GLORY_T6; -import static net.runelite.api.ItemID.BURNING_AMULET1; -import static net.runelite.api.ItemID.BURNING_AMULET2; -import static net.runelite.api.ItemID.BURNING_AMULET3; -import static net.runelite.api.ItemID.BURNING_AMULET4; -import static net.runelite.api.ItemID.BURNING_AMULET5; -import static net.runelite.api.ItemID.COMBAT_BRACELET1; -import static net.runelite.api.ItemID.COMBAT_BRACELET2; -import static net.runelite.api.ItemID.COMBAT_BRACELET3; -import static net.runelite.api.ItemID.COMBAT_BRACELET4; -import static net.runelite.api.ItemID.COMBAT_BRACELET5; -import static net.runelite.api.ItemID.COMBAT_BRACELET6; -import static net.runelite.api.ItemID.DIGSITE_PENDANT_1; -import static net.runelite.api.ItemID.DIGSITE_PENDANT_2; -import static net.runelite.api.ItemID.DIGSITE_PENDANT_3; -import static net.runelite.api.ItemID.DIGSITE_PENDANT_4; -import static net.runelite.api.ItemID.DIGSITE_PENDANT_5; -import static net.runelite.api.ItemID.ENCHANTED_LYRE1; -import static net.runelite.api.ItemID.ENCHANTED_LYRE2; -import static net.runelite.api.ItemID.ENCHANTED_LYRE3; -import static net.runelite.api.ItemID.ENCHANTED_LYRE4; -import static net.runelite.api.ItemID.ENCHANTED_LYRE5; -import static net.runelite.api.ItemID.FUNGICIDE_SPRAY_0; -import static net.runelite.api.ItemID.FUNGICIDE_SPRAY_1; -import static net.runelite.api.ItemID.FUNGICIDE_SPRAY_10; -import static net.runelite.api.ItemID.FUNGICIDE_SPRAY_2; -import static net.runelite.api.ItemID.FUNGICIDE_SPRAY_3; -import static net.runelite.api.ItemID.FUNGICIDE_SPRAY_4; -import static net.runelite.api.ItemID.FUNGICIDE_SPRAY_5; -import static net.runelite.api.ItemID.FUNGICIDE_SPRAY_6; -import static net.runelite.api.ItemID.FUNGICIDE_SPRAY_7; -import static net.runelite.api.ItemID.FUNGICIDE_SPRAY_8; -import static net.runelite.api.ItemID.FUNGICIDE_SPRAY_9; -import static net.runelite.api.ItemID.GAMES_NECKLACE1; -import static net.runelite.api.ItemID.GAMES_NECKLACE2; -import static net.runelite.api.ItemID.GAMES_NECKLACE3; -import static net.runelite.api.ItemID.GAMES_NECKLACE4; -import static net.runelite.api.ItemID.GAMES_NECKLACE5; -import static net.runelite.api.ItemID.GAMES_NECKLACE6; -import static net.runelite.api.ItemID.GAMES_NECKLACE7; -import static net.runelite.api.ItemID.GAMES_NECKLACE8; -import static net.runelite.api.ItemID.IMPINABOX1; -import static net.runelite.api.ItemID.IMPINABOX2; -import static net.runelite.api.ItemID.NECKLACE_OF_PASSAGE1; -import static net.runelite.api.ItemID.NECKLACE_OF_PASSAGE2; -import static net.runelite.api.ItemID.NECKLACE_OF_PASSAGE3; -import static net.runelite.api.ItemID.NECKLACE_OF_PASSAGE4; -import static net.runelite.api.ItemID.NECKLACE_OF_PASSAGE5; -import static net.runelite.api.ItemID.OGRE_BELLOWS; -import static net.runelite.api.ItemID.OGRE_BELLOWS_1; -import static net.runelite.api.ItemID.OGRE_BELLOWS_2; -import static net.runelite.api.ItemID.OGRE_BELLOWS_3; -import static net.runelite.api.ItemID.PHARAOHS_SCEPTRE_1; -import static net.runelite.api.ItemID.PHARAOHS_SCEPTRE_2; -import static net.runelite.api.ItemID.PHARAOHS_SCEPTRE_3; -import static net.runelite.api.ItemID.PHARAOHS_SCEPTRE_4; -import static net.runelite.api.ItemID.PHARAOHS_SCEPTRE_5; -import static net.runelite.api.ItemID.PHARAOHS_SCEPTRE_6; -import static net.runelite.api.ItemID.PHARAOHS_SCEPTRE_7; -import static net.runelite.api.ItemID.PHARAOHS_SCEPTRE_8; -import static net.runelite.api.ItemID.RING_OF_DUELING1; -import static net.runelite.api.ItemID.RING_OF_DUELING2; -import static net.runelite.api.ItemID.RING_OF_DUELING3; -import static net.runelite.api.ItemID.RING_OF_DUELING4; -import static net.runelite.api.ItemID.RING_OF_DUELING5; -import static net.runelite.api.ItemID.RING_OF_DUELING6; -import static net.runelite.api.ItemID.RING_OF_DUELING7; -import static net.runelite.api.ItemID.RING_OF_DUELING8; -import static net.runelite.api.ItemID.RING_OF_RETURNING1; -import static net.runelite.api.ItemID.RING_OF_RETURNING2; -import static net.runelite.api.ItemID.RING_OF_RETURNING3; -import static net.runelite.api.ItemID.RING_OF_RETURNING4; -import static net.runelite.api.ItemID.RING_OF_RETURNING5; -import static net.runelite.api.ItemID.RING_OF_WEALTH_1; -import static net.runelite.api.ItemID.RING_OF_WEALTH_2; -import static net.runelite.api.ItemID.RING_OF_WEALTH_3; -import static net.runelite.api.ItemID.RING_OF_WEALTH_4; -import static net.runelite.api.ItemID.RING_OF_WEALTH_5; -import static net.runelite.api.ItemID.SKILLS_NECKLACE1; -import static net.runelite.api.ItemID.SKILLS_NECKLACE2; -import static net.runelite.api.ItemID.SKILLS_NECKLACE3; -import static net.runelite.api.ItemID.SKILLS_NECKLACE4; -import static net.runelite.api.ItemID.SKILLS_NECKLACE5; -import static net.runelite.api.ItemID.SKILLS_NECKLACE6; -import static net.runelite.api.ItemID.SLAYER_RING_1; -import static net.runelite.api.ItemID.SLAYER_RING_2; -import static net.runelite.api.ItemID.SLAYER_RING_3; -import static net.runelite.api.ItemID.SLAYER_RING_4; -import static net.runelite.api.ItemID.SLAYER_RING_5; -import static net.runelite.api.ItemID.SLAYER_RING_6; -import static net.runelite.api.ItemID.SLAYER_RING_7; -import static net.runelite.api.ItemID.SLAYER_RING_8; -import static net.runelite.api.ItemID.TELEPORT_CRYSTAL_1; -import static net.runelite.api.ItemID.TELEPORT_CRYSTAL_2; -import static net.runelite.api.ItemID.TELEPORT_CRYSTAL_3; -import static net.runelite.api.ItemID.TELEPORT_CRYSTAL_4; -import static net.runelite.api.ItemID.TELEPORT_CRYSTAL_5; -import static net.runelite.api.ItemID.WATERING_CAN; -import static net.runelite.api.ItemID.WATERING_CAN1; -import static net.runelite.api.ItemID.WATERING_CAN2; -import static net.runelite.api.ItemID.WATERING_CAN3; -import static net.runelite.api.ItemID.WATERING_CAN4; -import static net.runelite.api.ItemID.WATERING_CAN5; -import static net.runelite.api.ItemID.WATERING_CAN6; -import static net.runelite.api.ItemID.WATERING_CAN7; -import static net.runelite.api.ItemID.WATERING_CAN8; -import static net.runelite.api.ItemID.WATERSKIN0; -import static net.runelite.api.ItemID.WATERSKIN1; -import static net.runelite.api.ItemID.WATERSKIN2; -import static net.runelite.api.ItemID.WATERSKIN3; -import static net.runelite.api.ItemID.WATERSKIN4; + +import static net.runelite.api.ItemID.*; import static net.runelite.client.plugins.itemcharges.ItemChargeType.ABYSSAL_BRACELET; import static net.runelite.client.plugins.itemcharges.ItemChargeType.BELLOWS; import static net.runelite.client.plugins.itemcharges.ItemChargeType.FUNGICIDE_SPRAY; @@ -163,6 +38,8 @@ import static net.runelite.client.plugins.itemcharges.ItemChargeType.IMPBOX; import static net.runelite.client.plugins.itemcharges.ItemChargeType.TELEPORT; import static net.runelite.client.plugins.itemcharges.ItemChargeType.WATERCAN; import static net.runelite.client.plugins.itemcharges.ItemChargeType.WATERSKIN; +import static net.runelite.client.plugins.itemcharges.ItemChargeType.FRUIT_BASKET; +import static net.runelite.client.plugins.itemcharges.ItemChargeType.SACK; @AllArgsConstructor @Getter @@ -173,6 +50,31 @@ enum ItemWithCharge ABRACE3(ABYSSAL_BRACELET, ABYSSAL_BRACELET3, 3), ABRACE4(ABYSSAL_BRACELET, ABYSSAL_BRACELET4, 4), ABRACE5(ABYSSAL_BRACELET, ABYSSAL_BRACELET5, 5), + BASKET_APPLES1(FRUIT_BASKET, APPLES1, 1), + BASKET_APPLES2(FRUIT_BASKET, APPLES2, 2), + BASKET_APPLES3(FRUIT_BASKET, APPLES3, 3), + BASKET_APPLES4(FRUIT_BASKET, APPLES4, 4), + BASKET_APPLES5(FRUIT_BASKET, APPLES5, 5), + BASKET_BANANAS1(FRUIT_BASKET, BANANAS1, 1), + BASKET_BANANAS2(FRUIT_BASKET, BANANAS2, 2), + BASKET_BANANAS3(FRUIT_BASKET, BANANAS3, 3), + BASKET_BANANAS4(FRUIT_BASKET, BANANAS4, 4), + BASKET_BANANAS5(FRUIT_BASKET, BANANAS5, 5), + BASKET_ORANGES1(FRUIT_BASKET, ORANGES1, 1), + BASKET_ORANGES2(FRUIT_BASKET, ORANGES2, 2), + BASKET_ORANGES3(FRUIT_BASKET, ORANGES3, 3), + BASKET_ORANGES4(FRUIT_BASKET, ORANGES4, 4), + BASKET_ORANGES5(FRUIT_BASKET, ORANGES5, 5), + BASKET_STRAWBERRIES1(FRUIT_BASKET, STRAWBERRIES1, 1), + BASKET_STRAWBERRIES2(FRUIT_BASKET, STRAWBERRIES2, 2), + BASKET_STRAWBERRIES3(FRUIT_BASKET, STRAWBERRIES3, 3), + BASKET_STRAWBERRIES4(FRUIT_BASKET, STRAWBERRIES4, 4), + BASKET_STRAWBERRIES5(FRUIT_BASKET, STRAWBERRIES5, 5), + BASKET_TOMATOES1(FRUIT_BASKET, TOMATOES1, 1), + BASKET_TOMATOES2(FRUIT_BASKET, TOMATOES2, 2), + BASKET_TOMATOES3(FRUIT_BASKET, TOMATOES3, 3), + BASKET_TOMATOES4(FRUIT_BASKET, TOMATOES4, 4), + BASKET_TOMATOES5(FRUIT_BASKET, TOMATOES5, 5), BELLOWS0(BELLOWS, OGRE_BELLOWS, 0), BELLOWS1(BELLOWS, OGRE_BELLOWS_1, 1), BELLOWS2(BELLOWS, OGRE_BELLOWS_2, 2), @@ -270,6 +172,36 @@ enum ItemWithCharge ROW3(TELEPORT, RING_OF_WEALTH_3, 3), ROW4(TELEPORT, RING_OF_WEALTH_4, 4), ROW5(TELEPORT, RING_OF_WEALTH_5, 5), + SACK_CABBAGES1(SACK, CABBAGES1, 1), + SACK_CABBAGES2(SACK, CABBAGES2, 2), + SACK_CABBAGES3(SACK, CABBAGES3, 3), + SACK_CABBAGES4(SACK, CABBAGES4, 4), + SACK_CABBAGES5(SACK, CABBAGES5, 5), + SACK_CABBAGES6(SACK, CABBAGES6, 6), + SACK_CABBAGES7(SACK, CABBAGES7, 7), + SACK_CABBAGES8(SACK, CABBAGES8, 8), + SACK_CABBAGES9(SACK, CABBAGES9, 9), + SACK_CABBAGES10(SACK, CABBAGES10, 10), + SACK_ONIONS1(SACK, ONIONS1, 1), + SACK_ONIONS2(SACK, ONIONS2, 2), + SACK_ONIONS3(SACK, ONIONS3, 3), + SACK_ONIONS4(SACK, ONIONS4, 4), + SACK_ONIONS5(SACK, ONIONS5, 5), + SACK_ONIONS6(SACK, ONIONS6, 6), + SACK_ONIONS7(SACK, ONIONS7, 7), + SACK_ONIONS8(SACK, ONIONS8, 8), + SACK_ONIONS9(SACK, ONIONS9, 9), + SACK_ONIONS10(SACK, ONIONS10, 10), + SACK_POTATOES1(SACK, POTATOES1, 1), + SACK_POTATOES2(SACK, POTATOES2, 2), + SACK_POTATOES3(SACK, POTATOES3, 3), + SACK_POTATOES4(SACK, POTATOES4, 4), + SACK_POTATOES5(SACK, POTATOES5, 5), + SACK_POTATOES6(SACK, POTATOES6, 6), + SACK_POTATOES7(SACK, POTATOES7, 7), + SACK_POTATOES8(SACK, POTATOES8, 8), + SACK_POTATOES9(SACK, POTATOES9, 9), + SACK_POTATOES10(SACK, POTATOES10, 10), SKILLS1(TELEPORT, SKILLS_NECKLACE1, 1), SKILLS2(TELEPORT, SKILLS_NECKLACE2, 2), SKILLS3(TELEPORT, SKILLS_NECKLACE3, 3), diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java index e6497432aa..e90c97acdc 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java @@ -1690,4 +1690,4 @@ default CharterOption charterOption() { return true; } -} +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ui/ScreenMarkerPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ui/ScreenMarkerPanel.java index d225410209..23b6cad174 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ui/ScreenMarkerPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ui/ScreenMarkerPanel.java @@ -29,6 +29,8 @@ import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.WindowAdapter; @@ -169,12 +171,7 @@ class ScreenMarkerPanel extends JPanel @Override public void mousePressed(MouseEvent mouseEvent) { - marker.getMarker().setName(nameInput.getText()); - plugin.updateConfig(); - - nameInput.setEditable(false); - updateNameActions(false); - requestFocusInWindow(); + save(); } @Override @@ -198,10 +195,7 @@ class ScreenMarkerPanel extends JPanel @Override public void mousePressed(MouseEvent mouseEvent) { - nameInput.setEditable(false); - nameInput.setText(marker.getMarker().getName()); - updateNameActions(false); - requestFocusInWindow(); + cancel(); } @Override @@ -252,6 +246,35 @@ class ScreenMarkerPanel extends JPanel nameInput.setPreferredSize(new Dimension(0, 24)); nameInput.getTextField().setForeground(Color.WHITE); nameInput.getTextField().setBorder(new EmptyBorder(0, 8, 0, 0)); + nameInput.addKeyListener(new KeyAdapter() + { + @Override + public void keyPressed(KeyEvent e) + { + if (e.getKeyCode() == KeyEvent.VK_ENTER) + { + save(); + } + else if (e.getKeyCode() == KeyEvent.VK_ESCAPE) + { + cancel(); + } + } + }); + nameInput.getTextField().addMouseListener(new MouseAdapter() + { + @Override + public void mouseEntered(MouseEvent mouseEvent) + { + preview(true); + } + + @Override + public void mouseExited(MouseEvent mouseEvent) + { + preview(false); + } + }); nameWrapper.add(nameInput, BorderLayout.CENTER); nameWrapper.add(nameActions, BorderLayout.EAST); @@ -359,10 +382,7 @@ class ScreenMarkerPanel extends JPanel @Override public void mousePressed(MouseEvent mouseEvent) { - visible = !visible; - marker.getMarker().setVisible(visible); - plugin.updateConfig(); - updateVisibility(); + toggle(!visible); } @Override @@ -424,6 +444,42 @@ class ScreenMarkerPanel extends JPanel } + private void preview(boolean on) + { + if (visible) + { + return; + } + + marker.getMarker().setVisible(on); + } + + private void toggle(boolean on) + { + visible = on; + marker.getMarker().setVisible(visible); + plugin.updateConfig(); + updateVisibility(); + } + + private void save() + { + marker.getMarker().setName(nameInput.getText()); + plugin.updateConfig(); + + nameInput.setEditable(false); + updateNameActions(false); + requestFocusInWindow(); + } + + private void cancel() + { + nameInput.setEditable(false); + nameInput.setText(marker.getMarker().getName()); + updateNameActions(false); + requestFocusInWindow(); + } + private void updateNameActions(boolean saveAndCancel) { save.setVisible(saveAndCancel); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldHopperPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldHopperPlugin.java index 84abfcf9f5..0dce1c78b5 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldHopperPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldHopperPlugin.java @@ -97,7 +97,7 @@ public class WorldHopperPlugin extends Plugin { private static final int WORLD_FETCH_TIMER = 10; private static final int WORLD_PING_TIMER = 10; - private static final int REFRESH_THROTTLE = 60_000; // ms + private static final int REFRESH_THROTTLE = 60_000; // ms private static final int TICK_THROTTLE = (int) Duration.ofMinutes(10).toMillis(); private static final int DISPLAY_SWITCHER_MAX_ATTEMPTS = 3; diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/BeginnerHotColdLocationTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/BeginnerHotColdLocationTest.java new file mode 100644 index 0000000000..d67a00b989 --- /dev/null +++ b/runelite-client/src/test/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/BeginnerHotColdLocationTest.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2019, Jordan Atwood + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.cluescrolls.clues.hotcold; + +import java.util.Arrays; +import java.util.Set; +import java.util.stream.Collectors; +import static org.junit.Assert.assertEquals; +import org.junit.Test; + +public class BeginnerHotColdLocationTest +{ + private static final Set BEGINNER_HOT_COLD_LOCATIONS = Arrays.stream(HotColdLocation.values()) + .filter(HotColdLocation::isBeginnerClue) + .collect(Collectors.toSet()); + private static final int EXPECTED_DIMENSION_SIZE = 7; + + @Test + public void beginnerHotColdLocationAreaTest() + { + + for (final HotColdLocation location : BEGINNER_HOT_COLD_LOCATIONS) + { + assertEquals(EXPECTED_DIMENSION_SIZE, location.getRect().height); + assertEquals(EXPECTED_DIMENSION_SIZE, location.getRect().width); + } + } +} diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdSolverTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdSolverTest.java new file mode 100644 index 0000000000..a5c4cc4e31 --- /dev/null +++ b/runelite-client/src/test/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdSolverTest.java @@ -0,0 +1,259 @@ +/* + * Copyright (c) 2019, Jordan Atwood + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.cluescrolls.clues.hotcold; + +import com.google.common.collect.Sets; +import java.awt.Rectangle; +import java.util.EnumSet; +import java.util.Set; +import java.util.stream.Collectors; +import static junit.framework.TestCase.assertTrue; +import net.runelite.api.coords.WorldPoint; +import static net.runelite.client.plugins.cluescrolls.clues.hotcold.HotColdSolver.isFirstPointCloser; +import static net.runelite.client.plugins.cluescrolls.clues.hotcold.HotColdSolver.isFirstPointCloserRect; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import org.junit.Test; + +public class HotColdSolverTest +{ + private static final String RESPONSE_TEXT_ICE_COLD_COLDER = "The device is ice cold, but colder than last time."; + private static final String RESPONSE_TEXT_VERY_COLD_WARMER = "The device is very cold, and warmer than last time."; + private static final String RESPONSE_TEXT_COLD = "The device is cold."; + private static final String RESPONSE_TEXT_COLD_COLDER = "The device is cold, but colder than last time."; + private static final String RESPONSE_TEXT_COLD_WARMER = "The device is cold, and warmer than last time."; + private static final String RESPONSE_TEXT_COLD_SAME_TEMP = "The device is cold, and the same temperature as last time."; + private static final String RESPONSE_TEXT_VERY_HOT = "The device is very hot."; + private static final String RESPONSE_TEXT_VERY_HOT_COLDER = "The device is very hot, but colder than last time."; + private static final String RESPONSE_TEXT_VERY_HOT_WARMER = "The device is very hot, and warmer than last time."; + private static final String RESPONSE_TEXT_VERY_HOT_SAME_TEMP = "The device is very hot, and the same temperature as last time."; + + @Test + public void testOneStepSolution() + { + final Set foundLocation = Sets.immutableEnumSet(HotColdLocation.KARAMJA_KHARAZI_NE); + + testSolver(createHotColdSolver(), new WorldPoint(2852, 2992, 0), RESPONSE_TEXT_VERY_HOT, foundLocation); + } + + @Test + public void testIgnoreStartingTemperatureDifference() + { + final WorldPoint testedPoint = new WorldPoint(2852, 2992, 0); + final Set foundLocations = Sets.immutableEnumSet(HotColdLocation.KARAMJA_KHARAZI_NE); + + testSolver(createHotColdSolver(), testedPoint, RESPONSE_TEXT_VERY_HOT, foundLocations); + testSolver(createHotColdSolver(), testedPoint, RESPONSE_TEXT_VERY_HOT_COLDER, foundLocations); + testSolver(createHotColdSolver(), testedPoint, RESPONSE_TEXT_VERY_HOT_WARMER, foundLocations); + testSolver(createHotColdSolver(), testedPoint, RESPONSE_TEXT_VERY_HOT_SAME_TEMP, foundLocations); + } + + @Test + public void testSameTempNoChanges() + { + final HotColdSolver solver = createHotColdSolver(); + final WorldPoint testedPoint = new WorldPoint(2851, 2955, 0); + final Set foundLocations = Sets.immutableEnumSet( + HotColdLocation.KARAMJA_KHARAZI_NE, + HotColdLocation.KARAMJA_KHARAZI_SW); + + testSolver(solver, testedPoint, RESPONSE_TEXT_VERY_HOT, foundLocations); + testSolver(solver, testedPoint, RESPONSE_TEXT_VERY_HOT_SAME_TEMP, foundLocations); + } + + @Test + public void testNoChangesAfterSolutionFound() + { + final HotColdSolver solver = createHotColdSolver(); + final Set intermediateFoundLocations = Sets.immutableEnumSet( + HotColdLocation.KARAMJA_KHARAZI_NE, + HotColdLocation.KARAMJA_KHARAZI_SW); + final Set finalLocation = Sets.immutableEnumSet(HotColdLocation.KARAMJA_KHARAZI_NE); + + testSolver(solver, new WorldPoint(2851, 2955, 0), RESPONSE_TEXT_VERY_HOT, intermediateFoundLocations); + testSolver(solver, new WorldPoint(2852, 2955, 0), RESPONSE_TEXT_VERY_HOT_WARMER, finalLocation); + testSolver(solver, new WorldPoint(2851, 2955, 0), RESPONSE_TEXT_VERY_HOT_COLDER, finalLocation); + testSolver(solver, new WorldPoint(2465, 3495, 0), RESPONSE_TEXT_ICE_COLD_COLDER, finalLocation); + testSolver(solver, new WorldPoint(3056, 3291, 0), RESPONSE_TEXT_VERY_COLD_WARMER, finalLocation); + testSolver(solver, new WorldPoint(2571, 2956, 0), RESPONSE_TEXT_VERY_COLD_WARMER, finalLocation); + } + + @Test + public void testNarrowToFindSolutions() + { + final HotColdSolver solver = createHotColdSolver(); + final Set firstLocationsSet = Sets.immutableEnumSet( + HotColdLocation.FELDIP_HILLS_GNOME_GLITER, + HotColdLocation.FELDIP_HILLS_RED_CHIN, + HotColdLocation.KARAMJA_KHARAZI_NE, + HotColdLocation.KARAMJA_CRASH_ISLAND); + final Set secondLocationsSet = firstLocationsSet.stream() + .filter(location -> location != HotColdLocation.FELDIP_HILLS_RED_CHIN) + .collect(Collectors.toSet()); + final Set thirdLocationSet = secondLocationsSet.stream() + .filter(location -> location != HotColdLocation.FELDIP_HILLS_GNOME_GLITER) + .collect(Collectors.toSet()); + final Set finalLocation = thirdLocationSet.stream() + .filter(location -> location != HotColdLocation.KARAMJA_CRASH_ISLAND) + .collect(Collectors.toSet()); + + testSolver(solver, new WorldPoint(2711, 2803, 0), RESPONSE_TEXT_COLD, firstLocationsSet); + testSolver(solver, new WorldPoint(2711, 2802, 0), RESPONSE_TEXT_COLD_SAME_TEMP, firstLocationsSet); + testSolver(solver, new WorldPoint(2716, 2802, 0), RESPONSE_TEXT_COLD_WARMER, secondLocationsSet); + testSolver(solver, new WorldPoint(2739, 2808, 0), RESPONSE_TEXT_COLD_WARMER, thirdLocationSet); + testSolver(solver, new WorldPoint(2810, 2757, 0), RESPONSE_TEXT_COLD_COLDER, finalLocation); + } + + @Test + public void testSomewhatDistantLocations() + { + // Activate device on Ape Atoll when solution point is HotColdLocation.KARAMJA_KHARAZI_NE + testSolver(createHotColdSolver(), new WorldPoint(2723, 2743, 0), RESPONSE_TEXT_COLD, + Sets.immutableEnumSet( + HotColdLocation.KARAMJA_KHARAZI_NE, + HotColdLocation.KARAMJA_KHARAZI_SW, + HotColdLocation.KARAMJA_CRASH_ISLAND, + HotColdLocation.FELDIP_HILLS_SW, + HotColdLocation.FELDIP_HILLS_RANTZ, + HotColdLocation.FELDIP_HILLS_RED_CHIN, + HotColdLocation.FELDIP_HILLS_SE)); + + // Activate device near fairy ring DKP when solution point is HotColdLocation.KARAMJA_KHARAZI_NE + testSolver(createHotColdSolver(), new WorldPoint(2900, 3111, 0), RESPONSE_TEXT_COLD, + Sets.immutableEnumSet( + HotColdLocation.KARAMJA_WEST_BRIMHAVEN, + HotColdLocation.KARAMJA_KHARAZI_NE, + HotColdLocation.ASGARNIA_COW, + HotColdLocation.ASGARNIA_CRAFT_GUILD, + HotColdLocation.KANDARIN_WITCHHAVEN, + HotColdLocation.MISTHALIN_DRAYNOR_BANK)); + + // Activate device on Mudskipper Point when solution point is HotColdLocation.KARAMJA_KHARAZI_NE + testSolver(createHotColdSolver(), new WorldPoint(2985, 3106, 0), RESPONSE_TEXT_COLD, + Sets.immutableEnumSet( + HotColdLocation.KARAMJA_BRIMHAVEN_FRUIT_TREE, + HotColdLocation.KARAMJA_KHARAZI_NE, + HotColdLocation.ASGARNIA_COW, + HotColdLocation.ASGARNIA_CRAFT_GUILD, + HotColdLocation.MISTHALIN_LUMBRIDGE_2, + HotColdLocation.DESERT_BEDABIN_CAMP)); + } + + @Test + public void testIsFirstPointCloserRect() + { + assertFalse(isFirstPointCloserRect(new WorldPoint(0, 0, 0), new WorldPoint(0, 0, 0), new Rectangle(0, 0, 1, 1))); + assertFalse(isFirstPointCloserRect(new WorldPoint(1, 0, 0), new WorldPoint(5, 0, 0), new Rectangle(2, 1, 5, 5))); + assertFalse(isFirstPointCloserRect(new WorldPoint(1, 0, 0), new WorldPoint(0, 0, 0), new Rectangle(2, 0, 1, 2))); + assertFalse(isFirstPointCloserRect(new WorldPoint(0, 0, 0), new WorldPoint(1, 1, 1), new Rectangle(2, 2, 2, 2))); + assertFalse(isFirstPointCloserRect(new WorldPoint(0, 0, 0), new WorldPoint(4, 4, 4), new Rectangle(1, 1, 2, 2))); + assertFalse(isFirstPointCloserRect(new WorldPoint(3, 2, 0), new WorldPoint(1, 5, 0), new Rectangle(0, 0, 4, 4))); + + assertTrue(isFirstPointCloserRect(new WorldPoint(1, 1, 0), new WorldPoint(0, 1, 0), new Rectangle(2, 0, 3, 2))); + assertTrue(isFirstPointCloserRect(new WorldPoint(4, 4, 0), new WorldPoint(1, 1, 0), new Rectangle(3, 3, 2, 2))); + assertTrue(isFirstPointCloserRect(new WorldPoint(3, 2, 0), new WorldPoint(7, 0, 0), new Rectangle(1, 3, 4, 2))); + + } + + @Test + public void testIsFirstPointCloser() + { + assertFalse(isFirstPointCloser(new WorldPoint(0, 0, 0), new WorldPoint(0, 0, 0), new WorldPoint(0, 0, 0))); + assertFalse(isFirstPointCloser(new WorldPoint(0, 0, 0), new WorldPoint(0, 0, 1), new WorldPoint(0, 0, 0))); + assertFalse(isFirstPointCloser(new WorldPoint(1, 0, 0), new WorldPoint(0, 0, 0), new WorldPoint(1, 1, 0))); + assertFalse(isFirstPointCloser(new WorldPoint(2, 2, 0), new WorldPoint(0, 0, 0), new WorldPoint(1, 1, 0))); + + assertTrue(isFirstPointCloser(new WorldPoint(1, 0, 0), new WorldPoint(0, 0, 0), new WorldPoint(2, 0, 0))); + assertTrue(isFirstPointCloser(new WorldPoint(1, 1, 0), new WorldPoint(1, 0, 0), new WorldPoint(2, 2, 0))); + assertTrue(isFirstPointCloser(new WorldPoint(1, 1, 1), new WorldPoint(0, 1, 0), new WorldPoint(1, 1, 0))); + } + + /** + * Tests a hot-cold solver by signalling a test point, temperature, and temperature change to it and asserting the + * resulting possible location set is equal to that of a given set of expected locations. + * + * @param solver The hot-cold solver to signal to. + *
    + * Note: This will mutate the passed solver, which is helpful for testing + * multiple sequential steps. + * @param testPoint The {@link WorldPoint} where the signal occurs. + * @param deviceResponse The string containing the temperature and temperature change which is + * given when the hot-cold checking device is activated. + * @param expectedRemainingPossibleLocations A {@link Set} of {@link HotColdLocation}s which is expected to be + * given by {@link HotColdSolver#getPossibleLocations()} after it receives + * the signal formed by the other given arguments. + */ + private static void testSolver(final HotColdSolver solver, final WorldPoint testPoint, final String deviceResponse, final Set expectedRemainingPossibleLocations) + { + final HotColdTemperature temperature = HotColdTemperature.getFromTemperatureSet(HotColdTemperature.MASTER_HOT_COLD_TEMPERATURES, deviceResponse); + final HotColdTemperatureChange temperatureChange = HotColdTemperatureChange.of(deviceResponse); + + assertNotNull(temperature); + assertEquals(expectedRemainingPossibleLocations, solver.signal(testPoint, temperature, temperatureChange)); + } + + /** + * @return A hot-cold solver with a starting set of master hot-cold locations nearby the KARAMJA_KHARAZI_NE + * location. {@link HotColdLocation#values()} is not used as it may change with future game updates, and + * such changes would break this test suite. + */ + private static HotColdSolver createHotColdSolver() + { + final Set hotColdLocations = EnumSet.of( + HotColdLocation.KARAMJA_KHARAZI_NE, + HotColdLocation.KARAMJA_KHARAZI_SW, + HotColdLocation.KARAMJA_GLIDER, + HotColdLocation.KARAMJA_MUSA_POINT, + HotColdLocation.KARAMJA_BRIMHAVEN_FRUIT_TREE, + HotColdLocation.KARAMJA_WEST_BRIMHAVEN, + HotColdLocation.KARAMJA_CRASH_ISLAND, + HotColdLocation.DESERT_BEDABIN_CAMP, + HotColdLocation.DESERT_MENAPHOS_GATE, + HotColdLocation.DESERT_POLLNIVNEACH, + HotColdLocation.DESERT_SHANTY, + HotColdLocation.MISTHALIN_LUMBRIDGE, + HotColdLocation.MISTHALIN_LUMBRIDGE_2, + HotColdLocation.MISTHALIN_DRAYNOR_BANK, + HotColdLocation.ASGARNIA_COW, + HotColdLocation.ASGARNIA_PARTY_ROOM, + HotColdLocation.ASGARNIA_CRAFT_GUILD, + HotColdLocation.ASGARNIA_RIMMINGTON, + HotColdLocation.ASGARNIA_MUDSKIPPER, + HotColdLocation.KANDARIN_WITCHHAVEN, + HotColdLocation.KANDARIN_NECRO_TOWER, + HotColdLocation.KANDARIN_FIGHT_ARENA, + HotColdLocation.KANDARIN_TREE_GNOME_VILLAGE, + HotColdLocation.FELDIP_HILLS_GNOME_GLITER, + HotColdLocation.FELDIP_HILLS_JIGGIG, + HotColdLocation.FELDIP_HILLS_RANTZ, + HotColdLocation.FELDIP_HILLS_RED_CHIN, + HotColdLocation.FELDIP_HILLS_SE, + HotColdLocation.FELDIP_HILLS_SOUTH, + HotColdLocation.FELDIP_HILLS_SW + ); + return new HotColdSolver(hotColdLocations); + } +} diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdTemperatureChangeTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdTemperatureChangeTest.java new file mode 100644 index 0000000000..9b7cdcaf3c --- /dev/null +++ b/runelite-client/src/test/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdTemperatureChangeTest.java @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2019, Jordan Atwood + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.cluescrolls.clues.hotcold; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import org.junit.Test; + +public class HotColdTemperatureChangeTest +{ + private static final String[] VALID_MESSAGES = { + "The device is warm, and warmer than last time.", + "The device is cold, but colder than last time.", + "The device is very hot, and the same temperature as last time.", + }; + private static final String[] INVALID_MESSAGES = { + "The device is cold.", + "The device is ice cold.", + "The device is very cold.", + "The device is hot.", + "The device is incredibly hot.", + "The device is an octopus, and is wetter than last time", + "foobar", + "a q p w", + "My feet are cold, I should put them in some lukewarm water, or run hot water over them.", + "and warmer than and colder than and the same temperature", + }; + + @Test + public void testValidTemperatureChangeMessages() + { + for (final String message : VALID_MESSAGES) + { + assertNotNull(message, HotColdTemperatureChange.of(message)); + } + } + + @Test + public void testInvalidTemperatureChangeMessages() + { + for (final String message : INVALID_MESSAGES) + { + assertNull(message, HotColdTemperatureChange.of(message)); + } + } +} diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdTemperatureTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdTemperatureTest.java new file mode 100644 index 0000000000..e9711dc433 --- /dev/null +++ b/runelite-client/src/test/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdTemperatureTest.java @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2019, Jordan Atwood + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.cluescrolls.clues.hotcold; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import org.junit.Test; + +public class HotColdTemperatureTest +{ + private static final String[] VALID_MESSAGES = { + "The device is warm, and warmer than last time.", + "The device is visibly shaking and burns to the touch. This must be the spot.", + "The device is cold.", + "The device is ice cold.", + "The device is very cold.", + "The device is hot.", + "The device is incredibly hot.", + }; + private static final String[] INVALID_MESSAGES = { + "The device is an octopus, and is wetter than last time.", + "foobar", + "a q p w", + "My feet are cold, I should put them in some lukewarm water, or run hot water over them.", + }; + + @Test + public void testValidTemperatureMessages() + { + for (final String message : VALID_MESSAGES) + { + assertNotNull(message, HotColdTemperature.getFromTemperatureSet(HotColdTemperature.BEGINNER_HOT_COLD_TEMPERATURES, message)); + assertNotNull(message, HotColdTemperature.getFromTemperatureSet(HotColdTemperature.MASTER_HOT_COLD_TEMPERATURES, message)); + } + } + + @Test + public void testInvalidTemperatureMessages() + { + for (final String message : INVALID_MESSAGES) + { + assertNull(message, HotColdTemperature.getFromTemperatureSet(HotColdTemperature.BEGINNER_HOT_COLD_TEMPERATURES, message)); + assertNull(message, HotColdTemperature.getFromTemperatureSet(HotColdTemperature.MASTER_HOT_COLD_TEMPERATURES, message)); + } + } + + @Test + public void testAmbiguousTemperatureMessages() + { + assertEquals(HotColdTemperature.ICE_COLD, HotColdTemperature.getFromTemperatureSet(HotColdTemperature.MASTER_HOT_COLD_TEMPERATURES, "The device is ice cold.")); + assertEquals(HotColdTemperature.VERY_COLD, HotColdTemperature.getFromTemperatureSet(HotColdTemperature.MASTER_HOT_COLD_TEMPERATURES, "The device is very cold.")); + assertEquals(HotColdTemperature.VERY_HOT, HotColdTemperature.getFromTemperatureSet(HotColdTemperature.MASTER_HOT_COLD_TEMPERATURES, "The device is very hot.")); + } +} diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/MasterHotColdLocationTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/MasterHotColdLocationTest.java new file mode 100644 index 0000000000..abda26549d --- /dev/null +++ b/runelite-client/src/test/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/MasterHotColdLocationTest.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2019, Jordan Atwood + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.cluescrolls.clues.hotcold; + +import java.util.Arrays; +import java.util.Set; +import java.util.stream.Collectors; +import static org.junit.Assert.assertEquals; +import org.junit.Test; + +public class MasterHotColdLocationTest +{ + private static final Set MASTER_HOT_COLD_LOCATIONS = Arrays.stream(HotColdLocation.values()) + .filter(l -> !l.isBeginnerClue()) + .collect(Collectors.toSet()); + private static final int EXPECTED_DIMENSION_SIZE = 9; + + @Test + public void beginnerHotColdLocationAreaTest() + { + for (final HotColdLocation location : MASTER_HOT_COLD_LOCATIONS) + { + assertEquals(EXPECTED_DIMENSION_SIZE, location.getRect().height); + assertEquals(EXPECTED_DIMENSION_SIZE, location.getRect().width); + } + } +} From 36b6af04e45139ff11010769ddafe90abc47c73a Mon Sep 17 00:00:00 2001 From: se7enAte9 <50936458+se7enAte9@users.noreply.github.com> Date: Mon, 1 Jul 2019 21:07:52 -0400 Subject: [PATCH 56/58] barbarianassault: fix horn hidden entry hiding non ba items (#852) * barbarianassault: fix horn hidden entry hiding non ba items * barbarianassault: include light log fix --- .../plugins/barbarianassault/BarbarianAssaultMenu.java | 2 +- .../runelite/client/plugins/barbarianassault/Menus.java | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/BarbarianAssaultMenu.java b/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/BarbarianAssaultMenu.java index 8f852846e4..0f8f843fd8 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/BarbarianAssaultMenu.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/BarbarianAssaultMenu.java @@ -174,7 +174,7 @@ class BarbarianAssaultMenu return config.removeIncorrectCalls() && !hornUpdated; default: - return config.removeUnusedMenus(); + return role != null && config.removeUnusedMenus(); } }); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/Menus.java b/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/Menus.java index 4f18e25578..5ec0dfb8de 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/Menus.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/Menus.java @@ -79,11 +79,11 @@ public enum Menus ATTACK_PENANCE_QUEEN(null, new ComparableEntry("attack", "penance queen", -1, -1, true, false)), ATTACK_QUEEN_SPAWN(null, new ComparableEntry("attack", "queen spawn", -1, -1, true, false)), - DROP_HORN(null, new ComparableEntry("drop", "horn", -1, -1, true, false)), - EXAMINE_HORN(null, new ComparableEntry("examine", "horn", -1, -1, true, false)), + DROP_HORN(null, new ComparableEntry("drop", "r horn", -1, -1, true, false)), + EXAMINE_HORN(null, new ComparableEntry("examine", "r horn", -1, -1, true, false)), LIGHT_LOGS(null, new ComparableEntry("light", "logs", -1, -1, true, true)), - MEDIC_HORN(null, new ComparableEntry("medic", "horn", -1, -1, true, false)), - USE_HORN(null, new ComparableEntry("use", "horn", -1, -1, true, false)); + MEDIC_HORN(null, new ComparableEntry("medic", "r horn", -1, -1, true, false)), + USE_HORN(null, new ComparableEntry("use", "r horn", -1, -1, true, false)); @Getter private final Role role; From b21d447aac52a671d26b1c70fa5194c795738fe3 Mon Sep 17 00:00:00 2001 From: Ian William O'Neill Date: Tue, 2 Jul 2019 05:26:29 +0100 Subject: [PATCH 57/58] Added 'Translate' menu option to right-click menu on players and chatbox, This will add player names to a list of player who should be translated to the set language. Thanks to Ganom and Oak. --- .../ChatTranslationConfig.java | 37 ++++--- .../ChatTranslationPlugin.java | 100 +++++++++++++----- 2 files changed, 97 insertions(+), 40 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationConfig.java index 3bc0a31f9f..32e8481c7c 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationConfig.java @@ -8,13 +8,26 @@ import net.runelite.client.config.ConfigItem; public interface ChatTranslationConfig extends Config { + @ConfigItem( + keyName = "translateOptionVisable", + name = "Show 'Translate' menu option", + description = "Adds 'Translate' to the right-click menu in the Chatbox.", + position = 0, + group = "Public Chat Translation" + ) + default boolean translateOptionVisable() + { + return true; + } + @ConfigItem( keyName = "publicChat", name = "Translate incoming Messages", description = "Would you like to Translate Public Chat?", - position = 0, + position = 1, group = "Public Chat Translation", - hidden = true + hidden = true, + unhide = "translateOptionVisable" ) default boolean publicChat() { @@ -22,17 +35,17 @@ public interface ChatTranslationConfig extends Config } @ConfigItem( - keyName = "translateOptionVisable", - name = "Show 'Translate' menu option", - description = "Adds 'Translate' to the right-click menu in the Chatbox.", - position = 1, + keyName = "playerNames", + name = "Translated Player list:", + description = "Players you add to this list will be Translated in Public chat.", + position = 2, group = "Public Chat Translation", - hidden = true -// unhide = "publicChat" + hidden = true, + unhide = "translateOptionVisable" ) - default boolean translateOptionVisable() + default String getPlayerNames() { - return true; + return ""; } @ConfigItem( @@ -41,8 +54,8 @@ public interface ChatTranslationConfig extends Config description = "Language to translate messages too.", position = 2, group = "Public Chat Translation", - hidden = true -// unhide = "publicChat" + hidden = true, + unhide = "publicChat" ) default Languages publicTargetLanguage() { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationPlugin.java index 85dc748859..65668483e2 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationPlugin.java @@ -5,6 +5,7 @@ import com.google.common.collect.ObjectArrays; import com.google.inject.Provides; import net.runelite.api.*; import net.runelite.api.events.ChatMessage; +import net.runelite.api.events.ConfigChanged; import net.runelite.api.events.MenuEntryAdded; import net.runelite.api.events.PlayerMenuOptionClicked; import net.runelite.api.widgets.Widget; @@ -19,11 +20,13 @@ import net.runelite.client.menus.MenuManager; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginType; +import net.runelite.client.util.Text; import org.apache.commons.lang3.ArrayUtils; import javax.inject.Inject; import javax.inject.Provider; import java.awt.event.KeyEvent; +import java.util.ArrayList; @PluginDescriptor( name = "Chat Translator", @@ -35,14 +38,20 @@ public class ChatTranslationPlugin extends Plugin implements KeyListener { private static final String TRANSLATE = "Translate"; + private static final ImmutableList AFTER_OPTIONS = ImmutableList.of("Message", "Add ignore", "Remove friend", "Kick"); + private ArrayList playerNames = new ArrayList<>(); + @Inject private Client client; @Inject private ClientThread clientThread; + @Inject + private ConfigManager configManager; + @Inject private Provider menuManager; @@ -72,6 +81,8 @@ public class ChatTranslationPlugin extends Plugin implements KeyListener } } keyManager.registerKeyListener(this); + + playerNames.addAll(Text.fromCSV(config.getPlayerNames())); } @Override @@ -85,14 +96,25 @@ public class ChatTranslationPlugin extends Plugin implements KeyListener } } keyManager.unregisterKeyListener(this); + + playerNames.clear(); } @Subscribe - public void onPlayerMenuOptionClicked(PlayerMenuOptionClicked event) + public void onConfigChanged(ConfigChanged event) { - if (event.getMenuOption().equals(TRANSLATE)) + if (event.getGroup().equals("chattranslation")) { - //TODO: Translate selected message. + if (event.getKey().equals("playerNames")) + { + for (String names : Text.fromCSV(config.getPlayerNames())) + { + if (!playerNames.contains(Text.toJagexName(names))) + { + playerNames.add(Text.toJagexName(names)); + } + } + } } } @@ -116,21 +138,37 @@ public class ChatTranslationPlugin extends Plugin implements KeyListener return; } - final MenuEntry lookup = new MenuEntry(); - lookup.setOption(TRANSLATE); - lookup.setTarget(event.getTarget()); - lookup.setType(MenuAction.RUNELITE.getId()); - lookup.setParam0(event.getActionParam0()); - lookup.setParam1(event.getActionParam1()); - lookup.setIdentifier(event.getIdentifier()); + final MenuEntry menuEntry = new MenuEntry(); + menuEntry.setOption(TRANSLATE); + menuEntry.setTarget(event.getTarget()); + menuEntry.setType(MenuAction.RUNELITE.getId()); + menuEntry.setParam0(event.getActionParam0()); + menuEntry.setParam1(event.getActionParam1()); + menuEntry.setIdentifier(event.getIdentifier()); - MenuEntry[] newMenu = ObjectArrays.concat(lookup, client.getMenuEntries()); + MenuEntry[] newMenu = ObjectArrays.concat(menuEntry, client.getMenuEntries()); int menuEntryCount = newMenu.length; ArrayUtils.swap(newMenu, menuEntryCount - 1, menuEntryCount - 2); client.setMenuEntries(newMenu); } } + @Subscribe + public void onPlayerMenuOptionClicked(PlayerMenuOptionClicked event) + { + if (event.getMenuOption().equals(TRANSLATE)) + { + String name = Text.toJagexName(event.getMenuTarget()); + if (!playerNames.contains(name)) + { + playerNames.add(name); + } + + configManager.setConfiguration("chattranslation", "playerNames", Text.toCSV(playerNames)); + configManager.sendConfig(); + } + } + @Subscribe public void onChatMessage(ChatMessage chatMessage) { @@ -151,27 +189,33 @@ public class ChatTranslationPlugin extends Plugin implements KeyListener return; } - String message = chatMessage.getMessage(); - - Translator translator = new Translator(); - - try + for (String nameList : playerNames) { - //Automatically check language of message and translate to selected language. - String translation = translator.translate("auto", config.publicTargetLanguage().toString(), message); - if (translation != null) + if (nameList.contains(Text.toJagexName(chatMessage.getName()))) { - final MessageNode messageNode = chatMessage.getMessageNode(); - messageNode.setRuneLiteFormatMessage(translation); - chatMessageManager.update(messageNode); + String message = chatMessage.getMessage(); + + Translator translator = new Translator(); + + try + { + //Automatically check language of message and translate to selected language. + String translation = translator.translate("auto", config.publicTargetLanguage().toString(), message); + if (translation != null) + { + final MessageNode messageNode = chatMessage.getMessageNode(); + messageNode.setRuneLiteFormatMessage(translation); + chatMessageManager.update(messageNode); + } + } + catch (Exception e) + { + e.printStackTrace(); + } + + client.refreshChat(); } } - catch (Exception e) - { - e.printStackTrace(); - } - - client.refreshChat(); } @Override From eb73a3510255fb08ddaeabbd800d9318b5030242 Mon Sep 17 00:00:00 2001 From: Zeruth Date: Tue, 2 Jul 2019 01:19:21 -0400 Subject: [PATCH 58/58] reverts draft merge --- .../ChatTranslationConfig.java | 78 ------ .../ChatTranslationPlugin.java | 236 ------------------ .../plugins/chattranslation/Languages.java | 24 -- .../plugins/chattranslation/Translator.java | 46 ---- 4 files changed, 384 deletions(-) delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationConfig.java delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationPlugin.java delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/Languages.java delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/Translator.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationConfig.java deleted file mode 100644 index 565aec82d8..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationConfig.java +++ /dev/null @@ -1,78 +0,0 @@ -package net.runelite.client.plugins.chattranslation; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("chattranslation") -public interface ChatTranslationConfig extends Config -{ - - @ConfigItem( - keyName = "publicChat", - name = "Translate incoming Messages", - description = "Would you like to Translate Public Chat?", - position = 0, - group = "Public Chat Translation", - hidden = true - ) - default boolean publicChat() - { - return false; - } - - @ConfigItem( - keyName = "translateOptionVisable", - name = "Show 'Translate' menu option", - description = "Adds 'Translate' to the right-click menu in the Chatbox.", - position = 1, - group = "Public Chat Translation", - hidden = true -// unhide = "publicChat" - ) - default boolean translateOptionVisable() - { - return false; - } - - @ConfigItem( - keyName = "publicTargetLanguage", - name = "Target Language", - description = "Language to translate messages too.", - position = 2, - group = "Public Chat Translation", - hidden = true -// unhide = "publicChat" - ) - default Languages publicTargetLanguage() - { - return Languages.ENGLISH; - } - - @ConfigItem( - keyName = "playerChat", - name = "Translate outgoing Messages", - description = "Would you like to Translate your Messages?", - position = 3, - group = "Player Message Translation" - ) - default boolean playerChat() - { - return false; - } - - @ConfigItem( - keyName = "playerTargetLanguage", - name = "Target Language", - description = "Language to translate messages too.", - position = 4, - group = "Player Message Translation", - hidden = true, - unhide = "playerChat" - ) - default Languages playerTargetLanguage() - { - return Languages.SPANISH; - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationPlugin.java deleted file mode 100644 index 85dc748859..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationPlugin.java +++ /dev/null @@ -1,236 +0,0 @@ -package net.runelite.client.plugins.chattranslation; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ObjectArrays; -import com.google.inject.Provides; -import net.runelite.api.*; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.MenuEntryAdded; -import net.runelite.api.events.PlayerMenuOptionClicked; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.chat.ChatMessageManager; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.input.KeyListener; -import net.runelite.client.input.KeyManager; -import net.runelite.client.menus.MenuManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import org.apache.commons.lang3.ArrayUtils; - -import javax.inject.Inject; -import javax.inject.Provider; -import java.awt.event.KeyEvent; - -@PluginDescriptor( - name = "Chat Translator", - description = "Translates messages from one Language to another.", - tags = {"translate", "language", "english", "spanish", "dutch", "french"}, - type = PluginType.UTILITY -) -public class ChatTranslationPlugin extends Plugin implements KeyListener -{ - - private static final String TRANSLATE = "Translate"; - private static final ImmutableList AFTER_OPTIONS = ImmutableList.of("Message", "Add ignore", "Remove friend", "Kick"); - - @Inject - private Client client; - - @Inject - private ClientThread clientThread; - - @Inject - private Provider menuManager; - - @Inject - private ChatMessageManager chatMessageManager; - - @Inject - private KeyManager keyManager; - - @Inject - private ChatTranslationConfig config; - - @Provides - ChatTranslationConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(ChatTranslationConfig.class); - } - - @Override - protected void startUp() throws Exception - { - if (client != null) - { - if (config.translateOptionVisable()) - { - menuManager.get().addPlayerMenuItem(TRANSLATE); - } - } - keyManager.registerKeyListener(this); - } - - @Override - protected void shutDown() throws Exception - { - if (client != null) - { - if (config.translateOptionVisable()) - { - menuManager.get().removePlayerMenuItem(TRANSLATE); - } - } - keyManager.unregisterKeyListener(this); - } - - @Subscribe - public void onPlayerMenuOptionClicked(PlayerMenuOptionClicked event) - { - if (event.getMenuOption().equals(TRANSLATE)) - { - //TODO: Translate selected message. - } - } - - @Subscribe - public void onMenuEntryAdded(MenuEntryAdded event) - { - if (!config.translateOptionVisable()) - { - return; - } - - int groupId = WidgetInfo.TO_GROUP(event.getActionParam1()); - String option = event.getOption(); - - if (groupId == WidgetInfo.CHATBOX.getGroupId()) - { - boolean after; - - if (!AFTER_OPTIONS.contains(option)) - { - return; - } - - final MenuEntry lookup = new MenuEntry(); - lookup.setOption(TRANSLATE); - lookup.setTarget(event.getTarget()); - lookup.setType(MenuAction.RUNELITE.getId()); - lookup.setParam0(event.getActionParam0()); - lookup.setParam1(event.getActionParam1()); - lookup.setIdentifier(event.getIdentifier()); - - MenuEntry[] newMenu = ObjectArrays.concat(lookup, client.getMenuEntries()); - int menuEntryCount = newMenu.length; - ArrayUtils.swap(newMenu, menuEntryCount - 1, menuEntryCount - 2); - client.setMenuEntries(newMenu); - } - } - - @Subscribe - public void onChatMessage(ChatMessage chatMessage) - { - if (client.getGameState() != GameState.LOADING && client.getGameState() != GameState.LOGGED_IN) - { - return; - } - switch (chatMessage.getType()) - { - case PUBLICCHAT: - case MODCHAT: - if (!config.publicChat()) - { - return; - } - break; - default: - return; - } - - String message = chatMessage.getMessage(); - - Translator translator = new Translator(); - - try - { - //Automatically check language of message and translate to selected language. - String translation = translator.translate("auto", config.publicTargetLanguage().toString(), message); - if (translation != null) - { - final MessageNode messageNode = chatMessage.getMessageNode(); - messageNode.setRuneLiteFormatMessage(translation); - chatMessageManager.update(messageNode); - } - } - catch (Exception e) - { - e.printStackTrace(); - } - - client.refreshChat(); - } - - @Override - public void keyPressed(KeyEvent event) - { - if (client.getGameState() != GameState.LOADING && client.getGameState() != GameState.LOGGED_IN) - { - return; - } - - if (!config.playerChat()) - { - return; - } - - Widget chatboxParent = client.getWidget(WidgetInfo.CHATBOX_PARENT); - - if (chatboxParent != null && chatboxParent.getOnKeyListener() != null) - { - if (event.getKeyCode() == 0xA) - { - event.consume(); - - Translator translator = new Translator(); - String message = client.getVar(VarClientStr.CHATBOX_TYPED_TEXT); - - try - { - //Automatically check language of message and translate to selected language. - String translation = translator.translate("auto", config.playerTargetLanguage().toString(), message); - if (translation != null) - { - client.setVar(VarClientStr.CHATBOX_TYPED_TEXT, translation); - - clientThread.invoke(() -> - { - client.runScript(96, 0, translation); - }); - } - client.setVar(VarClientStr.CHATBOX_TYPED_TEXT, ""); - } - catch (Exception e) - { - e.printStackTrace(); - } - } - } - } - - @Override - public void keyReleased(KeyEvent e) - { - // Nothing. - } - - @Override - public void keyTyped(KeyEvent e) - { - // Nothing. - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/Languages.java b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/Languages.java deleted file mode 100644 index 3ec7b3ad81..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/Languages.java +++ /dev/null @@ -1,24 +0,0 @@ -package net.runelite.client.plugins.chattranslation; - -public enum Languages -{ - - ENGLISH("en"), - DUTCH("nl"), - SPANISH("es"), - FRENCH("fr"); - - private final String shortName; - - Languages(String shortName) - { - this.shortName = shortName; - } - - @Override - public String toString() - { - return shortName; - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/Translator.java b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/Translator.java deleted file mode 100644 index df8f26ea29..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/Translator.java +++ /dev/null @@ -1,46 +0,0 @@ -package net.runelite.client.plugins.chattranslation; - -import org.json.JSONArray; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.HttpURLConnection; -import java.net.URL; -import java.net.URLEncoder; - -public class Translator -{ - - public String translate(String source, String target, String message) throws Exception - { - - String url = "https://translate.googleapis.com/translate_a/single?client=gtx&sl=" + source + "&tl=" + target + "&dt=t&q=" + URLEncoder.encode(message, "UTF-8"); - - URL obj = new URL(url); - HttpURLConnection con = (HttpURLConnection) obj.openConnection(); - con.setRequestProperty("User-Agent", "Mozilla/5.0"); - - BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); - String inputLine; - StringBuffer response = new StringBuffer(); - - while ((inputLine = in.readLine()) != null) - { - response.append(inputLine); - } - in.close(); - - return parseResult(response.toString()); - } - - private String parseResult(String inputJson) throws Exception - { - //TODO: find a way to do this using google.gson - JSONArray jsonArray = new JSONArray(inputJson); - JSONArray jsonArray2 = (JSONArray) jsonArray.get(0); - JSONArray jsonArray3 = (JSONArray) jsonArray2.get(0); - - return jsonArray3.get(0).toString(); - } - -}