From 14c517d7a6509075b41d1c11d11a615a6b207b7f Mon Sep 17 00:00:00 2001 From: Henrique Santiago Date: Fri, 6 Jan 2012 21:54:17 -0200 Subject: [PATCH] skulls, shields and emblems are now rendered, thanks to joao --- modules/game/creature.lua | 75 ++++++++++++++++++ modules/game/game.otmod | 1 + modules/game/images/emblem_blue.png | Bin 0 -> 385 bytes modules/game/images/emblem_green.png | Bin 0 -> 381 bytes modules/game/images/emblem_red.png | Bin 0 -> 386 bytes modules/game/images/shield_blue.png | Bin 0 -> 352 bytes .../game/images/shield_blue_not_shared.png | Bin 0 -> 522 bytes modules/game/images/shield_blue_shared.png | Bin 0 -> 516 bytes modules/game/images/shield_blue_white.png | Bin 0 -> 404 bytes modules/game/images/shield_yellow.png | Bin 0 -> 377 bytes .../game/images/shield_yellow_not_shared.png | Bin 0 -> 512 bytes modules/game/images/shield_yellow_shared.png | Bin 0 -> 494 bytes modules/game/images/shield_yellow_white.png | Bin 0 -> 407 bytes modules/game/images/skull_black.png | Bin 0 -> 482 bytes modules/game/images/skull_green.png | Bin 0 -> 438 bytes modules/game/images/skull_orange.png | Bin 0 -> 445 bytes modules/game/images/skull_red.png | Bin 0 -> 421 bytes modules/game/images/skull_white.png | Bin 0 -> 437 bytes modules/game/images/skull_yellow.png | Bin 0 -> 437 bytes src/otclient/const.h | 31 ++++++++ src/otclient/core/creature.cpp | 48 +++++++++++ src/otclient/core/creature.h | 14 ++-- src/otclient/luafunctions.cpp | 3 + 23 files changed, 166 insertions(+), 6 deletions(-) create mode 100644 modules/game/creature.lua create mode 100644 modules/game/images/emblem_blue.png create mode 100644 modules/game/images/emblem_green.png create mode 100644 modules/game/images/emblem_red.png create mode 100644 modules/game/images/shield_blue.png create mode 100644 modules/game/images/shield_blue_not_shared.png create mode 100644 modules/game/images/shield_blue_shared.png create mode 100644 modules/game/images/shield_blue_white.png create mode 100644 modules/game/images/shield_yellow.png create mode 100644 modules/game/images/shield_yellow_not_shared.png create mode 100644 modules/game/images/shield_yellow_shared.png create mode 100644 modules/game/images/shield_yellow_white.png create mode 100644 modules/game/images/skull_black.png create mode 100644 modules/game/images/skull_green.png create mode 100644 modules/game/images/skull_orange.png create mode 100644 modules/game/images/skull_red.png create mode 100644 modules/game/images/skull_white.png create mode 100644 modules/game/images/skull_yellow.png diff --git a/modules/game/creature.lua b/modules/game/creature.lua new file mode 100644 index 00000000..4b0ea9b6 --- /dev/null +++ b/modules/game/creature.lua @@ -0,0 +1,75 @@ +SkullNone = 0 +SkullYellow = 1 +SkullGreen = 2 +SkullWhite = 3 +SkullRed = 4 +SkullBlack = 5 +SkullOrange = 6 + +ShieldNone = 0 +ShieldWhiteYellow = 1 +ShieldWhiteBlue = 2 +ShieldBlue = 3 +ShieldYellow = 4 +ShieldBlueSharedExp = 5 +ShieldYellowSharedExp = 6 +ShieldBlueNoSharedExpBlink = 7 +ShieldYellowNoSharedExpBlink = 8 +ShieldBlueNoSharedExp = 9 +ShieldYellowNoSharedExp = 10 + +EmblemNone = 0 +EmblemGreen = 1 +EmblemRed = 2 +EmblemBlue = 3 + +function Creature:onSkullChange(skullId) + if skullId == SkullYellow then + self:setSkullTexture(resolvepath('images/skull_yellow.png')) + elseif skullId == SkullGreen then + self:setSkullTexture(resolvepath('images/skull_green.png')) + elseif skullId == SkullWhite then + self:setSkullTexture(resolvepath('images/skull_white.png')) + elseif skullId == SkullRed then + self:setSkullTexture(resolvepath('images/skull_red.png')) + elseif skullId == SkullBlack then + self:setSkullTexture(resolvepath('images/skull_black.png')) + elseif skullId == SkullOrange then + self:setSkullTexture(resolvepath('images/skull_orange.png')) + end +end + +function Creature:onShieldChange(shieldId) + if shieldId == ShieldWhiteYellow then + self:setShieldTexture(resolvepath('images/shield_yellow_white.png')) + elseif shieldId == ShieldWhiteBlue then + self:setShieldTexture(resolvepath('images/shield_blue_white.png')) + elseif shieldId == ShieldBlue then + self:setShieldTexture(resolvepath('images/shield_blue.png')) + elseif shieldId == ShieldYellow then + self:setShieldTexture(resolvepath('images/shield_yellow.png')) + elseif shieldId == ShieldBlueSharedExp then + self:setShieldTexture(resolvepath('images/shield_blue_shared.png')) + elseif shieldId == ShieldYellowSharedExp then + self:setSkullTexture(resolvepath('images/shield_yellow_shared.png')) + elseif shieldId == ShieldBlueNoSharedExpBlink then + self:setSkullTexture(resolvepath('images/shield_blue_not_shared.png')) + elseif shieldId == ShieldYellowNoSharedExpBlink then + self:setSkullTexture(resolvepath('images/shield_yellow_not_shared.png')) + elseif shieldId == ShieldBlueNoSharedExp then + self:setSkullTexture(resolvepath('images/shield_blue_not_shared.png')) + elseif shieldId == ShieldYellowNoSharedExp then + self:setSkullTexture(resolvepath('images/shield_yellow_not_shared.png')) + end +end + +function Creature:onEmblemChange(emblemId) + if emblemId == EmblemGreen then + self:setEmblemTexture(resolvepath('images/emblem_green.png')) + elseif emblemId == EmblemRed then + self:setEmblemTexture(resolvepath('images/emblem_red.png')) + elseif emblemId == EmblemBlue then + self:setEmblemTexture(resolvepath('images/emblem_blue.png')) + end +end + diff --git a/modules/game/game.otmod b/modules/game/game.otmod index 0d8184c3..51f916ed 100644 --- a/modules/game/game.otmod +++ b/modules/game/game.otmod @@ -16,3 +16,4 @@ Module onLoad: | require 'game' require 'thing' + require 'creature' diff --git a/modules/game/images/emblem_blue.png b/modules/game/images/emblem_blue.png new file mode 100644 index 0000000000000000000000000000000000000000..a018e3daa72dbe1f658337858b176f03aacf08ce GIT binary patch literal 385 zcmeAS@N?(olHy`uVBq!ia0vp^+#t-s1|(OmDOUqhjKx9jP7LeL$-D$|*pj^6T^Rm@ z;DWu&Cj&(|3p^r=fm(z?n2}-D90{Nxdx@v7EBhTrHc?q#E#bmNKvNh!T^vIsF6U0% z=*8?P;(A^>+$4FbC?|`K&(@|4c*;%t;GwKFEZiG6 zbGV2Isz?MbPM&y1Z}YQ52c8D>BOF#e_K{9ls(S6!Fcs_6Ll#D znLRQKzi`>_)&A!7n?a^-?&rGAZ4BSuJeqf`?6&mx-#0z~X72XXT`6E8AhLZ^%>DB# z4&A=MKQCxqk6F zVQXA2L&BDcI}0wA?UGlPDXjj^aUdwQ>D-6sT%9oY_4O&cSy?Luz9;{_AYF0h aC4b=3fUD;uZZ8Lh4}+(xpUXO@geCxw&z0c- literal 0 HcmV?d00001 diff --git a/modules/game/images/emblem_green.png b/modules/game/images/emblem_green.png new file mode 100644 index 0000000000000000000000000000000000000000..e5ead379951c28081182156192e7e551a812432d GIT binary patch literal 381 zcmeAS@N?(olHy`uVBq!ia0vp^+#t-s1|(OmDOUqhjKx9jP7LeL$-D$|*pj^6T^Rm@ z;DWu&Cj&(|3p^r=fm(z?n2}-D90{Nxdx@v7EBhTrHc=TtbxxTzK%u{$E{-7*mvblD zdNVr;w9U8l^S$OIJkcadLL{hTTBKl8Yb*=vUtzPC&EKy7;(sHe?YP!eCnb07mQ5at zo{AnGJ`S?o8`P_xwKh&~|Cx|>MAAKMTmDr^^`41o$}7c6WyBrI^OtWttI4pAk6q-N zveozdZ{|N`tgw(Q+I!KNVQ=-mg@ttjJ+HUc1=Uy8c&?36|CW%bzm>=8)ERe{0~^+A z_RlHY6ngXFijs*=j44yRlZ_XKt$W<_nIr7kwST#KOl6tB*KanT9H_UWpJPSaQNspf zzclq{TmRmay2!O>k1gYdmFVdQ&MBb@08A~B{r~^~ literal 0 HcmV?d00001 diff --git a/modules/game/images/emblem_red.png b/modules/game/images/emblem_red.png new file mode 100644 index 0000000000000000000000000000000000000000..94d712aec91fda963f68b818ef350899f17d394d GIT binary patch literal 386 zcmeAS@N?(olHy`uVBq!ia0vp^+#t-s1|(OmDOUqhjKx9jP7LeL$-D$|*pj^6T^Rm@ z;DWu&Cj&(|3p^r=fm(z?n2}-D90{Nxdx@v7EBhTrHc=TvnRJ^JpeanAE{-7*mvbj> z^kQ}tXxksDH))NTo2o|C46O+Qr{~&wCEF1kSkNowV+_^PwN@$9H>%tkYxoFlV~(`YFGv zwsXd>VmL6{H)vgtS&+5el1ux}=q&p8$*;ie>kEd(y%xuUHrs98$uRqObue?l(MS6~ zb2KFspOtI4=*Fdey6ndvCI{Y%z3-Ve+*py`J=aV6H3Q39qvdn^r|f30tbE|U@9o#) dlFzOqq3DW67PTYXUwDQ?i=$lkA57hLggk#HN(uMD29elF{r5}E)*MT&s{ literal 0 HcmV?d00001 diff --git a/modules/game/images/shield_blue_not_shared.png b/modules/game/images/shield_blue_not_shared.png new file mode 100644 index 0000000000000000000000000000000000000000..6bd6a7820f80c9e2fe53019ba964b172039b429b GIT binary patch literal 522 zcmV+l0`>igP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iyS$ z6)i6yH3qc+00D|gL_t&-({+(MXj5STM$iA>N0OVE7VDsmqL{%J2XPQ76%k!y6$R-c zPHu%#x|q6H#20j`jt-@jLQ7lIMi)n?J2+H@`Y53k$zak#a`U*kH@*EGLIN2)^T*-9 zCv3}RBzjkE)K&%m;g)q|QSIg3KJ zdwkDja^Vs0P9^bPt&{2RA-z0}3KWvoOxTtUKq_=oJv-CK&(u?rr+dlmmKa!?V9K%h z=*$a%j`@R^6;nF}oLYcWKg9PdJg&q#!!C21k?0-O>Z-EQ{M7a8Kc^Ly4UVq^XaE2J M07*qoM6N<$g4>teu>b%7 literal 0 HcmV?d00001 diff --git a/modules/game/images/shield_blue_shared.png b/modules/game/images/shield_blue_shared.png new file mode 100644 index 0000000000000000000000000000000000000000..4cdc2b7b189fd95f9cb2a20a122af4ff223aedc3 GIT binary patch literal 516 zcmV+f0{i`mP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iyS$ z6)YA1BJM^200D$aL_t&-({+)(OIu+aM$h}+o0wd!f;fmRB7%wv9UUB8@()-QYqfiI z5(Gu)QgGhoP1Jak{5o73aOeZic7_8- z*_KUPakqq>cZ&b4y{J>xlB-HpS2syneGg}c%LL6FhFL%|83Q0_l@U)lggR#Vyw;DY z0aGbjI>zXH(v05+jkU173#TV1T*R|{`?^P=zC-7TH<|VuYosP zb$J~v*S`SBWo|e$BK(Z)U;(p{5VsR9#zT{g>%pe$rjZ=nr5&c%pOKwYY`%WXhoK_^ zFMRaX?X!Py?9sMmQ&CIZ%!vGt%>uP+U zhUg_kUE+EDChUH?SM@Ij$Cy0#18O4x00004(yHyiBfToCex;TbNTrQnx z?|nEy;8=bBy(LbuTW0Yn{owt@8WYRy#1?)~)%n8RqiZ!7xAXDcwbIbw(tq(x$?1he zK|ujWm$SkI#f1spj|8%XwwT}j_-E&Hi-+55t4{BAO7+^X;MooX-_18(xwSNI?eH$Q zR;t)`f$`1U;Jl6-w_BHr<>VbWt?je?!$;1C)tZ+WN@Aa9)E~JjE1~rP7;_oLKnL@l%~$ORP>#N>(mQu8Y7_4y9-BCY^p4C9^Yz zLsDW!Vx8T;nSqa5_neqq5t!5Y&gO31ZkC+0$7la#S;BL`^6cjy6DD6SUbAt7`GQ|{ z2^%>?>g8+d{xU6K%t?FkUDohgg3JwLhBaq947Zhi*<^5xG2p!Si`c|7e%h@>) zC#Ei2xHERf-Srt!!cJLP9~ZSPPOAO;D|4-EAJ>uYtlT34*IB$wxA2~SXrx}Y&`ycrnoUzfv-7YHzh_ RD=-ikJYD@<);T3K0Ra0Omf!#Y literal 0 HcmV?d00001 diff --git a/modules/game/images/shield_yellow_not_shared.png b/modules/game/images/shield_yellow_not_shared.png new file mode 100644 index 0000000000000000000000000000000000000000..85b0b3053dbe6b6adb7f56ef5cb6ec5eaafb2762 GIT binary patch literal 512 zcmV+b0{{JqP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iyS$ z6)qxmsVU0<00DqWL_t&-({+(gNEC4##XrB(tf*5nKQ$o?9 zlVl)X^z2pk6m+eN3xOJj6y~9XPP;P!Jw!MkcB>_BSx$3GVJkMxOsbsv7z0 zM{pvhz*3~Tn!F$G#F^Zqy0XLA{BJ%CU8ntq1|X)uYKsF#Kna=AkazdHc(PpNZ7xIS z@EIb4(GY}S6^@H4zu`gCU|eB*^MJ*^4jz1~5mX>>4RdQQYe7j_0H-0iHN!xm&U&}a zt%XsFInC{rQyKxNShT7t+hqV|I~pvy+ z;>1JyA;wfVYiM2_U4Sjk=X#oSB+x=SsaUMHzWNX4X{p!-&EpgR0000Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iyS$ z6)Q7hZvA`!00C}EL_t&-({<53NYrrvhw;zvf2YWq9uA$oD80}SK}$nz>egfgLeSFE zRDrbwfo)-7gG5#|7D96g4NYBA@ZX}BsUpkDOheHw@6LPqH3)@6-}xE7JWoh-sSEkO zcw=Qc_|HZP195br7()N9Tr7S%=jgr(tJNlG&+@xYYbGHyJ)1e^Kw(O@REyl7^yFPH zNyI3+v5W_J#q-x7snjC@cNclTj;ol%h(p7VbPauAv9tlVw*<0*R=zeGJ}=aVx5W6O zCw8CB#GTEpv2ZepajFpGt$ZBV-4@eaDuLx1zBIu6r9CRAR{R*-OEzJRklnDFz?JXC zF!(UC)Sw*woE)MYnW^Z%S$1viY4{7n<=J95a%P!Q4R2Vj8l0%OzVt6vNOS3?TBkev k;#xJ@p3fLxC~m6y2fz7_$zms&8~^|S07*qoM6N<$f^dS}`v3p{ literal 0 HcmV?d00001 diff --git a/modules/game/images/shield_yellow_white.png b/modules/game/images/shield_yellow_white.png new file mode 100644 index 0000000000000000000000000000000000000000..7dc9899aece5cfd283d138e91cdc5d59d5254bf3 GIT binary patch literal 407 zcmeAS@N?(olHy`uVBq!ia0vp^+#t-s1|(OmDOUqhjKx9jP7LeL$-D$|*pj^6T^Rm@ z;DWu&Cj&(|3p^r=fm(z?n2}-D90{Nxdx@v7EBhTrHc?H{rcfznpef>>E{-7*mrEzw z`WSrNKN0Pq)SNMhCwk9o;eJ!drjD8LiXQ|1mFNhH63}6y1a%J(D(r!*s2V1VyfBSrO+T|!~ z`GhHRFT9?2$%-Q|=%Cx=!f!`PqCREDS60twc)<8$-}&ReBo7}{J|P;Q$l&$!OxosC zedh90f>u0Z{rkE);;#Fttz9Pbrf_d6=F?PVxLs}jxRqGVjlchX zi<|_X+ts>~I|oGELd;&>dnW!aFMgWs>_Z(Yo+m!bWa~0qi)#8X>Fzi2&pcYG!4iVU w4J+qOPL&MuTBNZ^Zkk7PiRRi}4zj=5UTi75kdvIB4h%I0Pgg&ebxsLQ0DDNGG5`Po literal 0 HcmV?d00001 diff --git a/modules/game/images/skull_black.png b/modules/game/images/skull_black.png new file mode 100644 index 0000000000000000000000000000000000000000..8d3ddc0e8cf39782979e0ca533773854ab29a96c GIT binary patch literal 482 zcmeAS@N?(olHy`uVBq!ia0vp^+#t-s1|(OmDOUqhjKx9jP7LeL$-D$|*pj^6T^Rm@ z;DWu&Cj&(|3p^r=fm(z?n2}-D90{Nxdx@v7EBhTrHc=@Fj(+Aopeae7E{-7*mvbi? zdNU<5w9S9N`!P$Yv4KEfA$QXp8IhPj%op<*SPChTpxD(3fR9m9qGN2Pxzm00x# zaUCz*pwsPJa=66mX<=-TdR;ijYo#Tx(!)i#SlbROo_;E{RODiY$Ym4GriPnL5KVP_x;xO0>^_HjyZbXojXry>5A}8p#Q*c Wex(xo(okRoFnGH9xvXQYg_qBVc`y-vEH@miSSm1*`WJyA?- zQj&>MiV1hyl4_l0*%1}jmw%r3S?06_8-w}#uKIHp$Cx;N9FolyTEfELFQYFp>CVK5 z86PFe?@cZ2NoBkhD$~GyuHuOte}B;-nN7#9dd^y(T_LAkb8(B>l?6eT&MUN9)l3(i zV&U>#_(5n@gnL6ygUR$1^Lrbe1+wQXo}XwJoG{&a1N)wsgQgFrM@aT3_usxVIk6;h z!Udi!Q%eOEPkp*{%RiXm>&nQh&sT(+7O@5FZCZ6!Jc-e$@8GwKZ=#pK5Dl|TD6@7m z-@7OGpmVU`+`qGz-@fEGOwbCQF6eP#4N4ZHVzR||`0KhtLJpX++vp7pQAy3m+U d+XWs--{EXo=XG)GG+>}Ic)I$ztaD0e0sv!stpET3 literal 0 HcmV?d00001 diff --git a/modules/game/images/skull_orange.png b/modules/game/images/skull_orange.png new file mode 100644 index 0000000000000000000000000000000000000000..0c906c1f306e414364ed1e62987d8dfc4ca5882c GIT binary patch literal 445 zcmeAS@N?(olHy`uVBq!ia0vp^+#t-s1|(OmDOUqhjKx9jP7LeL$-D$|*pj^6T^Rm@ z;DWu&Cj&(|3p^r=fm(z?n2}-D90{Nxdx@v7EBhTrHc=H-L8XvKKvQfzT^vIsE|*TU z^>9j*Xq~U^Rn}~9eAbp}cT|*`m$Y3|;L7IsUXZ~lm9;@JW7>kYm_skxw=Gj@pZ4Ii zlgAdtN#1NuLX+HHP1wg$OH-FI2Kmb;I4+pbblv6x!*1bseLH=mQ@Rbxzr2hwTUU@`#(89w zPJdH*&9uvVIX>!qv0QlfT2C_Lj{0@NyVqUHWY14v{gv+V>|kQMq4<<6-y2*Lrsp-S z{>@^_J*BwC`LfQ>g^REA^O;9?&Ry@%=(32pXm^9h68B{`9c#9Gs`jWjb0~O)``)ne zIHUZjM7e02Mv;Z$#gk$yO0J&C$tuW@xW{$jY15R@WP*l3qHs3w$^dy#z7WUKK3}zb4{TF-V#)D6nO6UD-fA^`qhM-^VICWB)|$3QLGuZ*65=JY|_kYyaJK{1q2p zUdZ`%<-NUXYe$&&KEaJUCG$HYqPu^7(sc9pbd{dj_8C!8DACC{)!2|~>7vWYnX|~+` zywe2B6SehLJ+MvP!l>}E^Mikn8P|d^vAM+>O9ceu){Eb(o_Aio`)Jb>ZNbI8K@Aqq z88o_@1elbZwnjZI+r9B-&W3A7v(K(zsCaKV|9sE!9>5--Mphw+RHC{s!i@> z2r|C4qHMQr`{72N(=WbOz4>0fh?jnu4k6}xvOe&xEJR;jtuD{1^@%LBJrI%%2<7-#&E!MGS+dtDnm{r-UW|U_-F- literal 0 HcmV?d00001 diff --git a/modules/game/images/skull_yellow.png b/modules/game/images/skull_yellow.png new file mode 100644 index 0000000000000000000000000000000000000000..2994f8efe2ee65c26d4af05b47a42d51e696a617 GIT binary patch literal 437 zcmeAS@N?(olHy`uVBq!ia0vp^+#t-s1|(OmDOUqhjKx9jP7LeL$-D$|*pj^6T^Rm@ z;DWu&Cj&(|3p^r=fm(z?n2}-D90{Nxdx@v7EBhTrHc<%%&8t77fToywx;TbNTrQnx z@7+`=;d)-%^J|mXT3^rj11<&|GP{ zWo2ZX2$+z;VH_M-o!?w9U3IMe^uwZcsX5FJD`bTJ&)L|^df__Xsxl@X2EG@}Ql15y z-pJn(y2X9+#<5KdE5)*v>f{_NCor!QToFHM*Xa+RxU^sE8uhYVS*)`z>_%UM{f0B8 ze>z-*j@2gcn?>p|%t`M{7TqKFfxY~|UYB2tZS4taJgw*R>Q|bmUQG&m8?s6+tDJl4 zr?vH!zO$t{1aze@g**6bE_t*bP0l+XkKj3}+e literal 0 HcmV?d00001 diff --git a/src/otclient/const.h b/src/otclient/const.h index 5f5b6dd2..95b99423 100644 --- a/src/otclient/const.h +++ b/src/otclient/const.h @@ -368,6 +368,37 @@ namespace Otc StandWhileFighting = 0, ChaseOpponent = 1 }; + + enum PlayerSkulls { + SkullNone = 0, + SkullYellow = 1, + SkullGreen = 2, + SkullWhite = 3, + SkullRed = 4, + SkullBlack = 5, + SkullOrange = 6 + }; + + enum PlayerShields { + ShieldNone = 0, + ShieldWhiteYellow = 1, + ShieldWhiteBlue = 2, + ShieldBlue = 3, + ShieldYellow = 4, + ShieldBlueSharedExp = 5, + ShieldYellowSharedExp = 6, + ShieldBlueNoSharedExpBlink = 7, + ShieldYellowNoSharedExpBlink = 8, + ShieldBlueNoSharedExp = 9, + ShieldYellowNoSharedExp = 10 + }; + + enum PlayerEmblems { + EmblemNone = 0, + EmblemGreen = 1, + EmblemRed = 2, + EmblemBlue = 3 + }; } #endif diff --git a/src/otclient/core/creature.cpp b/src/otclient/core/creature.cpp index 65c794f6..95f9abb3 100644 --- a/src/otclient/core/creature.cpp +++ b/src/otclient/core/creature.cpp @@ -34,6 +34,7 @@ #include #include +#include #include "spritemanager.h" Creature::Creature() : Thing() @@ -158,6 +159,19 @@ void Creature::drawInformation(int x, int y, bool useGray, const Rect& visibleRe if(m_informationFont) m_informationFont->renderText(m_name, textRect, Fw::AlignTopCenter, fillColor); + + if(m_skull != Otc::SkullNone && m_skullTexture) { + g_painter.setColor(Fw::white); + g_painter.drawTexturedRect(Rect(x + 12, y + 5, m_skullTexture->getSize()), m_skullTexture); + } + if(m_shield != Otc::ShieldNone && m_shieldTexture) { + g_painter.setColor(Fw::white); + g_painter.drawTexturedRect(Rect(x, y + 5, m_shieldTexture->getSize()), m_shieldTexture); + } + if(m_emblem != Otc::EmblemNone && m_emblemTexture) { + g_painter.setColor(Fw::white); + g_painter.drawTexturedRect(Rect(x + 12, y + 16, m_emblemTexture->getSize()), m_emblemTexture); + } } void Creature::walk(const Position& position, bool inverse) @@ -325,6 +339,40 @@ void Creature::setOutfit(const Outfit& outfit) m_outfit.resetClothes(); } +void Creature::setSkull(uint8 skull) +{ + m_skull = skull; + g_lua.callGlobalField("Creature","onSkullChange", asCreature(), m_skull); +} + +void Creature::setShield(uint8 shield) +{ + m_shield = shield; + g_lua.callGlobalField("Creature","onShieldChange", asCreature(), m_shield); +} + +void Creature::setEmblem(uint8 emblem) +{ + m_emblem = emblem; + + g_lua.callGlobalField("Creature","onEmblemChange", asCreature(), m_emblem); +} + +void Creature::setSkullTexture(const std::string& filename) +{ + m_skullTexture = g_textures.getTexture(filename); +} + +void Creature::setShieldTexture(const std::string& filename) +{ + m_shieldTexture = g_textures.getTexture(filename); +} + +void Creature::setEmblemTexture(const std::string& filename) +{ + m_emblemTexture = g_textures.getTexture(filename); +} + void Creature::addVolatileSquare(uint8 color) { m_showVolatileSquare = true; diff --git a/src/otclient/core/creature.h b/src/otclient/core/creature.h index 18dfa80a..9b219d88 100644 --- a/src/otclient/core/creature.h +++ b/src/otclient/core/creature.h @@ -46,9 +46,12 @@ public: void setOutfit(const Outfit& outfit); void setLight(const Light& light) { m_light = light; } void setSpeed(uint16 speed) { m_speed = speed; } - void setSkull(uint8 skull) { m_skull = skull; } - void setShield(uint8 shield) { m_shield = shield; } - void setEmblem(uint8 emblem) { m_emblem = emblem; } + void setSkull(uint8 skull); + void setShield(uint8 shield); + void setEmblem(uint8 emblem); + void setSkullTexture(const std::string& filename); + void setShieldTexture(const std::string& filename); + void setEmblemTexture(const std::string& filename); void setPassable(bool passable) { m_passable = passable; } void addVolatileSquare(uint8 color); @@ -88,9 +91,8 @@ protected: Outfit m_outfit; Light m_light; uint16 m_speed; - uint8 m_skull; - uint8 m_shield; - uint8 m_emblem; + uint8 m_skull, m_shield, m_emblem; + TexturePtr m_skullTexture, m_shieldTexture, m_emblemTexture; bool m_passable; Color m_volatileSquareColor, m_staticSquareColor; bool m_showVolatileSquare, m_showStaticSquare; diff --git a/src/otclient/luafunctions.cpp b/src/otclient/luafunctions.cpp index 96ba5b4b..fac119e1 100644 --- a/src/otclient/luafunctions.cpp +++ b/src/otclient/luafunctions.cpp @@ -80,6 +80,9 @@ void OTClient::registerLuaFunctions() g_lua.bindClassMemberFunction("getName", &Creature::getName); g_lua.bindClassMemberFunction("setOutfit", &Creature::setOutfit); g_lua.bindClassMemberFunction("getOutfit", &Creature::getOutfit); + g_lua.bindClassMemberFunction("setSkullTexture", &Creature::setSkullTexture); + g_lua.bindClassMemberFunction("setShieldTexture", &Creature::setShieldTexture); + g_lua.bindClassMemberFunction("setEmblemTexture", &Creature::setEmblemTexture); g_lua.registerClass(); g_lua.registerClass();