gameActorPlayer.lua 57 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576
  1. local gameActorMoveable = require( "actor/gameActorMoveable")
  2. local gameActorPlayer = class('gameActorPlayer', gameActorMoveable)
  3. local gameActorStatePlayerIdle = require( "actor/gameActorStatePlayerIdle" )
  4. local gameActorStatePlayerWalk = require( "actor/gameActorStatePlayerWalk" )
  5. local gameActorStatePlayerRun = require( "actor/gameActorStatePlayerRun" )
  6. local gameActorStatePlayerAttack = require( "actor/gameActorStatePlayerAttack" )
  7. local gameActorStatePlayerSkill = require( "actor/gameActorStatePlayerSkill" )
  8. local gameActorStatePlayerDie = require( "actor/gameActorStatePlayerDie" )
  9. local gameActorStatePlayerStuck = require( "actor/gameActorStatePlayerStuck" )
  10. local gameActorStatePlayerReady = require( "actor/gameActorStatePlayerReady" )
  11. local gameActorStatePlayerMining = require( "actor/gameActorStatePlayerMining" )
  12. local gameActorStatePlayerSitdown = require( "actor/gameActorStatePlayerSitdown" )
  13. local gameActorStatePlayerRideRun = require( "actor/gameActorStatePlayerRideRun" )
  14. local gameActorStatePlayerDash = require( "actor/gameActorStatePlayerDash" )
  15. local gameActorStatePlayerDashWaiting = require( "actor/gameActorStatePlayerDashWaiting" )
  16. local gameActorStatePlayerOnPush = require( "actor/gameActorStatePlayerOnPush" )
  17. local gameActorStatePlayerTeleport = require( "actor/gameActorStatePlayerTeleport" )
  18. local gameActorStatePlayerIdleLock = require( "actor/gameActorStatePlayerIdleLock" )
  19. local gameActorStatePlayerTurn = require( "actor/gameActorStatePlayerTurn" )
  20. local gameActorStatePlayerYTPD = require( "actor/gameActorStatePlayerYTPD" )
  21. local gameActorStatePlayerZXC = require( "actor/gameActorStatePlayerZXC" )
  22. local gameActorStatePlayerSJS = require( "actor/gameActorStatePlayerSJS" )
  23. local gameActorStatePlayerDYZ = require( "actor/gameActorStatePlayerDYZ" )
  24. local gameActorStatePlayerHSQJ = require( "actor/gameActorStatePlayerHSQJ" )
  25. local gameActorStatePlayerFWJ = require( "actor/gameActorStatePlayerFWJ" )
  26. local gameActorStatePlayerJLB = require( "actor/gameActorStatePlayerJLB" )
  27. local gameActorStatePlayerBTXD = require( "actor/gameActorStatePlayerBTXD" )
  28. local gameActorStatePlayerSLP = require( "actor/gameActorStatePlayerSLP" )
  29. local gameActorStatePlayerHXJ = require( "actor/gameActorStatePlayerHXJ" )
  30. local gameActorStatePlayerBGZ = require( "actor/gameActorStatePlayerBGZ" )
  31. local gameActorStatePlayerSYZ = require( "actor/gameActorStatePlayerSYZ" )
  32. local gameActorStatePlayerWJGZ = require( "actor/gameActorStatePlayerWJGZ" )
  33. local gameActorStatePlayerDashFail = require( "actor/gameActorStatePlayerDashFail" )
  34. local gameActorStatePlayerSBYS = require( "actor/gameActorStatePlayerSBYS" )
  35. local gameActorStatePlayerAssassinRun = require( "actor/gameActorStatePlayerAssassinRun" )
  36. local gameActorStatePlayerAssassinSneak = require( "actor/gameActorStatePlayerAssassinSneak" )
  37. local gameActorStatePlayerAssassinSmite = require( "actor/gameActorStatePlayerAssassinSmite" )
  38. local gameActorStatePlayerAssassinSkill = require( "actor/gameActorStatePlayerAssassinSkill" )
  39. local gameActorStatePlayerAssassinSY = require( "actor/gameActorStatePlayerAssassinSY" )
  40. local gameActorStatePlayerAssassinUnknown = require( "actor/gameActorStatePlayerAssassinUnknown" )
  41. local gameActorStatePlayerAssassinXFT = require( "actor/gameActorStatePlayerAssassinXFT" )
  42. local gameActorStatePlayerJY = require( "actor/gameActorStatePlayerJY" )
  43. local gameActorStatePlayerJY2 = require( "actor/gameActorStatePlayerJY2" )
  44. local gameActorStatePlayerTSZ = require( "actor/gameActorStatePlayerTSZ" )
  45. local gameActorStatePlayerXLFH = require( "actor/gameActorStatePlayerXLFH" )
  46. local gameActorStatePlayerCustom = require( "actor/gameActorStatePlayerCustom" )
  47. local actorFeatureID = require( "actor/actorFeatureID" )
  48. local optionsUtils = requireProxy( "optionsUtils" )
  49. local actorUtils = requireProxy( "actorUtils" )
  50. function gameActorPlayer:checkAndCreateAvatarNode(avatar, tag)
  51. local node = avatar:getChildByTag( tag )
  52. if not node then
  53. node = cc.Node:create()
  54. node:setCascadeColorEnabled( true )
  55. node:setCascadeOpacityEnabled( true )
  56. avatar:addChild( node, 0, tag )
  57. end
  58. return node
  59. end
  60. local walkOnly = SL:GetMetaValue("GAME_DATA","gameOption_WalkOnly") == 1
  61. local horseHair= SL:GetMetaValue("GAME_DATA","horse_hair") == 1
  62. local mmo = global.MMO
  63. local mapActAnim_WalkOnly = {
  64. [mmo.ACTION_IDLE] = mmo.ANIM_IDLE,
  65. [mmo.ACTION_WALK] = walkOnly and mmo.ANIM_RUN or mmo.ANIM_WALK,
  66. [mmo.ACTION_ATTACK] = mmo.ANIM_ATTACK,
  67. [mmo.ACTION_SKILL] = mmo.ANIM_SKILL,
  68. [mmo.ACTION_DIE] = mmo.ANIM_DIE,
  69. [mmo.ACTION_RUN] = mmo.ANIM_RUN,
  70. [mmo.ACTION_STUCK] = mmo.ANIM_STUCK,
  71. [mmo.ACTION_READY] = mmo.ANIM_READY,
  72. [mmo.ACTION_MINING] = mmo.ANIM_MINING,
  73. [mmo.ACTION_SITDOWN] = mmo.ANIM_SITDOWN,
  74. [mmo.ACTION_DEATH] = mmo.ANIM_DEATH,
  75. [mmo.ACTION_TURN] = mmo.ANIM_IDLE,
  76. [mmo.ACTION_RIDE_RUN] = mmo.ANIM_RUN,
  77. [mmo.ACTION_DASH] = mmo.ANIM_RUN,
  78. [mmo.ACTION_ONPUSH] = mmo.ANIM_RUN,
  79. [mmo.ACTION_DASH_WAITING] = mmo.ANIM_IDLE,
  80. [mmo.ACTION_TELEPORT] = mmo.ANIM_IDLE,
  81. [mmo.ACTION_IDLE_LOCK] = mmo.ANIM_IDLE,
  82. [mmo.ACTION_YTPD] = mmo.ANIM_YTPD,
  83. [mmo.ACTION_ZXC] = mmo.ANIM_ZXC,
  84. [mmo.ACTION_SJS] = mmo.ANIM_SJS,
  85. [mmo.ACTION_DYZ] = mmo.ANIM_DYZ,
  86. [mmo.ACTION_HSQJ] = mmo.ANIM_HSQJ,
  87. [mmo.ACTION_FWJ] = mmo.ANIM_FWJ,
  88. [mmo.ACTION_JLB] = mmo.ANIM_JLB,
  89. [mmo.ACTION_BTXD] = mmo.ANIM_BTXD,
  90. [mmo.ACTION_SLP] = mmo.ANIM_SLP,
  91. [mmo.ACTION_HXJ] = mmo.ANIM_HXJ,
  92. [mmo.ACTION_BGZ] = mmo.ANIM_BGZ,
  93. [mmo.ACTION_SYZ] = mmo.ANIM_SYZ,
  94. [mmo.ACTION_WJGZ] = mmo.ANIM_WJGZ,
  95. [mmo.ACTION_DASH_FAIL] = mmo.ANIM_RUN,
  96. [mmo.ACTION_SBYS] = mmo.ANIM_IDLE,
  97. [mmo.ACTION_ASSASSIN_RUN] = mmo.ANIM_ASSASSIN_RUN, -- 刺客跑步
  98. [mmo.ACTION_ASSASSIN_SNEAK] = mmo.ANIM_ASSASSIN_SNEAK, -- 刺客潜行
  99. [mmo.ACTION_ASSASSIN_SMITE] = mmo.ANIM_ASSASSIN_SMITE, -- 刺客重击
  100. [mmo.ACTION_ASSASSIN_SKILL] = mmo.ANIM_ASSASSIN_SKILL, -- 刺客施法
  101. [mmo.ACTION_ASSASSIN_SY] = mmo.ANIM_ASSASSIN_SY, -- 刺客霜月
  102. [mmo.ACTION_ASSASSIN_UNKNOWN] = mmo.ANIM_ASSASSIN_UNKNOWN, -- 刺客未知动作
  103. [mmo.ACTION_ASSASSIN_XFT] = mmo.ANIM_ASSASSIN_XFT, -- 旋风腿
  104. [mmo.ACTION_JY] = mmo.ANIM_JY, -- 箭雨1
  105. [mmo.ACTION_JY2] = mmo.ANIM_JY2, -- 箭雨2
  106. [mmo.ACTION_TSZ] = mmo.ANIM_TSZ, -- 推山掌
  107. [mmo.ACTION_XLFH] = mmo.ANIM_XLFH, -- 降龙伏虎
  108. }
  109. -- 自定义
  110. for i = mmo.ACTION_CUSTOM_MIN, mmo.ACTION_CUSTOM_MAX, 1 do
  111. mapActAnim_WalkOnly[i] = mmo.ANIM_CUSTOM_MIN + (i - mmo.ACTION_CUSTOM_MIN)
  112. end
  113. -- buff 变型怪物 走代替跑
  114. local mapActAnimBuff = {
  115. [mmo.ACTION_WALK] = mmo.ANIM_RUN,
  116. }
  117. local mapActAnim = {
  118. [mmo.ACTION_IDLE] = mmo.ANIM_IDLE,
  119. [mmo.ACTION_WALK] = mmo.ANIM_WALK,
  120. [mmo.ACTION_ATTACK] = mmo.ANIM_ATTACK,
  121. [mmo.ACTION_SKILL] = mmo.ANIM_SKILL,
  122. [mmo.ACTION_DIE] = mmo.ANIM_DIE,
  123. [mmo.ACTION_RUN] = mmo.ANIM_RUN,
  124. [mmo.ACTION_STUCK] = mmo.ANIM_STUCK,
  125. [mmo.ACTION_READY] = mmo.ANIM_READY,
  126. [mmo.ACTION_MINING] = mmo.ANIM_MINING,
  127. [mmo.ACTION_SITDOWN] = mmo.ANIM_SITDOWN,
  128. [mmo.ACTION_DEATH] = mmo.ANIM_DEATH,
  129. [mmo.ACTION_TURN] = mmo.ANIM_IDLE,
  130. [mmo.ACTION_RIDE_RUN] = mmo.ANIM_RUN,
  131. [mmo.ACTION_DASH] = mmo.ANIM_RUN,
  132. [mmo.ACTION_ONPUSH] = mmo.ANIM_RUN,
  133. [mmo.ACTION_DASH_WAITING] = mmo.ANIM_IDLE,
  134. [mmo.ACTION_TELEPORT] = mmo.ANIM_IDLE,
  135. [mmo.ACTION_IDLE_LOCK] = mmo.ANIM_IDLE,
  136. [mmo.ACTION_YTPD] = mmo.ANIM_YTPD,
  137. [mmo.ACTION_ZXC] = mmo.ANIM_ZXC,
  138. [mmo.ACTION_SJS] = mmo.ANIM_SJS,
  139. [mmo.ACTION_DYZ] = mmo.ANIM_DYZ,
  140. [mmo.ACTION_HSQJ] = mmo.ANIM_HSQJ,
  141. [mmo.ACTION_FWJ] = mmo.ANIM_FWJ,
  142. [mmo.ACTION_JLB] = mmo.ANIM_JLB,
  143. [mmo.ACTION_BTXD] = mmo.ANIM_BTXD,
  144. [mmo.ACTION_SLP] = mmo.ANIM_SLP,
  145. [mmo.ACTION_HXJ] = mmo.ANIM_HXJ,
  146. [mmo.ACTION_BGZ] = mmo.ANIM_BGZ,
  147. [mmo.ACTION_SYZ] = mmo.ANIM_SYZ,
  148. [mmo.ACTION_WJGZ] = mmo.ANIM_WJGZ,
  149. [mmo.ACTION_DASH_FAIL] = mmo.ANIM_RUN,
  150. [mmo.ACTION_SBYS] = mmo.ANIM_IDLE,
  151. [mmo.ACTION_ASSASSIN_RUN] = mmo.ANIM_ASSASSIN_RUN, -- 刺客跑步
  152. [mmo.ACTION_ASSASSIN_SNEAK] = mmo.ANIM_ASSASSIN_SNEAK, -- 刺客潜行
  153. [mmo.ACTION_ASSASSIN_SMITE] = mmo.ANIM_ASSASSIN_SMITE, -- 刺客重击
  154. [mmo.ACTION_ASSASSIN_SKILL] = mmo.ANIM_ASSASSIN_SKILL, -- 刺客施法
  155. [mmo.ACTION_ASSASSIN_SY] = mmo.ANIM_ASSASSIN_SY, -- 刺客霜月
  156. [mmo.ACTION_ASSASSIN_UNKNOWN] = mmo.ANIM_ASSASSIN_UNKNOWN, -- 刺客未知动作
  157. [mmo.ACTION_ASSASSIN_XFT] = mmo.ANIM_ASSASSIN_XFT, -- 旋风腿
  158. [mmo.ACTION_JY] = mmo.ANIM_JY, -- 箭雨1
  159. [mmo.ACTION_JY2] = mmo.ANIM_JY2, -- 箭雨2
  160. [mmo.ACTION_TSZ] = mmo.ANIM_TSZ, -- 推山掌
  161. [mmo.ACTION_XLFH] = mmo.ANIM_XLFH, -- 降龙伏虎
  162. }
  163. -- 自定义
  164. for i = mmo.ACTION_CUSTOM_MIN, mmo.ACTION_CUSTOM_MAX, 1 do
  165. mapActAnim[i] = mmo.ANIM_CUSTOM_MIN + (i - mmo.ACTION_CUSTOM_MIN)
  166. end
  167. local featureMapActAnic = {
  168. [mmo.P_F_MONSTER_EFF] = {
  169. [mmo.ANIM_IDLE] = mmo.ANIM_RIDE_IDLE,
  170. [mmo.ANIM_WALK] = mmo.ANIM_RIDE_WALK,
  171. [mmo.ANIM_RUN] = mmo.ANIM_RIDE_RUN,
  172. [mmo.ANIM_DIE] = mmo.ANIM_RIDE_DIE,
  173. [mmo.ACTION_ATTACK] = mmo.ANIM_RIDE_IDLE,
  174. [mmo.ACTION_SKILL] = mmo.ANIM_RIDE_IDLE,
  175. },
  176. [mmo.P_F_HAIR] = {
  177. [mmo.ANIM_IDLE] = mmo.ANIM_RIDE_IDLE,
  178. [mmo.ANIM_WALK] = mmo.ANIM_RIDE_WALK,
  179. [mmo.ANIM_RUN] = mmo.ANIM_RIDE_RUN,
  180. [mmo.ANIM_DIE] = mmo.ANIM_RIDE_DIE,
  181. [mmo.ANIM_ATTACK] = mmo.ANIM_RIDE_IDLE,
  182. [mmo.ANIM_SKILL] = mmo.ANIM_RIDE_IDLE,
  183. }
  184. }
  185. local actSpeedFunc = {
  186. [mmo.ANIM_ATTACK] = gameActorPlayer.GetAttackAnimSpeed,
  187. [mmo.ANIM_SKILL] = gameActorPlayer.GetMagicAnimSpeed,
  188. [mmo.ANIM_MINING] = gameActorPlayer.GetAttackAnimSpeed,
  189. [mmo.ANIM_YTPD] = gameActorPlayer.GetMagicAnimSpeed,
  190. [mmo.ANIM_ZXC] = gameActorPlayer.GetAttackAnimSpeed,
  191. [mmo.ANIM_SJS] = gameActorPlayer.GetAttackAnimSpeed,
  192. [mmo.ANIM_DYZ] = gameActorPlayer.GetAttackAnimSpeed,
  193. [mmo.ANIM_HSQJ] = gameActorPlayer.GetAttackAnimSpeed,
  194. [mmo.ANIM_FWJ] = gameActorPlayer.GetMagicAnimSpeed,
  195. [mmo.ANIM_JLB] = gameActorPlayer.GetMagicAnimSpeed,
  196. [mmo.ANIM_BTXD] = gameActorPlayer.GetMagicAnimSpeed,
  197. [mmo.ANIM_SLP] = gameActorPlayer.GetMagicAnimSpeed,
  198. [mmo.ANIM_HXJ] = gameActorPlayer.GetMagicAnimSpeed,
  199. [mmo.ANIM_BGZ] = gameActorPlayer.GetMagicAnimSpeed,
  200. [mmo.ANIM_SYZ] = gameActorPlayer.GetMagicAnimSpeed,
  201. [mmo.ANIM_WJGZ] = gameActorPlayer.GetMagicAnimSpeed,
  202. [mmo.ANIM_SITDOWN] = gameActorPlayer.GetAttackAnimSpeed,
  203. [mmo.ANIM_ASSASSIN_SMITE] = gameActorPlayer.GetAttackAnimSpeed, -- 刺客重击
  204. [mmo.ANIM_ASSASSIN_SKILL] = gameActorPlayer.GetAttackAnimSpeed, -- 刺客施法
  205. [mmo.ANIM_ASSASSIN_SY] = gameActorPlayer.GetAttackAnimSpeed, -- 刺客霜月
  206. [mmo.ANIM_ASSASSIN_UNKNOWN] = gameActorPlayer.GetAttackAnimSpeed, -- 刺客未知动作
  207. [mmo.ANIM_ASSASSIN_XFT] = gameActorPlayer.GetAttackAnimSpeed, -- 旋风腿
  208. [mmo.ANIM_JY] = gameActorPlayer.GetMagicAnimSpeed, -- 箭雨1
  209. [mmo.ANIM_JY2] = gameActorPlayer.GetMagicAnimSpeed, -- 箭雨2
  210. [mmo.ANIM_TSZ] = gameActorPlayer.GetAttackAnimSpeed, -- 推山掌
  211. [mmo.ANIM_XLFH] = gameActorPlayer.GetAttackAnimSpeed, -- 降龙伏虎
  212. }
  213. local configActSpeedFunc = {
  214. [mmo.ANIM_YTPD] = true,
  215. [mmo.ANIM_ZXC] = true,
  216. [mmo.ANIM_SJS] = true,
  217. [mmo.ANIM_DYZ] = true,
  218. [mmo.ANIM_HSQJ] = true,
  219. [mmo.ANIM_FWJ] = true,
  220. [mmo.ANIM_JLB] = true,
  221. [mmo.ANIM_BTXD] = true,
  222. [mmo.ANIM_SLP] = true,
  223. [mmo.ANIM_HXJ] = true,
  224. [mmo.ANIM_BGZ] = true,
  225. [mmo.ANIM_SYZ] = true,
  226. [mmo.ANIM_WJGZ] = true,
  227. [mmo.ANIM_ASSASSIN_SMITE] = true, -- 刺客重击
  228. [mmo.ANIM_ASSASSIN_SKILL] = true, -- 刺客施法
  229. [mmo.ANIM_ASSASSIN_SY] = true, -- 刺客霜月
  230. [mmo.ANIM_ASSASSIN_UNKNOWN] = true, -- 刺客未知动作
  231. [mmo.ANIM_ASSASSIN_XFT] = true, -- 旋风腿
  232. [mmo.ANIM_JY] = true, -- 箭雨1
  233. [mmo.ANIM_JY2] = true, -- 箭雨2
  234. [mmo.ANIM_TSZ] = true, -- 推山掌
  235. [mmo.ANIM_XLFH] = true, -- 降龙伏虎
  236. }
  237. -- 自定义
  238. for i = mmo.ANIM_CUSTOM_MIN, mmo.ANIM_CUSTOM_MAX, 1 do
  239. configActSpeedFunc[i] = true
  240. end
  241. local isStateInited = false
  242. local actState = {}
  243. function gameActorPlayer:getPlayerActionState(act)
  244. if act > mmo.ACTION_MAX then
  245. return nil
  246. end
  247. if not isStateInited then
  248. actState[mmo.ACTION_IDLE] = gameActorStatePlayerIdle.new()
  249. actState[mmo.ACTION_WALK] = gameActorStatePlayerWalk.new()
  250. actState[mmo.ACTION_RUN] = gameActorStatePlayerRun.new()
  251. actState[mmo.ACTION_ATTACK] = gameActorStatePlayerAttack.new()
  252. actState[mmo.ACTION_SKILL] = gameActorStatePlayerSkill.new()
  253. actState[mmo.ACTION_DIE] = gameActorStatePlayerDie.new()
  254. actState[mmo.ACTION_STUCK] = gameActorStatePlayerStuck.new()
  255. actState[mmo.ACTION_READY] = gameActorStatePlayerReady.new()
  256. actState[mmo.ACTION_MINING] = gameActorStatePlayerMining.new()
  257. actState[mmo.ACTION_SITDOWN] = gameActorStatePlayerSitdown.new()
  258. actState[mmo.ACTION_DEATH] = gameActorStatePlayerDie.new()
  259. actState[mmo.ACTION_TURN] = gameActorStatePlayerTurn.new()
  260. actState[mmo.ACTION_RIDE_RUN] = gameActorStatePlayerRideRun.new()
  261. actState[mmo.ACTION_DASH] = gameActorStatePlayerDash.new()
  262. actState[mmo.ACTION_ONPUSH] = gameActorStatePlayerOnPush.new()
  263. actState[mmo.ACTION_DASH_WAITING] = gameActorStatePlayerDashWaiting.new()
  264. actState[mmo.ACTION_TELEPORT] = gameActorStatePlayerTeleport.new()
  265. actState[mmo.ACTION_IDLE_LOCK] = gameActorStatePlayerIdleLock.new()
  266. actState[mmo.ACTION_YTPD] = gameActorStatePlayerYTPD.new()
  267. actState[mmo.ACTION_ZXC] = gameActorStatePlayerZXC.new()
  268. actState[mmo.ACTION_SJS] = gameActorStatePlayerSJS.new()
  269. actState[mmo.ACTION_DYZ] = gameActorStatePlayerDYZ.new()
  270. actState[mmo.ACTION_HSQJ] = gameActorStatePlayerHSQJ.new()
  271. actState[mmo.ACTION_FWJ] = gameActorStatePlayerFWJ.new()
  272. actState[mmo.ACTION_JLB] = gameActorStatePlayerJLB.new()
  273. actState[mmo.ACTION_BTXD] = gameActorStatePlayerBTXD.new()
  274. actState[mmo.ACTION_SLP] = gameActorStatePlayerSLP.new()
  275. actState[mmo.ACTION_HXJ] = gameActorStatePlayerHXJ.new()
  276. actState[mmo.ACTION_BGZ] = gameActorStatePlayerBGZ.new()
  277. actState[mmo.ACTION_SYZ] = gameActorStatePlayerSYZ.new()
  278. actState[mmo.ACTION_WJGZ] = gameActorStatePlayerWJGZ.new()
  279. actState[mmo.ACTION_DASH_FAIL] = gameActorStatePlayerDashFail.new()
  280. actState[mmo.ACTION_SBYS] = gameActorStatePlayerSBYS.new()
  281. actState[mmo.ACTION_ASSASSIN_RUN] = gameActorStatePlayerAssassinRun.new() -- 刺客跑步
  282. actState[mmo.ACTION_ASSASSIN_SNEAK] = gameActorStatePlayerAssassinSneak.new() -- 刺客潜行
  283. actState[mmo.ACTION_ASSASSIN_SMITE] = gameActorStatePlayerAssassinSmite.new() -- 刺客重击
  284. actState[mmo.ACTION_ASSASSIN_SKILL] = gameActorStatePlayerAssassinSkill.new() -- 刺客施法
  285. actState[mmo.ACTION_ASSASSIN_SY] = gameActorStatePlayerAssassinSY.new() -- 刺客霜月
  286. actState[mmo.ACTION_ASSASSIN_UNKNOWN] = gameActorStatePlayerAssassinUnknown.new() -- 刺客未知动作
  287. actState[mmo.ACTION_ASSASSIN_XFT] = gameActorStatePlayerAssassinXFT.new() -- 旋风腿
  288. actState[mmo.ACTION_JY] = gameActorStatePlayerJY.new() -- 箭雨1
  289. actState[mmo.ACTION_JY2] = gameActorStatePlayerJY2.new() -- 箭雨2
  290. actState[mmo.ACTION_TSZ] = gameActorStatePlayerTSZ.new() -- 推山掌
  291. actState[mmo.ACTION_XLFH] = gameActorStatePlayerXLFH.new() -- 降龙伏虎
  292. -- 自定义
  293. for i = mmo.ACTION_CUSTOM_MIN, mmo.ACTION_CUSTOM_MAX, 1 do
  294. actState[i] = gameActorStatePlayerCustom.new(i, i - mmo.ACTION_CUSTOM_MIN + mmo.ANIM_CUSTOM_MIN)
  295. end
  296. isStateInited = true
  297. end
  298. return actState[act]
  299. end
  300. function gameActorPlayer:ctor()
  301. gameActorPlayer.super.ctor(self)
  302. end
  303. function gameActorPlayer:init()
  304. gameActorPlayer.super.init(self)
  305. self.mCurrentState = self:getPlayerActionState( self.mAction )
  306. self.mIsArrived = true
  307. self.mIsConfirmed = true
  308. self.mActionHandler = nil
  309. self.mCurrentActT = 0
  310. self.mDashWaiting = false -- 野蛮等待
  311. self.mOnPushIdleT = 0 -- 被野蛮等待时间
  312. self.mAnimPrepare = 0.0
  313. self.mMoveOrient = cc.p( 0.0, 0.0 )
  314. self.mTargePos = cc.p( 0.0, 0.0 )
  315. self.mDistanceToTarget = 0.0
  316. self.mAnimAct = mmo.ANIM_IDLE
  317. self.mIsAnimNeedToUpdate = false
  318. self.mCurrPlayerAvatarNode = nil
  319. self.mAnimationWeapon = nil
  320. self.mAnimationShield = nil
  321. self.mAnimationWings = nil
  322. self.mAnimationHair = nil
  323. self.mAnimationMonster = nil
  324. self.mAnimationWeaponEff = nil
  325. self.mAnimationShieldEffect = nil
  326. self.mAnimationLeftWeapon = nil
  327. self.mAnimationLeftWeaponEff = nil
  328. self.mStopAnimFrameIndex = nil
  329. self.mAnimationElapsed = nil
  330. self.mFeatureDirty = false
  331. self.mFeature = {}
  332. self.mFeature[mmo.P_F_CLOTH] = actorFeatureID.new( -1 )
  333. self.mFeature[mmo.P_F_WEAPON] = actorFeatureID.new( -1 )
  334. self.mFeature[mmo.P_F_SHIELD] = actorFeatureID.new( -1 )
  335. self.mFeature[mmo.P_F_WINGS] = actorFeatureID.new( -1 )
  336. self.mFeature[mmo.P_F_HAIR] = actorFeatureID.new( -1 )
  337. self.mFeature[mmo.P_F_MONSTER] = actorFeatureID.new( -1 )
  338. self.mFeature[mmo.P_F_WEAPON_EFF] = actorFeatureID.new( -1 )
  339. self.mFeature[mmo.P_F_MONSTER_EFF] = actorFeatureID.new( -1 )
  340. self.mFeature[mmo.P_F_MONSTER_CLOTH] = actorFeatureID.new( -1 )
  341. self.mFeature[mmo.P_F_SHIELD_EFF] = actorFeatureID.new( -1 )
  342. self.mFeature[mmo.P_F_LEFT_WEAPON] = actorFeatureID.new( -1 )
  343. self.mFeature[mmo.P_F_LEFT_WEAPON_EFF] = actorFeatureID.new( -1 )
  344. self.mHP = 0
  345. self.mMaxHP = 0
  346. self.mMP = 0
  347. self.mMaxMP = 0
  348. self.mHUDUI = {}
  349. self.mForce = 0
  350. self.mMaxForce = 0
  351. self.mSex = mmo.ACTOR_PLAYER_SEX_F
  352. self.mJobID = mmo.ACTOR_PLAYER_JOB_FIGHTER
  353. self.mLevel = 0
  354. self.mTeamState = 0
  355. self.isOffLine = nil
  356. self.mNearShow = 0
  357. self.mAttacked = false -- 是否被攻击过 没被攻击过 刚刚进视野要是满血状态 2021-11-6 文华提的需求
  358. self.mMouleHorse = nil -- 坐骑状态区分(0:单人 1:双人 2:连体)
  359. self.mMoveEff = nil -- 移动足迹特效
  360. self.mMoveEffSkip = nil -- 移动足迹特效跳过一步走
  361. self.mIsSkip = nil -- 移动足迹特效 是否跳过一步(0:跳过 1:不跳过)
  362. self.mDearID = "" -- 夫妻ID
  363. self.mSiTuID = "" -- 师徒ID
  364. self.mReLevel = 0 -- 转生颜色变色,转生等级
  365. self.mReLvRadom = nil -- 转生颜色变色,取actor的ID的后5位数值用作随机数
  366. self.mReLvTimeCount= -1 -- 转生颜色变色,记录间隔时间
  367. self.mHateID = nil -- 仇恨
  368. end
  369. function gameActorPlayer:destory()
  370. gameActorPlayer.super.destory(self)
  371. -- remove hud
  372. global.HUDManager:RemoveActorAllHUD( self.mID )
  373. end
  374. function gameActorPlayer:Tick(dt)
  375. gameActorPlayer.super.Tick(self, dt)
  376. if not self.skipOneTick then
  377. self.mCurrentState:Tick( dt, self )
  378. else
  379. self.skipOneTick = nil
  380. end
  381. if self.mFeatureDirty then
  382. self.mFeatureDirty = false
  383. self:checkFeature()
  384. end
  385. if self.mIsAnimNeedToUpdate then
  386. self:updateAnimation()
  387. self.mIsAnimNeedToUpdate = false
  388. end
  389. if self.mReLevel > 0 and actorUtils.actorIsReLvChange() then
  390. if not self.mReLvRadom then
  391. self.mReLvRadom = tonumber( string.sub(self:GetID() or "", -6) )
  392. end
  393. if actorUtils.actorReLvChange(self, self.mReLvRadom, self.mReLvTimeCount) then
  394. self.mReLvTimeCount = 0
  395. end
  396. self.mReLvTimeCount = self.mReLvTimeCount + dt
  397. end
  398. end
  399. function gameActorPlayer:setPosition(x, y)
  400. gameActorPlayer.super.setPosition(self, x, y)
  401. -- refresh zOrder
  402. if self.mAction == mmo.ACTION_DIE then
  403. self:GetNode():setLocalZOrder( -(y) + self:GetAdditionZorder() + mmo.DieAddZorder )
  404. else
  405. self:GetNode():setLocalZOrder( -(y) + self:GetAdditionZorder())
  406. end
  407. -- update hud pos
  408. local hudTop = self:GetHUDTop()
  409. global.HUDManager:setPosition( self.mID, x, y + hudTop )
  410. -- update buff pos
  411. global.BuffManager:setPosition(self:GetID(), x, y)
  412. global.ActorEffectManager:setPosition(self:GetID(), x, y)
  413. --update light pos
  414. local light = self:GetLightID()
  415. if light then
  416. global.darkNodeManager:updateNode(light, {x = x, y = y, offset = cc.p(0, global.MMO.PLAYER_AVATAR_OFFSET.y)})
  417. end
  418. end
  419. function gameActorPlayer:SetMoveTo( pos )
  420. self.mMoveTo = pos
  421. end
  422. function gameActorPlayer:SetAction(newAction, isTerminate)
  423. if not isTerminate then isTerminate = false end
  424. local stateNew = self:getPlayerActionState( newAction )
  425. local stateOld = self.mCurrentState
  426. local oldAction = self.mAction
  427. if self.mCurrentState:ChangeState( stateNew, self, isTerminate ) then
  428. if 0 ~= stateOld then
  429. stateOld:OnExit( self )
  430. end
  431. self.mAction = newAction
  432. if 0 ~= stateNew then
  433. stateNew:OnEnter( self )
  434. end
  435. if (isTerminate or oldAction ~= newAction) and self:GetAnimPrepare() <= 0 then
  436. local actAnim = self:GetValueByKey("IS_MON_AVATAR_ONLY_WALK") and mapActAnimBuff[newAction] or (walkOnly and not (self:IsHumanoid() or self:IsHero())) and mapActAnim_WalkOnly[newAction] or mapActAnim[newAction]
  437. self:SetAnimAct( actAnim )
  438. --
  439. if stateNew ~= mmo.ACTION_IDLE then
  440. self.skipOneTick = true
  441. end
  442. end
  443. end
  444. end
  445. function gameActorPlayer:SetAnimAct(newAnim)
  446. if self.mAnimAct ~= newAnim then
  447. self.mAnimAct = newAnim
  448. -- in die anim, zOrder is lowest
  449. if newAnim == mmo.ANIM_DIE then
  450. self:GetNode():setLocalZOrder( -self:getPosition().y + self:GetAdditionZorder() + mmo.DieAddZorder )
  451. end
  452. end
  453. end
  454. function gameActorPlayer:SetHPHUD(HP, maxHP)
  455. local preHp = self.mHP
  456. self:SetHP(HP)
  457. self:SetMaxHP(maxHP)
  458. self:SetKeyValue(mmo.HUD_Hp_Full, self.mHP >= self.mMaxHP and self.mMaxHP > 0)
  459. self:SetKeyValue(mmo.HUD_Hp_Null, self.mHP < 1 or self.mMaxHP < 1)
  460. local bar = self.mHUDUI[mmo.HUDHPUI_BAR]
  461. if not bar then
  462. return false
  463. end
  464. if preHp > HP then
  465. self:SetKeyValue(mmo.HUD_BAR_SHOW_FULL_HP, true)
  466. end
  467. local hpPerc = HP / maxHP
  468. if global.ConstantConfig.showFewHp == 1 and not self:GetValueByKey(mmo.HUD_BAR_SHOW_FULL_HP) then
  469. local HeroPropertyProxy = global.Facade:retrieveProxy(global.ProxyTable.HeroPropertyProxy)
  470. local heroActor = HeroPropertyProxy:GetHeroActor()
  471. local mainPlayer = global.gamePlayerController:GetMainPlayer()
  472. if self ~= heroActor and self ~= mainPlayer then
  473. hpPerc = 1
  474. end
  475. end
  476. global.HUDManager:SetHUDBarPercent( bar, hpPerc )
  477. optionsUtils:InitHUDVisibleValue(self, mmo.HUD_HPBAR_VISIBLE)
  478. optionsUtils:InitHUDVisibleValue(self, mmo.HUD_HMPLabel_VISIBLE)
  479. optionsUtils:CheckHUDHpBarVisible(self)
  480. global.HUDHPManager:Update(self)
  481. end
  482. function gameActorPlayer:SetShieldHUD(MP, maxMP)
  483. self:SetMP( MP )
  484. self:SetMaxMP( maxMP )
  485. if maxMP < 1 then
  486. return false
  487. end
  488. if not self.mHUDUI[mmo.HUDMPUI_BAR] then
  489. return false
  490. end
  491. local bar = self.mHUDUI[mmo.HUDMPUI_BAR]
  492. local percent = MP / maxMP
  493. global.HUDManager:SetHUDBarPercent( bar, percent )
  494. optionsUtils:InitHUDVisibleValue(self, mmo.HUD_MPBAR_VISIBLE)
  495. optionsUtils:CheckHUDMpBarVisible(self)
  496. end
  497. function gameActorPlayer:SetHP(HP)
  498. self.mHP = HP or 0
  499. end
  500. function gameActorPlayer:SetMaxHP(maxHP)
  501. self.mMaxHP = maxHP or 0
  502. end
  503. function gameActorPlayer:GetHP()
  504. return self.mHP
  505. end
  506. function gameActorPlayer:GetMaxHP()
  507. return self.mMaxHP
  508. end
  509. function gameActorPlayer:SetMP(MP)
  510. self.mMP = MP or 0
  511. end
  512. function gameActorPlayer:GetMP()
  513. return self.mMP
  514. end
  515. function gameActorPlayer:SetMaxMP(maxMP)
  516. self.mMaxMP = maxMP or 0
  517. end
  518. function gameActorPlayer:GetMaxMP()
  519. return self.mMaxMP
  520. end
  521. -- 内力值
  522. function gameActorPlayer:SetForce(value)
  523. self.mForce = value
  524. end
  525. function gameActorPlayer:GetForce()
  526. return self.mForce
  527. end
  528. function gameActorPlayer:SetMaxForce(value)
  529. self.mMaxForce = value
  530. end
  531. function gameActorPlayer:GetMaxForce()
  532. return self.mMaxForce
  533. end
  534. function gameActorPlayer:SetNGHUD(force, maxForce)
  535. self:SetForce(force)
  536. self:SetMaxForce(maxForce)
  537. if not maxForce or maxForce <= 0 then
  538. return nil
  539. end
  540. if not self.mHUDUI[global.MMO.HUDNGUI_BAR] then
  541. return
  542. end
  543. local bar = self.mHUDUI[mmo.HUDNGUI_BAR]
  544. local percent = force / maxForce
  545. global.HUDManager:SetHUDBarPercent( bar, percent )
  546. optionsUtils:InitHUDVisibleValue(self, mmo.HUD_NGBAR_VISIBLE)
  547. optionsUtils:CheckHUDNGBarVisible(self)
  548. end
  549. function gameActorPlayer:InitParam()
  550. self.mCurrActorNode = cc.Node:create()
  551. self.mCurrPlayerAvatarNode = cc.Node:create()
  552. self.mCurrActorNode:addChild( self.mCurrPlayerAvatarNode )
  553. self.mCurrPlayerAvatarNode:setTag( mmo.PLAYER_AVATAR_TAG )
  554. self.mCurrPlayerAvatarNode:setCascadeColorEnabled( true )
  555. self.mCurrPlayerAvatarNode:setCascadeOpacityEnabled( true )
  556. self.mCurrPlayerAvatarNode:setPosition( mmo.PLAYER_AVATAR_OFFSET )
  557. self.mCurrMountNode = cc.Node:create()
  558. self.mCurrActorNode:addChild(self.mCurrMountNode)
  559. self.mCurrMountNode:setTag(mmo.PLAYER_MOUNT_TAG)
  560. self.mCurrMountNode:setPosition(mmo.PLAYER_AVATAR_OFFSET)
  561. return 1
  562. end
  563. function gameActorPlayer:animDisplay( anim, isParentzOrer, act, dir, isLoop, zOrder, visible )
  564. if not anim then
  565. return
  566. end
  567. if isParentzOrer then
  568. local parent = anim:getParent()
  569. if parent then
  570. parent:setLocalZOrder( zOrder )
  571. end
  572. else
  573. anim:setLocalZOrder( zOrder )
  574. end
  575. anim:setVisible( visible )
  576. if visible then
  577. local speed = 1
  578. local needStop = true
  579. if act == mmo.ANIM_IDLE then
  580. needStop = false
  581. elseif act == mmo.ANIM_WALK or act == mmo.ANIM_ASSASSIN_SNEAK then
  582. speed = self:GetWalkSpeed()
  583. -- needStop = false
  584. elseif act == mmo.ANIM_RUN or act == mmo.ANIM_ASSASSIN_RUN then
  585. local isWalkOnly = walkOnly or self:GetValueByKey("IS_MON_AVATAR_ONLY_WALK") or false
  586. local runOneSpeed = self:GetValueByKey(global.MMO.IS_RUN_ONE) and 2 or 1
  587. speed = (isWalkOnly and runOneSpeed == 1 and not (self:IsHumanoid() or self:IsHero())) and self:GetWalkSpeed() / 2 or self:GetRunSpeed() / runOneSpeed
  588. needStop = ((not isWalkOnly and runOneSpeed == 1) or (self:IsHumanoid() or self:IsHero()))
  589. elseif configActSpeedFunc[act] then
  590. local SkillPoxy = global.Facade:retrieveProxy(global.ProxyTable.Skill)
  591. local actoionSpeed = SkillPoxy:GetSkillActionSpeed(act)
  592. if actoionSpeed == 0 then
  593. speed = self:GetAttackAnimSpeed()
  594. elseif actoionSpeed == 1 then
  595. speed = self:GetMagicAnimSpeed()
  596. elseif actSpeedFunc[act] then
  597. local getSpeedFunc = actSpeedFunc[act]
  598. speed = getSpeedFunc(self)
  599. end
  600. elseif actSpeedFunc[act] then
  601. local getSpeedFunc = actSpeedFunc[act]
  602. speed = getSpeedFunc(self)
  603. end
  604. if needStop then
  605. anim:Stop()
  606. end
  607. anim:SyncElapsed( self.mAnimationElapsed )
  608. anim:Play( act, dir, isLoop, speed )
  609. else
  610. anim:Stop()
  611. end
  612. end
  613. function gameActorPlayer:stopAnimToFrame( frameIndex )
  614. self.mStopAnimFrameIndex = frameIndex
  615. end
  616. function gameActorPlayer:StopAllAnimation( frameIndex )
  617. local isForceLastFrame = frameIndex == 6
  618. if self.mAnimation then
  619. self.mAnimation:Stop( frameIndex, self.mAnimAct, self.mOrient, isForceLastFrame )
  620. end
  621. if self.mAnimationWeapon then
  622. self.mAnimationWeapon:Stop( frameIndex, self.mAnimAct, self.mOrientx, isForceLastFrame )
  623. end
  624. if self.mAnimationShield then
  625. self.mAnimationShield:Stop( frameIndex, self.mAnimAct, self.mOrient, isForceLastFrame )
  626. end
  627. if self.mAnimationWings then
  628. self.mAnimationWings:Stop( frameIndex, self.mAnimAct, self.mOrient, isForceLastFrame )
  629. end
  630. if self.mAnimationHair then
  631. self.mAnimationHair:Stop( frameIndex, self.mAnimAct, self.mOrient, isForceLastFrame )
  632. end
  633. if self.mAnimationMonster then
  634. self.mAnimationMonster:Stop( frameIndex, self.mAnimAct, self.mOrient, isForceLastFrame )
  635. end
  636. if self.mAnimationWeaponEff then
  637. self.mAnimationWeaponEff:Stop( frameIndex, self.mAnimAct, self.mOrient, isForceLastFrame )
  638. end
  639. if self.mAnimationShieldEffect then
  640. self.mAnimationShieldEffect:Stop( frameIndex, self.mAnimAct, self.mOrient, isForceLastFrame )
  641. end
  642. if self.mAnimationLeftWeapon then
  643. self.mAnimationLeftWeapon:Stop( frameIndex, self.mAnimAct, self.mOrientx, isForceLastFrame )
  644. end
  645. if self.mAnimationLeftWeaponEff then
  646. self.mAnimationLeftWeaponEff:Stop( frameIndex, self.mAnimAct, self.mOrientx, isForceLastFrame )
  647. end
  648. end
  649. function gameActorPlayer:updateAnimation()
  650. -- render order by act
  651. local renderOrder = actorUtils.PlayerRenderOrder[self.mAnimAct]
  652. if nil == renderOrder then
  653. renderOrder = actorUtils.PlayerRenderOrder[mmo.ANIM_IDLE]
  654. end
  655. local isLoop = self.mAnimAct == mmo.ANIM_IDLE or self.mAnimAct == mmo.ANIM_WALK or self.mAnimAct == mmo.ANIM_RUN
  656. local showMonster = self.mAnimationMonster ~= nil
  657. local showCloth = not showMonster
  658. local showWeapon = not showMonster
  659. local showShield = not showMonster
  660. local showWings = not showMonster
  661. local showHair = not showMonster
  662. local showMonsterCloth = showMonster
  663. local showMapActAnic = false
  664. if self:GetHorseMasterID() then
  665. showMapActAnic = true
  666. if self:IsDoubleHorse() or self:IsBodyHorse() then
  667. showMonsterCloth = false
  668. else
  669. showHair = horseHair
  670. end
  671. end
  672. local newOrient = self.mOrient
  673. local weaponID = self:GetAnimationWeaponID()
  674. local renderWeaponOrder = actorUtils.PlayerWeaponRenderOrder
  675. if weaponID and renderWeaponOrder and renderWeaponOrder[weaponID*100+self.mAnimAct] then
  676. if renderWeaponOrder[weaponID*100+self.mAnimAct][newOrient+1] then
  677. renderOrder = renderWeaponOrder[weaponID*100+self.mAnimAct]
  678. end
  679. end
  680. -- cloth
  681. self:animDisplay( self.mAnimation, true, self.mAnimAct, self.mOrient, isLoop, renderOrder[newOrient+1][2], showCloth )
  682. -- weapon
  683. self:animDisplay( self.mAnimationWeapon, true, self.mAnimAct, self.mOrient, isLoop, renderOrder[newOrient+1][1], showWeapon )
  684. -- shield
  685. self:animDisplay( self.mAnimationShield, true, self.mAnimAct, self.mOrient, isLoop, renderOrder[newOrient+1][4], showShield )
  686. -- wings
  687. self:animDisplay( self.mAnimationWings, true, self.mAnimAct, self.mOrient, isLoop, renderOrder[newOrient+1][3], showWings )
  688. -- hair
  689. self:animDisplay( self.mAnimationHair, true, showMapActAnic and featureMapActAnic[mmo.P_F_HAIR][self.mAnimAct] or self.mAnimAct, self.mOrient, isLoop, renderOrder[newOrient+1][5], showHair )
  690. -- monster
  691. self:animDisplay( self.mAnimationMonster, true, self.mAnimAct, self.mOrient, isLoop, renderOrder[newOrient+1][2], showMonster )
  692. --weaponEffect
  693. self:animDisplay( self.mAnimationWeaponEff, true, self.mAnimAct, self.mOrient, isLoop, renderOrder[newOrient+1][1], showWeapon )
  694. --monsterEffect
  695. self:animDisplay( self.mAnimationMonsterEff, true, self.mAnimAct, self.mOrient, isLoop, renderOrder[newOrient+1][2]+1, showMonster )
  696. --moster cloth
  697. self:animDisplay( self.mAnimationMonsterCloth, true, showMapActAnic and featureMapActAnic[mmo.P_F_MONSTER_EFF][self.mAnimAct] or self.mAnimAct, self.mOrient, isLoop, renderOrder[newOrient+1][2], showMonsterCloth )
  698. --shield effect
  699. self:animDisplay( self.mAnimationShieldEffect, true, self.mAnimAct, self.mOrient, isLoop, renderOrder[newOrient+1][4], showShield )
  700. --left weapon
  701. self:animDisplay( self.mAnimationLeftWeapon, true, self.mAnimAct, self.mOrient, isLoop, renderOrder[newOrient+1][6], showWeapon )
  702. --left weaponEffect
  703. self:animDisplay( self.mAnimationLeftWeaponEff, true, self.mAnimAct, self.mOrient, isLoop, renderOrder[newOrient+1][6], showWeapon )
  704. -- stop
  705. if self.mStopAnimFrameIndex then
  706. self:StopAllAnimation( self.mStopAnimFrameIndex )
  707. end
  708. --
  709. global.Facade:sendNotification(global.NoticeTable.ActorBuffPresentUpdate, self:GetID())
  710. self.mAnimationElapsed = nil
  711. end
  712. function gameActorPlayer:onSequAnimLoadCompleted(animType, playerID, animID, seqAnim)
  713. if animType == mmo.SFANIM_TYPE_PLAYER or --replay animation to make sure animations are synchronous
  714. animType == mmo.SFANIM_TYPE_WEAPON or
  715. animType == mmo.SFANIM_TYPE_SHIELD or
  716. animType == mmo.SFANIM_TYPE_WINGS then
  717. local player = global.actorManager:GetActor(playerID)
  718. if nil == player then
  719. return
  720. end
  721. -- refresh HUD TOP
  722. if mmo.SFANIM_TYPE_PLAYER == animType then
  723. local pos = cc.p( player:getPosition() )
  724. player:setPosition( pos.x, pos.y )
  725. end
  726. end
  727. end
  728. function gameActorPlayer:IsCloaking()
  729. return (self.mCover[2] == true)
  730. end
  731. function gameActorPlayer:setCloaking(isCloaking, index)
  732. -- 隐身术
  733. self.mCover[index] = isCloaking
  734. self:CalcCover()
  735. end
  736. function gameActorPlayer:CalcCover()
  737. local isInCover = false
  738. for k, v in pairs(self.mCover) do
  739. if v then
  740. isInCover = true
  741. break
  742. end
  743. end
  744. local opacityV = ( isInCover ) and 155 or 255
  745. self.mCurrPlayerAvatarNode:setOpacity( opacityV )
  746. end
  747. function gameActorPlayer:SetLevel(level)
  748. self.mLevel = level
  749. end
  750. function gameActorPlayer:createAnim( ID, animType, lastAnim, tag, parentNode )
  751. local function addTexture(animID, seqAnim)
  752. self:onSequAnimLoadCompleted( animType, self:GetID(), animID, seqAnim )
  753. end
  754. local newAnim = nil
  755. if ID and ID > 0 then
  756. if lastAnim then
  757. if animType == mmo.SFANIM_TYPE_PLAYER then
  758. local sex = self:GetValueByKey( mmo.BUFF_PLAYER_AVATAR_SEX ) or self.mSex
  759. newAnim = global.FrameAnimManager:ResetActorPlayerAnim(lastAnim, ID, sex, self.mAnimAct, addTexture)
  760. elseif animType == mmo.SFANIM_TYPE_WEAPON then
  761. newAnim = global.FrameAnimManager:ResetActorPlayerWeaponAnim(lastAnim, ID, self.mSex, self.mAnimAct, addTexture)
  762. elseif animType == mmo.SFANIM_TYPE_SHIELD then
  763. newAnim = global.FrameAnimManager:ResetActorPlayerShieldAnim(lastAnim, ID, mmo.ACTOR_PLAYER_SEX_M, self.mAnimAct, addTexture)
  764. elseif animType == mmo.SFANIM_TYPE_WINGS then
  765. newAnim = global.FrameAnimManager:ResetActorPlayerWingsAnim(lastAnim, ID, self.mSex, self.mAnimAct, addTexture)
  766. elseif animType == mmo.SFANIM_TYPE_HAIR then
  767. newAnim = global.FrameAnimManager:ResetActorPlayerHairAnim(lastAnim, ID, self.mSex, self.mAnimAct, addTexture)
  768. elseif animType == mmo.SFANIM_TYPE_MONSTER then
  769. local sex = self:GetValueByKey(global.MMO.HORSE_SEX)
  770. newAnim = global.FrameAnimManager:ResetActorMonsterAnim(lastAnim, ID, self.mAnimAct, addTexture,sex)
  771. end
  772. else
  773. if animType == mmo.SFANIM_TYPE_PLAYER then
  774. local sex = self:GetValueByKey( mmo.BUFF_PLAYER_AVATAR_SEX ) or self.mSex
  775. newAnim = global.FrameAnimManager:CreateActorPlayerAnim(ID, sex, self.mAnimAct, addTexture)
  776. elseif animType == mmo.SFANIM_TYPE_WEAPON then
  777. newAnim = global.FrameAnimManager:CreateActorPlayerWeaponAnim(ID, self.mSex, self.mAnimAct, addTexture)
  778. elseif animType == mmo.SFANIM_TYPE_SHIELD then
  779. newAnim = global.FrameAnimManager:CreateActorPlayerShieldAnim(ID, mmo.ACTOR_PLAYER_SEX_M, self.mAnimAct, addTexture)
  780. elseif animType == mmo.SFANIM_TYPE_WINGS then
  781. newAnim = global.FrameAnimManager:CreateActorPlayerWingsAnim(ID, self.mSex, self.mAnimAct, addTexture)
  782. elseif animType == mmo.SFANIM_TYPE_HAIR then
  783. newAnim = global.FrameAnimManager:CreateActorPlayerHairAnim(ID, self.mSex, self.mAnimAct, addTexture)
  784. elseif animType == mmo.SFANIM_TYPE_MONSTER then
  785. local sex = self:GetValueByKey(global.MMO.HORSE_SEX)
  786. newAnim = global.FrameAnimManager:CreateActorMonsterAnim(ID, self.mAnimAct, addTexture, sex)
  787. end
  788. end
  789. end
  790. if newAnim then
  791. newAnim:Stop()
  792. end
  793. if not lastAnim and newAnim then
  794. if nil == tag then
  795. tag = 0
  796. end
  797. if nil == parentNode then
  798. parentNode = self:checkAndCreateAvatarNode( self.mCurrPlayerAvatarNode, tag )
  799. end
  800. parentNode:addChild( newAnim, 0, tag )
  801. end
  802. if lastAnim and not newAnim then
  803. lastAnim:removeFromParent()
  804. end
  805. self:dirtyAnimFlag()
  806. return newAnim
  807. end
  808. function gameActorPlayer:updateCloth(ID)
  809. if 0 == ID then
  810. local jobData = SL:GetMetaValue("GAME_DATA", "MultipleJobSetMap")[self.mJobID]
  811. local isOpenJob = jobData and jobData.isOpen
  812. ID = isOpenJob and jobData.clothFeatureShowID or 9999
  813. end
  814. self.mAnimation = self:createAnim( ID, mmo.SFANIM_TYPE_PLAYER, self.mAnimation, mmo.PLAYER_BODY_TAG )
  815. end
  816. function gameActorPlayer:updateWeapon(ID)
  817. if ID == 9999 then
  818. ID = nil
  819. end
  820. self.mAnimationWeapon = self:createAnim( ID, mmo.SFANIM_TYPE_WEAPON, self.mAnimationWeapon, mmo.PLAYER_WEAPON_TAG )
  821. end
  822. function gameActorPlayer:updateLeftWeapon(ID)
  823. if ID == 9999 then
  824. ID = nil
  825. end
  826. self.mAnimationLeftWeapon = self:createAnim( ID, mmo.SFANIM_TYPE_WEAPON, self.mAnimationLeftWeapon, mmo.PLAYER_LEFT_WEAPON_TAG )
  827. end
  828. function gameActorPlayer:updateShield(ID)
  829. if ID == 9999 then
  830. ID = nil
  831. end
  832. self.mAnimationShield = self:createAnim( ID, mmo.SFANIM_TYPE_SHIELD, self.mAnimationShield, mmo.PLAYER_SHIELD_TAG )
  833. end
  834. function gameActorPlayer:updateWings(ID)
  835. if ID == 9999 then
  836. ID = nil
  837. end
  838. self.mAnimationWings = self:createAnim( ID, mmo.SFANIM_TYPE_WINGS, self.mAnimationWings, mmo.PLAYER_WINGS_TAG )
  839. end
  840. function gameActorPlayer:updateHair(ID)
  841. if 0 == ID then
  842. ID = 9999
  843. end
  844. self.mAnimationHair = self:createAnim( ID, mmo.SFANIM_TYPE_HAIR, self.mAnimationHair, mmo.PLAYER_HAIR_TAG )
  845. end
  846. function gameActorPlayer:updateMonster(ID)
  847. local animType = self:GetValueByKey( mmo.BUFF_PLAYER_AVATAR_SEX ) and mmo.SFANIM_TYPE_PLAYER or mmo.SFANIM_TYPE_MONSTER
  848. self.mAnimationMonster = self:createAnim( ID, animType, self.mAnimationMonster, mmo.PLAYER_MONSTER_TAG )
  849. end
  850. function gameActorPlayer:updateWeaponEffect(ID)
  851. if ID == 9999 then
  852. ID = nil
  853. end
  854. self.mAnimationWeaponEff = self:createAnim( ID, mmo.SFANIM_TYPE_WEAPON, self.mAnimationWeaponEff, mmo.PLAYER_WEAPON_EFF_TAG )
  855. end
  856. function gameActorPlayer:updateLeftWeaponEffect(ID)
  857. if ID == 9999 then
  858. ID = nil
  859. end
  860. self.mAnimationLeftWeaponEff = self:createAnim( ID, mmo.SFANIM_TYPE_WEAPON, self.mAnimationLeftWeaponEff, mmo.PLAYER_LEFT_WEAPON_EFF_TAG )
  861. end
  862. function gameActorPlayer:updateMonsterEffect(ID)
  863. self.mAnimationMonsterEff = self:createAnim( ID, mmo.SFANIM_TYPE_MONSTER, self.mAnimationMonsterEff, mmo.PLAYER_MONSTER_EFF_TAG )
  864. end
  865. function gameActorPlayer:updateMonsterCloth(ID)
  866. self.mAnimationMonsterCloth = self:createAnim( ID, mmo.SFANIM_TYPE_PLAYER, self.mAnimationMonsterCloth, mmo.PLAYER_MONSTER_CLOTH_TAG )
  867. end
  868. function gameActorPlayer:updateShieldEffect(ID)
  869. if ID == 9999 then
  870. ID = nil
  871. end
  872. self.mAnimationShieldEffect = self:createAnim( ID, mmo.SFANIM_TYPE_SHIELD, self.mAnimationShieldEffect, mmo.PLAYER_SHIELD_TAG )
  873. end
  874. function gameActorPlayer:dirtyFeature()
  875. self.mFeatureDirty = true
  876. end
  877. function gameActorPlayer:checkFeature()
  878. self.mAnimationElapsed = self.mAnimation and self.mAnimation:GetElapsed() or nil
  879. local mFe = nil
  880. local needUpdate = false
  881. for i = 1, mmo.P_F_MAX do
  882. mFe = self.mFeature[i]
  883. if mFe:isDirty() then
  884. if i == mmo.P_F_CLOTH then
  885. self:updateCloth( mFe:getFeatureID() )
  886. elseif i == mmo.P_F_WEAPON then
  887. self:updateWeapon( mFe:getFeatureID() )
  888. elseif i == mmo.P_F_SHIELD then
  889. self:updateShield( mFe:getFeatureID() )
  890. elseif i == mmo.P_F_WINGS then
  891. self:updateWings( mFe:getFeatureID() )
  892. elseif i == mmo.P_F_HAIR then
  893. self:updateHair( mFe:getShowID() == 9999 and self.mHiarID or mFe:getFeatureID() )
  894. elseif i == mmo.P_F_MONSTER then
  895. self:updateMonster( mFe:getFeatureID() )
  896. elseif i == mmo.P_F_WEAPON_EFF then
  897. self:updateWeaponEffect( mFe:getFeatureID() )
  898. elseif i == mmo.P_F_MONSTER_EFF then
  899. self:updateMonsterEffect( mFe:getFeatureID() )
  900. elseif i == mmo.P_F_MONSTER_CLOTH then
  901. self:updateMonsterCloth( mFe:getFeatureID() )
  902. elseif i == mmo.P_F_SHIELD_EFF then
  903. self:updateShieldEffect( mFe:getFeatureID())
  904. elseif i == mmo.P_F_LEFT_WEAPON then
  905. self:updateLeftWeapon( mFe:getFeatureID() )
  906. elseif i == mmo.P_F_LEFT_WEAPON_EFF then
  907. self:updateLeftWeaponEffect( mFe:getFeatureID() )
  908. end
  909. mFe:setDirty( false )
  910. needUpdate = true
  911. end
  912. end
  913. self.mAnimationElapsed = needUpdate == true and self.mAnimationElapsed or nil
  914. end
  915. function gameActorPlayer:GetType()
  916. return mmo.ACTOR_PLAYER
  917. end
  918. function gameActorPlayer:GetAvatarNode()
  919. return self.mCurrPlayerAvatarNode
  920. end
  921. function gameActorPlayer:GetAnimationID()
  922. return self.mFeature[mmo.P_F_CLOTH]:getFeatureID()
  923. end
  924. function gameActorPlayer:GetAnimationWeapon()
  925. return self.mAnimationWeapon
  926. end
  927. function gameActorPlayer:GetAnimationWeaponID()
  928. return self.mFeature[mmo.P_F_WEAPON]:getFeatureID()
  929. end
  930. function gameActorPlayer:GetAnimationWeaponEff()
  931. return self.mAnimationWeaponEff
  932. end
  933. function gameActorPlayer:GetAnimationLeftWeapon()
  934. return self.mAnimationLeftWeapon
  935. end
  936. function gameActorPlayer:GetAnimationLeftWeaponID()
  937. return self.mFeature[mmo.P_F_LEFT_WEAPON]:getFeatureID()
  938. end
  939. function gameActorPlayer:GetAnimationLeftWeaponEff()
  940. return self.mAnimationLeftWeaponEff
  941. end
  942. function gameActorPlayer:GetAnimationShield()
  943. return self.mAnimationShield
  944. end
  945. function gameActorPlayer:GetAnimationShieldID()
  946. return self.mFeature[mmo.P_F_SHIELD]:getFeatureID()
  947. end
  948. function gameActorPlayer:GetAnimationShieldEff()
  949. return self.mAnimationShieldEffect
  950. end
  951. function gameActorPlayer:GetAnimationWings()
  952. return self.mAnimationWings
  953. end
  954. function gameActorPlayer:GetAnimationWingsID()
  955. return self.mFeature[mmo.P_F_WINGS]:getFeatureID()
  956. end
  957. function gameActorPlayer:GetAnimationMonster()
  958. return self.mAnimationMonster
  959. end
  960. function gameActorPlayer:GetAnimationHair()
  961. return self.mAnimationHair
  962. end
  963. function gameActorPlayer:GetAnimationHairID()
  964. return self.mFeature[mmo.P_F_HAIR]:getFeatureID()
  965. end
  966. function gameActorPlayer:GetAnimationMount()
  967. return nil
  968. end
  969. function gameActorPlayer:GetAnimAct()
  970. return self.mAnimAct
  971. end
  972. -- 前摇,暂不影响任何动作(仅仅为了表现)
  973. function gameActorPlayer:GetAnimPrepare()
  974. return self.mAnimPrepare
  975. end
  976. function gameActorPlayer:SetAnimPrepare(t)
  977. self.mAnimPrepare = t
  978. end
  979. function gameActorPlayer:GetDashWaiting()
  980. return self.mDashWaiting
  981. end
  982. function gameActorPlayer:SetDashWaiting(b)
  983. self.mDashWaiting = b
  984. end
  985. function gameActorPlayer:IsStallStatus()
  986. return self:GetSellStatus() == 1
  987. end
  988. function gameActorPlayer:SetSellStatus(status)
  989. self.mSellStatus = status
  990. end
  991. function gameActorPlayer:GetSellStatus()
  992. return self.mSellStatus
  993. end
  994. function gameActorPlayer:SetStallName(name)
  995. self.mStallName = name
  996. end
  997. function gameActorPlayer:GetStallName()
  998. return self.mStallName
  999. end
  1000. function gameActorPlayer:SetIsOffLine(state)
  1001. self.isOffLine = state
  1002. end
  1003. function gameActorPlayer:GetIsOffLine()
  1004. return self.isOffLine == 1
  1005. end
  1006. function gameActorPlayer:SetGameActorActionHandler(handler)
  1007. self.mActionHandler = handler
  1008. end
  1009. function gameActorPlayer:GetGameActorActionHandler()
  1010. return self.mActionHandler
  1011. end
  1012. function gameActorPlayer:SetTeamState(state)
  1013. self.mTeamState = state
  1014. end
  1015. function gameActorPlayer:GetTeamState()
  1016. return self.mTeamState
  1017. end
  1018. function gameActorPlayer:SetClothID(id)
  1019. return self.mFeature[mmo.P_F_CLOTH]:setID( id )
  1020. end
  1021. function gameActorPlayer:GetClothID()
  1022. return self.mFeature[mmo.P_F_CLOTH]:getID()
  1023. end
  1024. function gameActorPlayer:SetShowClothID(id)
  1025. return self.mFeature[mmo.P_F_CLOTH]:setShowID( id )
  1026. end
  1027. function gameActorPlayer:GetShowClothID()
  1028. return self.mFeature[mmo.P_F_CLOTH]:getShowID()
  1029. end
  1030. function gameActorPlayer:dirtyCloth()
  1031. self.mFeature[mmo.P_F_CLOTH]:setDirty(true)
  1032. end
  1033. function gameActorPlayer:SetWeaponID(id)
  1034. return self.mFeature[mmo.P_F_WEAPON]:setID( id )
  1035. end
  1036. function gameActorPlayer:GetWeaponID()
  1037. return self.mFeature[mmo.P_F_WEAPON]:getID()
  1038. end
  1039. function gameActorPlayer:SetShowWeaponID(id)
  1040. return self.mFeature[mmo.P_F_WEAPON]:setShowID( id )
  1041. end
  1042. function gameActorPlayer:GetShowWeaponID()
  1043. return self.mFeature[mmo.P_F_WEAPON]:getShowID()
  1044. end
  1045. function gameActorPlayer:SetLeftWeaponID(id)
  1046. return self.mFeature[mmo.P_F_LEFT_WEAPON]:setID( id )
  1047. end
  1048. function gameActorPlayer:GetLeftWeaponID()
  1049. return self.mFeature[mmo.P_F_LEFT_WEAPON]:getID()
  1050. end
  1051. function gameActorPlayer:SetShowLeftWeaponID(id)
  1052. return self.mFeature[mmo.P_F_LEFT_WEAPON]:setShowID( id )
  1053. end
  1054. function gameActorPlayer:GetShowLeftWeaponID()
  1055. return self.mFeature[mmo.P_F_LEFT_WEAPON]:getShowID()
  1056. end
  1057. function gameActorPlayer:SetShieldID(id)
  1058. return self.mFeature[mmo.P_F_SHIELD]:setID( id )
  1059. end
  1060. function gameActorPlayer:GetShieldID()
  1061. return self.mFeature[mmo.P_F_SHIELD]:getID()
  1062. end
  1063. function gameActorPlayer:SetShowShieldID(id)
  1064. return self.mFeature[mmo.P_F_SHIELD]:setShowID(id)
  1065. end
  1066. function gameActorPlayer:GetShowShieldID()
  1067. return self.mFeature[mmo.P_F_SHIELD]:getShowID()
  1068. end
  1069. function gameActorPlayer:SetWingsID(id)
  1070. return self.mFeature[mmo.P_F_WINGS]:setID( id )
  1071. end
  1072. function gameActorPlayer:GetWingsID()
  1073. return self.mFeature[mmo.P_F_WINGS]:getID()
  1074. end
  1075. function gameActorPlayer:SetShowWingsID(id)
  1076. return self.mFeature[mmo.P_F_WINGS]:setShowID( id )
  1077. end
  1078. function gameActorPlayer:GetShowWingsID()
  1079. return self.mFeature[mmo.P_F_WINGS]:getShowID()
  1080. end
  1081. function gameActorPlayer:SetRealHairID(id)
  1082. self.mHiarID = id
  1083. end
  1084. function gameActorPlayer:SetHairID(id)
  1085. return self.mFeature[mmo.P_F_HAIR]:setID( id )
  1086. end
  1087. function gameActorPlayer:GetHairID()
  1088. return self.mFeature[mmo.P_F_HAIR]:getID()
  1089. end
  1090. function gameActorPlayer:SetShowHairID(id)
  1091. return self.mFeature[mmo.P_F_HAIR]:setShowID( id )
  1092. end
  1093. function gameActorPlayer:GetShowHairID()
  1094. return self.mFeature[mmo.P_F_HAIR]:getShowID()
  1095. end
  1096. function gameActorPlayer:dirtyHair()
  1097. self.mFeature[mmo.P_F_HAIR]:setDirty(true)
  1098. end
  1099. function gameActorPlayer:SetMonsterFeatureID(id)
  1100. return self.mFeature[mmo.P_F_MONSTER]:setID( id )
  1101. end
  1102. function gameActorPlayer:GetMonsterFeatureID()
  1103. return self.mFeature[mmo.P_F_MONSTER]:getID()
  1104. end
  1105. function gameActorPlayer:SetWeaponEffectID(id)
  1106. return self.mFeature[mmo.P_F_WEAPON_EFF]:setID( id )
  1107. end
  1108. function gameActorPlayer:GetWeaponEffectID()
  1109. return self.mFeature[mmo.P_F_WEAPON_EFF]:getID()
  1110. end
  1111. function gameActorPlayer:SetShowWeaponEffectID(id)
  1112. return self.mFeature[mmo.P_F_WEAPON_EFF]:setShowID( id )
  1113. end
  1114. function gameActorPlayer:GetShowWeaponEffectID()
  1115. return self.mFeature[mmo.P_F_WEAPON_EFF]:getShowID()
  1116. end
  1117. function gameActorPlayer:SetLeftWeaponEffectID(id)
  1118. return self.mFeature[mmo.P_F_LEFT_WEAPON_EFF]:setID( id )
  1119. end
  1120. function gameActorPlayer:GetLeftWeaponEffectID()
  1121. return self.mFeature[mmo.P_F_LEFT_WEAPON_EFF]:getID()
  1122. end
  1123. function gameActorPlayer:SetShowLeftWeaponEffectID(id)
  1124. return self.mFeature[mmo.P_F_LEFT_WEAPON_EFF]:setShowID( id )
  1125. end
  1126. function gameActorPlayer:GetShowLeftWeaponEffectID()
  1127. return self.mFeature[mmo.P_F_LEFT_WEAPON_EFF]:getShowID()
  1128. end
  1129. function gameActorPlayer:SetShieldEffectID( id )
  1130. return self.mFeature[mmo.P_F_SHIELD_EFF]:setID( id )
  1131. end
  1132. function gameActorPlayer:GetShieldEffectID()
  1133. return self.mFeature[mmo.P_F_SHIELD_EFF]:getID()
  1134. end
  1135. function gameActorPlayer:SetShowShieldEffectID( id )
  1136. return self.mFeature[mmo.P_F_SHIELD_EFF]:setShowID( id )
  1137. end
  1138. function gameActorPlayer:GetShowShieldEffectID()
  1139. return self.mFeature[mmo.P_F_SHIELD_EFF]:getShowID()
  1140. end
  1141. function gameActorPlayer:SetMonsterEffectID(id)
  1142. return self.mFeature[mmo.P_F_MONSTER_EFF]:setID( id )
  1143. end
  1144. function gameActorPlayer:GetMonsterEffectID()
  1145. return self.mFeature[mmo.P_F_MONSTER_EFF]:getID()
  1146. end
  1147. function gameActorPlayer:SetMonsterClothID(id)
  1148. return self.mFeature[mmo.P_F_MONSTER_CLOTH]:setID( id )
  1149. end
  1150. function gameActorPlayer:GetMonsterClothID()
  1151. return self.mFeature[mmo.P_F_MONSTER_CLOTH]:getID()
  1152. end
  1153. function gameActorPlayer:SetSexID( sex )
  1154. self.mSex = sex
  1155. end
  1156. function gameActorPlayer:GetSexID()
  1157. return self.mSex
  1158. end
  1159. function gameActorPlayer:GetJobID()
  1160. return self.mJobID
  1161. end
  1162. function gameActorPlayer:SetJobID(job)
  1163. self.mJobID = job
  1164. end
  1165. function gameActorPlayer:GetLevel()
  1166. return self.mLevel
  1167. end
  1168. function gameActorPlayer:GetMasterID()
  1169. return self.mMasterID
  1170. end
  1171. function gameActorPlayer:SetMasterID(id)
  1172. self.mMasterID = id
  1173. end
  1174. function gameActorPlayer:GetCurrActTime()
  1175. return self.mCurrentActT
  1176. end
  1177. function gameActorPlayer:SetCurrActTime(t)
  1178. self.mCurrentActT = t
  1179. end
  1180. function gameActorPlayer:dirtyAnimFlag()
  1181. if self.mStopAnimFrameIndex then
  1182. return
  1183. end
  1184. self.mIsAnimNeedToUpdate = true
  1185. end
  1186. function gameActorPlayer:Bright()
  1187. if not self.mIsBright then
  1188. self.mIsBright = true
  1189. local isInCover = false
  1190. for k, v in pairs(self.mCover) do
  1191. if v then
  1192. isInCover = true
  1193. break
  1194. end
  1195. end
  1196. local actorAnim = self:GetAnimation()
  1197. if isInCover then
  1198. global.Facade:sendNotification(global.NoticeTable.HighLightNodeShader, actorAnim, mmo.SHADER_TYPE_HIGHTLIGHT_COVER)
  1199. else
  1200. global.Facade:sendNotification(global.NoticeTable.HighLightNodeShader, actorAnim, mmo.SHADER_TYPE_HIGHTLIGHT)
  1201. end
  1202. end
  1203. end
  1204. function gameActorPlayer:SetNearShow(state)
  1205. self.mNearShow = state
  1206. end
  1207. function gameActorPlayer:IsNearShow()
  1208. return self.mNearShow == 1
  1209. end
  1210. --神秘人状态(戴斗笠) 1是神秘人状态
  1211. function gameActorPlayer:SetShenMiRen(value)
  1212. -- body
  1213. self.mShenMiRen = value
  1214. end
  1215. function gameActorPlayer:IsShenMiRen()
  1216. -- body
  1217. return self.mShenMiRen == 1
  1218. end
  1219. --护身
  1220. function gameActorPlayer:SetHuShen(value)
  1221. -- body
  1222. self.mHuShen = value
  1223. end
  1224. function gameActorPlayer:IsHuShen()
  1225. -- body
  1226. return self.mHuShen == 1
  1227. end
  1228. --受到攻击
  1229. function gameActorPlayer:SetDamage(value)
  1230. -- body
  1231. self.mDamage = value
  1232. end
  1233. function gameActorPlayer:IsDamage()
  1234. -- body
  1235. return self.mDamage
  1236. end
  1237. -- 是否是主玩家
  1238. function gameActorPlayer:SetIsMainPlayer(value)
  1239. self.mIsMainPlayer = value
  1240. end
  1241. function gameActorPlayer:IsMainPlayer()
  1242. return self.mIsMainPlayer
  1243. end
  1244. -- 设置国家id
  1245. function gameActorPlayer:SetNationID( id )
  1246. self._nationid = id
  1247. end
  1248. function gameActorPlayer:GetNationID()
  1249. return self._nationid
  1250. end
  1251. function gameActorPlayer:GetHUDTop()
  1252. if not self.mAnimation then
  1253. return 20
  1254. end
  1255. return self.mAnimation:GetHUDTop() or 20
  1256. end
  1257. -- 获取主驾id
  1258. function gameActorPlayer:GetHorseMasterID()
  1259. return self:GetValueByKey(global.MMO.HORSE_MAIN)
  1260. end
  1261. -- 获取副驾id
  1262. function gameActorPlayer:GetHorseCopilotID()
  1263. return self:GetValueByKey(global.MMO.HORSE_COPILOT)
  1264. end
  1265. -- 是否是副驾
  1266. function gameActorPlayer:IsHoreseCopilot()
  1267. return self:GetValueByKey(global.MMO.HORSE_COPILOT) == self:GetID()
  1268. end
  1269. -- 双人坐骑
  1270. function gameActorPlayer:SetDoubleHorse( value )
  1271. self.mMouleHorse = value
  1272. end
  1273. -- 是否是双人坐骑
  1274. function gameActorPlayer:IsDoubleHorse()
  1275. return self.mMouleHorse == 1
  1276. end
  1277. -- 是否是连体坐骑
  1278. function gameActorPlayer:IsBodyHorse()
  1279. return self.mMouleHorse == 2
  1280. end
  1281. function gameActorPlayer:SetMoveEff( value )
  1282. self.mMoveEff = value
  1283. end
  1284. function gameActorPlayer:GetMoveEff()
  1285. return self.mMoveEff
  1286. end
  1287. function gameActorPlayer:IsMoveEff()
  1288. return self.mMoveEff ~= nil
  1289. end
  1290. function gameActorPlayer:SetMoveEffSkipWalk( value )
  1291. self.mMoveEffSkip = value
  1292. end
  1293. function gameActorPlayer:GetMoveEffSkipWalk()
  1294. return self.mMoveEffSkip
  1295. end
  1296. function gameActorPlayer:SetEffSkipWalkSwitch( value )
  1297. self.mIsSkip = value
  1298. end
  1299. function gameActorPlayer:GetEffSkipWalkSwitch()
  1300. return self.mIsSkip
  1301. end
  1302. function gameActorPlayer:SetDearID( value )
  1303. self.mDearID = value
  1304. end
  1305. function gameActorPlayer:GetDearID()
  1306. return self.mDearID
  1307. end
  1308. function gameActorPlayer:SetSiTuID( value )
  1309. self.mSiTuID = value
  1310. end
  1311. function gameActorPlayer:GetSiTuID()
  1312. return self.mSiTuID
  1313. end
  1314. function gameActorPlayer:GetHateID()
  1315. return self.mHateID
  1316. end
  1317. function gameActorPlayer:SetHateID(id)
  1318. self.mHateID = id
  1319. end
  1320. function gameActorPlayer:GetReLevel()
  1321. return self.mReLevel
  1322. end
  1323. function gameActorPlayer:SetReLevel( value )
  1324. self.mReLevel = value
  1325. end
  1326. function gameActorPlayer:GetOnPushIdleTime()
  1327. return self.mOnPushIdleT
  1328. end
  1329. function gameActorPlayer:SetOnPushIdleTime( value )
  1330. self.mOnPushIdleT = value
  1331. end
  1332. return gameActorPlayer