Advertisement
XConquer

Spell Cooldown EXCLUSIVIDAD Total!

Aug 13th, 2018
342
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.29 KB | None | 0 0
  1. Bueno esto es Algo UNICO! y Exclusivo!  
  2.  
  3. 1.- Handler.cs bool CanUseSpell Agregaran :
  4.  if (spell.CanUseSkill(spell.ID)) return false;
  5. ==========================================================
  6. 2.- Handler.cs void PrepareSpell Agregaran:
  7.  if (spell.CoolDown > 0)
  8.     spell.RemoveCooldown(spell.ID);
  9.  
  10. Tener en cuenta: OJO DEBEN PROBAR! SI LES DA ERROR O NO LES DEJA USAR LAS SKILLS NO LO AGREGUEN!
  11. ==========================================================
  12. 3.- Handler.cs EN TODAS LAS HABILIDADES! RECUERDEN BIEN! EN TODAS LAS SKILLS AGREGARAN :
  13. Se Agrega en el If de CanUseSpell, en esa parte osea dentro de esas llaves, por ejemplo:
  14. if(CanUseSpell(attacker,Owner)
  15. {
  16. Codigo de Spell.
  17.  
  18. }
  19.  
  20. y dentro de eso pegan esto :
  21.  
  22.  if (spell.CoolDown > 0)
  23.    {
  24.     spell.AddCooldown(spell.ID, (int)spell.CoolDown);
  25.    }
  26. ===========================================
  27.  
  28. 4.- En SpellTable.cs en la class SpellInformation Agregaremos:
  29.  
  30.  private System.Collections.Concurrent.ConcurrentDictionary<ushort, Native.TIME> Cooldowns;
  31.         public bool RemoveCooldown(ushort skillid)
  32.         {
  33.             KinSocket.Native.TIME time;
  34.             return this.Cooldowns.TryRemove(skillid, out time);
  35.         }
  36.         public void AddCooldown(ushort skillid, int miliseconds)
  37.         {
  38.             if (this.Cooldowns.ContainsKey(skillid))
  39.             {
  40.                 Native.TIME time;
  41.                 this.Cooldowns.TryRemove(skillid, out time);
  42.             }
  43.             this.Cooldowns.TryAdd(skillid, Native.TIME.Now.AddMilliseconds(miliseconds));
  44.         }
  45.         public bool CanUseSkill(ushort skillid)
  46.         {
  47.             if (this.Cooldowns.ContainsKey(skillid))
  48.             {
  49.                 return (Native.TIME.Now >= this.Cooldowns[skillid]);
  50.             }
  51.             return true;
  52.         }
  53.  
  54. ARRIBA DEL TODO EN LA PARTE DE LOS USING`S AGREGAREMOS :
  55. using KinSocket;
  56.  
  57. SI NO TIENEN EL DLL KinSocket Referenciado, Referencienlo.
  58.  
  59. Despues debajo de lo que agregamos, ponemos :
  60. public uint CoolDown;
  61.  
  62. en el Load :
  63. information.CoolDown = Convert.ToUInt32(strArray2[47]);
  64.  
  65. SI USAN EL "Spells" de Navicat dudo mucho que esto les funque. les recomiendo cambiar al Spell Load de MagicType.txt
  66. ==========================================
  67.  
  68. GUIA FINALIZADA TODOS LOS DERECHOS RESERVADOS Pezzi Tomas (C) 2018!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement