Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.34 KB | None | 0 0
  1. -- @docclass Creature
  2.  
  3. -- @docconsts @{
  4.  
  5. SkullNone = 0
  6. SkullYellow = 1
  7. SkullGreen = 2
  8. SkullWhite = 3
  9. SkullRed = 4
  10. SkullBlack = 5
  11. SkullOrange = 6
  12.  
  13. ShieldNone = 0
  14. ShieldWhiteYellow = 1
  15. ShieldWhiteBlue = 2
  16. ShieldBlue = 3
  17. ShieldYellow = 4
  18. ShieldBlueSharedExp = 5
  19. ShieldYellowSharedExp = 6
  20. ShieldBlueNoSharedExpBlink = 7
  21. ShieldYellowNoSharedExpBlink = 8
  22. ShieldBlueNoSharedExp = 9
  23. ShieldYellowNoSharedExp = 10
  24.  
  25. EmblemNone = 0
  26. EmblemFire = 1
  27. EmblemWater = 2
  28. EmblemAir = 3
  29. EmblemEarth = 4
  30.  
  31. -- @}
  32.  
  33. function getSkullImagePath(skullId)
  34.   local path
  35.   if skullId == SkullYellow then
  36.     path = '/images/game/skulls/skull_yellow'
  37.   elseif skullId == SkullGreen then
  38.     path = '/images/game/skulls/skull_green'
  39.   elseif skullId == SkullWhite then
  40.     path = '/images/game/skulls/skull_white'
  41.   elseif skullId == SkullRed then
  42.     path = '/images/game/skulls/skull_red'
  43.   elseif skullId == SkullBlack then
  44.     path = '/images/game/skulls/skull_black'
  45.   elseif skullId == SkullOrange then
  46.     path = '/images/game/skulls/skull_orange'
  47.   end
  48.   return path
  49. end
  50.  
  51. function getShieldImagePathAndBlink(shieldId)
  52.   local path, blink
  53.   if shieldId == ShieldWhiteYellow then
  54.     path, blink = '/images/game/shields/shield_yellow_white', false
  55.   elseif shieldId == ShieldWhiteBlue then
  56.     path, blink = '/images/game/shields//shield_blue_white', false
  57.   elseif shieldId == ShieldBlue then
  58.     path, blink = '/images/game/shields//shield_blue', false
  59.   elseif shieldId == ShieldYellow then
  60.     path, blink = '/images/game/shields//shield_yellow', false
  61.   elseif shieldId == ShieldBlueSharedExp then
  62.     path, blink = '/images/game/shields//shield_blue_shared', false
  63.   elseif shieldId == ShieldYellowSharedExp then
  64.     path, blink = '/images/game/shields//shield_yellow_shared', false
  65.   elseif shieldId == ShieldBlueNoSharedExpBlink then
  66.     path, blink = '/images/game/shields//shield_blue_not_shared', true
  67.   elseif shieldId == ShieldYellowNoSharedExpBlink then
  68.     path, blink = '/images/game/shields//shield_yellow_not_shared', true
  69.   elseif shieldId == ShieldBlueNoSharedExp then
  70.     path, blink = '/images/game/shields//shield_blue_not_shared', false
  71.   elseif shieldId == ShieldYellowNoSharedExp then
  72.     path, blink = '/images/game/shields//shield_yellow_not_shared', false
  73.   end
  74.   return path, blink
  75. end
  76.  
  77. function getEmblemImagePath(emblemId)
  78.   local path
  79.   if emblemId == EmblemFire then
  80.     path = '/images/game/emblems/emblem_fire'
  81.   elseif emblemId == EmblemWater then
  82.     path = '/images/game/emblems/emblem_water'
  83.   elseif emblemId == EmblemAir then
  84.     path = '/images/game/emblems/emblem_air'
  85.   elseif emblemId == EmblemEarth then
  86.     path = '/images/game/emblems/emblem_earth'
  87.   end
  88.   return path
  89. end
  90.  
  91. function Creature:onSkullChange(skullId)
  92.   local imagePath = getSkullImagePath(skullId)
  93.   if imagePath then
  94.     self:setSkullTexture(imagePath)
  95.   end
  96. end
  97.  
  98. function Creature:onShieldChange(shieldId)
  99.   local imagePath, blink = getShieldImagePathAndBlink(shieldId)
  100.   if imagePath then
  101.     self:setShieldTexture(imagePath, blink)
  102.   end
  103. end
  104.  
  105. function Creature:onEmblemChange(emblemId)
  106.     if self:isLocalPlayer() and modules.client_options.getOption('showSelfEmblem') == false then
  107.         return true
  108.     end
  109.   local imagePath = getEmblemImagePath(emblemId)
  110.   if imagePath then
  111.     self:setEmblemTexture(imagePath)
  112.   end
  113. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement