Advertisement
Guest User

Xnxx

a guest
Jan 6th, 2015
637
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.93 KB | None | 0 0
  1. case 12070://TwilightDance
  2. {
  3. if (CanUseSpell(spell, attacker.Owner))
  4. {
  5. PrepareSpell(spell, attacker.Owner);
  6. LayTrapThree Line = new LayTrapThree(attacker.X,
  7. X, attacker.Y, Y, 15);
  8.  
  9. SpellUse suse = new SpellUse(true);
  10. suse.Attacker = attacker.UID;
  11. suse.Attacker1 = attacker.UID;
  12.  
  13. suse.SpellID = SpellID;
  14. suse.SpellUseSpell = UseSpell;
  15. suse.SpellLevel = attacker.Owner.Spells[SpellID].Level;
  16. suse.X = X;
  17. suse.Y = Y;
  18.  
  19. int Stamp = 300;
  20. ushort Color = 2;
  21. List<Network.GamePackets.FloorItem> Items = new List<FloorItem>();
  22. foreach (var coords in Line.LCoords)
  23. {
  24. if (!attacker.FloorSpells.ContainsKey(SpellID))
  25. attacker.FloorSpells.TryAdd(SpellID, new Game.Features.FloorSpell.ClientFloorSpells(attacker.UID, X, Y, suse.SpellUseSpell, spell));
  26.  
  27. var FloorItem = new Game.Features.FloorSpell(40, (ushort)coords.X, (ushort)coords.Y, Color, spell, Stamp);
  28. attacker.FloorSpells[spellID].AddItem(FloorItem);
  29. Color++;
  30. Stamp += 400;
  31.  
  32. attacker.Owner.SendScreen(FloorItem.FloorPacket, true);
  33. }
  34.  
  35. attacker.Owner.SendScreen(suse, true);
  36. }
  37. break;
  38. }
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53. using System;
  54. using System.Collections.Generic;
  55. using System.Linq;
  56. using System.Text;
  57.  
  58. namespace Conquer_Online_Server.Game.Features
  59. {
  60. public class FloorSpell
  61. {
  62. public Time32 Stamp = new Time32();
  63. public Network.GamePackets.FloorItem FloorPacket;
  64. public Database.SpellInformation DBSkill;
  65. public FloorSpell(uint ID, ushort X, ushort Y, ushort color, Database.SpellInformation _DBSkill, int MillisecondsStamp)
  66. {
  67. FloorPacket = new Network.GamePackets.FloorItem(true);
  68. FloorPacket.UID = Network.GamePackets.FloorItem.FloorUID.Next;
  69. FloorPacket.ItemID = ID;
  70. FloorPacket.X = X;
  71. FloorPacket.Y = Y;
  72. FloorPacket.ItemColor = (Enums.Color)color;
  73. FloorPacket.Type = Network.GamePackets.FloorItem.Effect;
  74.  
  75. Stamp = Time32.Now.AddMilliseconds(MillisecondsStamp);
  76. DBSkill = _DBSkill;
  77. }
  78.  
  79.  
  80.  
  81. public unsafe class ClientFloorSpells
  82. {
  83. public List<FloorSpell> Spells = new List<FloorSpell>();
  84. public Network.GamePackets.SpellUse SpellPacket;
  85. public Database.SpellInformation DBSkill;
  86. public ushort X;
  87. public ushort Y;
  88. public byte LevelHu;
  89. public uint UID;
  90. private object SyncRoot;
  91.  
  92. public ClientFloorSpells(uint _UID, ushort _X, ushort _Y, byte _LevelHu, Database.SpellInformation _DBSkill)
  93. {
  94. DBSkill = _DBSkill;
  95. SyncRoot = new object();
  96. X = _X;
  97. Y = _Y;
  98. LevelHu = _LevelHu;
  99. UID = _UID;
  100.  
  101. }
  102. public void CreateMsgSpell(uint Target)
  103. {
  104. SpellPacket = new Network.GamePackets.SpellUse(true);
  105. SpellPacket.Attacker = UID;
  106. SpellPacket.Attacker1 = Target;
  107. SpellPacket.X = X;
  108. SpellPacket.Y = Y;
  109. SpellPacket.SpellID = DBSkill.ID;
  110. SpellPacket.SpellLevel = DBSkill.Level;
  111. SpellPacket.soul = LevelHu;
  112. }
  113.  
  114. public bool CheckInvocke(Time32 Now, FloorSpell spell)
  115. {
  116. if (Now > spell.Stamp)
  117. {
  118. return true;
  119. }
  120. return false;
  121. }
  122. public void RemoveItem(FloorSpell item)
  123. {
  124. lock (SyncRoot)
  125. Spells.Remove(item);
  126. }
  127. public void SendView(Client.GameState client)
  128. {
  129. client.SendScreen(SpellPacket, true);
  130. }
  131.  
  132. public void AddItem(FloorSpell item)
  133. {
  134. lock (SyncRoot)
  135. Spells.Add(item);
  136. }
  137. }
  138. }
  139. }
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153. public static void CreateTimerFactories()
  154. {
  155. MonsterBuffers = new TimerRule<GameState>(monsterBuffersCallback, 500);
  156. Guards = new TimerRule<GameState>(guardsCallback, 700);
  157. MatrixMobs = new TimerRule<GameState>(MatrixMobsCallback, 700);
  158. AliveMonsters = new TimerRule<GameState>(aliveMonstersCallback, 500);
  159. Items = new TimerRule<GameState>(itemsCallback, 1000);
  160. FloorSpells = new TimerRule<GameState>(FloorSpellsCallBack, 100);
  161. }
  162. private static void FloorSpellsCallBack(GameState client, int time)
  163. {
  164. if (!client.Socket.Alive)
  165. {
  166. client.Screen.DisposeTimers();
  167. return;
  168. }
  169. if (client.Entity == null)
  170. return;
  171. if (client.Map == null)
  172. return;
  173. Time32 Now = new Time32(time);
  174. if (client.Entity.FloorSpells.Count != 0)
  175. {
  176. foreach (var ID in client.Entity.FloorSpells)
  177. {
  178. switch (ID.Key)
  179. {
  180. case 12070://TwilightDance:
  181. {
  182. var spellclient = ID.Value;
  183. Queue<Game.Features.FloorSpell> RemoveSpells = new Queue<Game.Features.FloorSpell>();
  184. foreach (var spell in spellclient.Spells)
  185. {
  186. if (spellclient.CheckInvocke(Now, spell))
  187. {
  188. RemoveSpells.Enqueue(spell);
  189. spellclient.CreateMsgSpell(100);
  190.  
  191. var attack = new Attack(true);
  192. attack.Attacker = client.Entity.UID;
  193. attack.AttackType = Attack.Melee;
  194.  
  195. foreach (Interfaces.IMapObject _obj in client.Screen.Objects)
  196. {
  197. if (_obj == null)
  198. continue;
  199. if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player)
  200. {
  201. var attacked = _obj as Entity;
  202. if (Kernel.GetDistance(spell.FloorPacket.X, spell.FloorPacket.Y, attacked.X, attacked.Y) < 3)
  203. {
  204. if (!Game.Attacking.Handle.CanAttack(client.Entity, attacked, spell.DBSkill, false))
  205. continue;
  206.  
  207. attack.Effect1 = Attack.AttackEffects.None;
  208. uint damage = Game.Attacking.Calculate.Melee(client.Entity, attacked, spell.DBSkill, ref attack, spellclient.LevelHu);
  209. damage += (uint)(damage * 55) / 100;
  210.  
  211. spellclient.SpellPacket.Effect1 = attack.Effect1;
  212. attack.Damage = damage;
  213.  
  214. Game.Attacking.Handle.ReceiveAttack(client.Entity, attacked, attack, damage, spell.DBSkill);
  215.  
  216. spellclient.SpellPacket.AddTarget(attacked.UID, damage, attack);
  217. }
  218. }
  219. else if (_obj.MapObjType == MapObjectType.SobNpc)
  220. {
  221. var attackedsob = _obj as SobNpcSpawn;
  222.  
  223. if (Kernel.GetDistance(spell.FloorPacket.X, spell.FloorPacket.Y, attackedsob.X, attackedsob.Y) < 3)
  224. {
  225. if (!Game.Attacking.Handle.CanAttack(client.Entity, attackedsob, spell.DBSkill))
  226. continue;
  227.  
  228. attack.Effect1 = Attack.AttackEffects.None;
  229. uint damage = Game.Attacking.Calculate.Melee(client.Entity, attackedsob, ref attack);
  230.  
  231. attack.Damage = damage;
  232.  
  233. Game.Attacking.Handle.ReceiveAttack(client.Entity, attackedsob, attack, damage, spell.DBSkill);
  234.  
  235. spellclient.SpellPacket.AddTarget(attackedsob.UID, damage, attack);
  236. }
  237. }
  238. }
  239. spellclient.SendView(client);
  240.  
  241. Network.GamePackets.Data datap = new Data(true);
  242. datap.UID = spell.FloorPacket.UID;
  243.  
  244. datap.dwParam = (uint)((spell.FloorPacket.Y << 16) | spell.FloorPacket.X);
  245.  
  246. datap.wParam2 = (ushort)(spell.FloorPacket.Y - 2);
  247. datap.wParam1 = (ushort)(spell.FloorPacket.X - 3);
  248. datap.ID = Network.GamePackets.Data.RemoveTrap;
  249. client.SendScreen(datap, true);
  250.  
  251. spell.FloorPacket.Type = Network.GamePackets.FloorItem.RemoveEffect;
  252. client.SendScreen(spell.FloorPacket, true);
  253. }
  254. }
  255. while (RemoveSpells.Count > 0)
  256. spellclient.RemoveItem(RemoveSpells.Dequeue());
  257.  
  258. if (spellclient.Spells.Count == 0)
  259. {
  260. Game.Features.FloorSpell.ClientFloorSpells FloorSpell;
  261. client.Entity.FloorSpells.TryRemove(spellclient.DBSkill.ID, out FloorSpell);
  262. }
  263. break;
  264. }
  265. }
  266. }
  267. }
  268. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement