Advertisement
shekohex

Test Clone Attack

Oct 2nd, 2014
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 26.39 KB | None | 0 0
  1.   public static void CloneEntityMelee(Entity MeeToOoAttacker, Entity MeToOoAttacked, SobNpcSpawn MeeToOoAttackedsob, Attack attack)
  2.         {
  3.             // All That By MeToOo Dont CHange Please
  4.             bool pass;
  5.             uint atttacked = 0;
  6.             if (MeToOoAttacked != null)
  7.             {
  8.                 atttacked = MeToOoAttacked.UID;
  9.             }
  10.             uint atttacker = MeeToOoAttacker.UID;
  11.             bool doWep1Spell = false, doWep2Spell = false;
  12.  
  13.             if (MeeToOoAttacker.Owner.Screen.TryGetValue(atttacked, out MeToOoAttacked))
  14.             {
  15.                 CheckForExtraWeaponPowers(MeeToOoAttacker.Owner, MeToOoAttacked);
  16.                 if (!CanAttack(MeeToOoAttacker, MeToOoAttacked, null, attack.AttackType == Attack.Melee)) return;
  17.                 pass = false;
  18.                 if (MeeToOoAttacker.OnFatalStrike())
  19.                 {
  20.                     if (MeToOoAttacked.EntityFlag == EntityFlag.Monster)
  21.                     {
  22.                         pass = true;
  23.                     }
  24.                 }
  25.                 ushort range = MeeToOoAttacker.AttackRange;
  26.                 if (MeeToOoAttacker.Transformed)
  27.                     range = (ushort)MeeToOoAttacker.TransformationAttackRange;
  28.  
  29.                 attack.Effect1 = Attack.AttackEffects1.None;
  30.                 #region epic ninja
  31.                 if (MeeToOoAttacker.EpicNinja())
  32.                 {
  33.                     if (MeeToOoAttacker.Owner.Spells.ContainsKey(12110))
  34.                     {
  35.                         var spell = Database.SpellTable.GetSpell(12110, MeeToOoAttacker.Owner);
  36.                         if (spell != null)
  37.                         {
  38.                             spell.CanKill = true;
  39.                             if (Kernel.Rate(spell.Percent))
  40.                             {
  41.                                 SpellUse suse = new SpellUse(true);
  42.                                 suse.Attacker = MeeToOoAttacker.UID;
  43.                                 suse.SpellID = spell.ID;
  44.                                 suse.SpellLevel = spell.Level;
  45.                                 suse.X = MeeToOoAttacker.X;
  46.                                 suse.Y = MeeToOoAttacker.Y;
  47.                                 IMapObject lastAttacked = MeeToOoAttacker;
  48.                                 if (Handle.CanAttack(MeeToOoAttacker, MeToOoAttacked, spell, false))
  49.                                 {
  50.                                     lastAttacked = MeToOoAttacked;
  51.                                     uint damages = Game.Attacking.Calculate.Melee(MeeToOoAttacker, MeToOoAttacked, spell, ref attack);
  52.                                     suse.Effect1 = attack.Effect1;
  53.                                     Handle.ReceiveAttack(MeeToOoAttacker, MeToOoAttacked, attack, damages, spell);
  54.                                     suse.AddTarget(MeToOoAttacked.UID, damages, attack);
  55.                                 }
  56.                                 foreach (Interfaces.IMapObject _obj in MeeToOoAttacker.Owner.Screen.Objects)
  57.                                 {
  58.                                     if (_obj == null) continue;
  59.                                     if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player)
  60.                                     {
  61.                                         if (_obj.UID == MeToOoAttacked.UID) continue;
  62.                                         var attacked1 = _obj as Entity;
  63.                                         if (Kernel.GetDistance(lastAttacked.X, lastAttacked.Y, attacked1.X, attacked1.Y) <= 5)
  64.                                         {
  65.                                             if (Handle.CanAttack(MeeToOoAttacker, attacked1, spell, false))
  66.                                             {
  67.                                                 lastAttacked = attacked1;
  68.                                                 uint damages = Game.Attacking.Calculate.Melee(MeeToOoAttacker, attacked1, spell, ref attack);
  69.                                                 suse.Effect1 = attack.Effect1;
  70.                                                 if (damages == 0) break;
  71.                                                 Handle.ReceiveAttack(MeeToOoAttacker, attacked1, attack, damages, spell);
  72.                                                 suse.AddTarget(attacked1.UID, damages, attack);
  73.                                             }
  74.                                         }
  75.                                     }
  76.                                     else if (_obj.MapObjType == MapObjectType.SobNpc)
  77.                                     {
  78.                                         MeeToOoAttackedsob = _obj as SobNpcSpawn;
  79.                                         if (Kernel.GetDistance(lastAttacked.X, lastAttacked.Y, MeeToOoAttackedsob.X, MeeToOoAttackedsob.Y) <= 5)
  80.                                         {
  81.                                             if (Handle.CanAttack(MeeToOoAttacker, MeeToOoAttackedsob, spell))
  82.                                             {
  83.                                                 lastAttacked = MeeToOoAttackedsob;
  84.                                                 uint damages = Game.Attacking.Calculate.Melee(MeeToOoAttacker, MeeToOoAttackedsob, ref attack);
  85.                                                 suse.Effect1 = attack.Effect1;
  86.                                                 if (damages == 0) break;
  87.                                                 Handle.ReceiveAttack(MeeToOoAttacker, MeeToOoAttackedsob, attack, damages, spell);
  88.                                                 suse.AddTarget(MeeToOoAttackedsob.UID, damages, attack);
  89.                                             }
  90.                                         }
  91.                                     }
  92.                                 }
  93.                                 MeeToOoAttacker.Owner.SendScreen(suse, true);
  94.                                 return;
  95.  
  96.                             }
  97.                         }
  98.                     }
  99.                 #endregion
  100.                     uint damage = Game.Attacking.Calculate.Melee(MeeToOoAttacker, MeToOoAttacked, ref attack);
  101.                     attack.Damage = damage;
  102.                     if (MeeToOoAttacker.OnFatalStrike())
  103.                     {
  104.                         if (MeToOoAttacked.EntityFlag == EntityFlag.Monster)
  105.                         {
  106.                             var weaps = MeeToOoAttacker.Owner.Weapons;
  107.                             bool can = false;
  108.                             if (weaps.Item1 != null)
  109.                                 if (weaps.Item1.ID / 1000 == 601)
  110.                                     can = true;
  111.                             if (weaps.Item2 != null)
  112.                                 if (weaps.Item2.ID / 1000 == 601)
  113.                                     can = true;
  114.                             if (!can)
  115.                                 return;
  116.                             ushort x = MeToOoAttacked.X;
  117.                             ushort y = MeToOoAttacked.Y;
  118.                             Map.UpdateCoordonatesForAngle(ref x, ref y, Kernel.GetAngle(MeToOoAttacked.X, MeToOoAttacked.Y, MeeToOoAttacker.X, MeeToOoAttacker.Y));
  119.                             MeeToOoAttacker.Shift(x, y);
  120.                             attack.X = x;
  121.                             attack.Y = y;
  122.                             //double dmg = (double)damage * 3.5;
  123.                             //damage = (uint)dmg;
  124.                             damage = damage / 2;
  125.                             attack.Damage = damage;
  126.  
  127.                             attack.AttackType = Attack.FatalStrike;
  128.                         }
  129.                     }
  130.                     //over:
  131.                     // All That By MeToOo Dont CHange Please
  132.                     var weapons = MeeToOoAttacker.Owner.Weapons;
  133.                     if (weapons.Item1 != null)
  134.                     {
  135.                         ConquerItem rightweapon = weapons.Item1;
  136.                         ushort wep1subyte = (ushort)(rightweapon.ID / 1000), wep2subyte = 0;
  137.                         bool wep1bs = false, wep2bs = false;
  138.                         if (wep1subyte == 421)
  139.                         {
  140.                             wep1bs = true;
  141.                             wep1subyte--;
  142.                         }
  143.                         ushort wep1spellid = 0, wep2spellid = 0;
  144.                         if (Database.SpellTable.WeaponSpells.ContainsKey(wep1subyte))
  145.                             wep1spellid = Database.SpellTable.WeaponSpells[wep1subyte];
  146.                         Database.SpellInformation wep1spell = null, wep2spell = null;
  147.                         if (MeeToOoAttacker.Owner.Spells.ContainsKey(wep1spellid) && Database.SpellTable.SpellInformations.ContainsKey(wep1spellid))
  148.                         {
  149.                             wep1spell = Database.SpellTable.SpellInformations[wep1spellid][MeeToOoAttacker.Owner.Spells[wep1spellid].Level];
  150.                             doWep1Spell = Kernel.Rate(wep1spell.Percent);
  151.                             if (MeToOoAttacked.EntityFlag == EntityFlag.Player && wep1spellid == 10490)
  152.                                 doWep1Spell = Kernel.Rate(5);
  153.                         }
  154.                         if (!doWep1Spell)
  155.                         {
  156.                             if (weapons.Item2 != null)
  157.                             {
  158.                                 ConquerItem leftweapon = weapons.Item2;
  159.                                 wep2subyte = (ushort)(leftweapon.ID / 1000);
  160.                                 if (wep2subyte == 421)
  161.                                 {
  162.                                     wep2bs = true;
  163.                                     wep2subyte--;
  164.                                 }
  165.                                 if (Database.SpellTable.WeaponSpells.ContainsKey(wep2subyte))
  166.                                     wep2spellid = Database.SpellTable.WeaponSpells[wep2subyte];
  167.                                 if (MeeToOoAttacker.Owner.Spells.ContainsKey(wep2spellid) && Database.SpellTable.SpellInformations.ContainsKey(wep2spellid))
  168.                                 {
  169.                                     wep2spell = Database.SpellTable.SpellInformations[wep2spellid][MeeToOoAttacker.Owner.Spells[wep2spellid].Level];
  170.                                     doWep2Spell = Kernel.Rate(wep2spell.Percent);
  171.                                     if (MeToOoAttacked.EntityFlag == EntityFlag.Player && wep2spellid == 10490)
  172.                                         doWep2Spell = Kernel.Rate(5);
  173.                                 }
  174.                             }
  175.                         }
  176.                         #region 11960
  177.                         if (MeeToOoAttacker.EpicTrojan())
  178.                         {
  179.                             if (MeeToOoAttacker.Owner.Spells.ContainsKey(11960))
  180.                             {
  181.                                 var spell = Database.SpellTable.GetSpell(11960, MeeToOoAttacker.Owner);
  182.                                 if (spell != null)
  183.                                 {
  184.                                     spell.CanKill = true;
  185.                                     if (Kernel.Rate(32))
  186.                                     {
  187.                                         SpellUse suse = new SpellUse(true);
  188.                                         suse.Attacker = MeeToOoAttacker.UID;
  189.                                         suse.SpellID = spell.ID;
  190.                                         suse.SpellLevel = spell.Level;
  191.                                         suse.X = MeeToOoAttacker.X;
  192.                                         suse.Y = MeeToOoAttacker.Y;
  193.                                         IMapObject lastAttacked = MeeToOoAttacker;
  194.                                         foreach (Interfaces.IMapObject _obj in MeeToOoAttacker.Owner.Screen.Objects)
  195.                                         {
  196.                                             if (_obj == null) continue;
  197.                                             if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player)
  198.                                             {
  199.                                                 if (_obj.UID == MeToOoAttacked.UID) continue;
  200.                                                 var attacked1 = _obj as Entity;
  201.                                                 if (Kernel.GetDistance(MeeToOoAttacker.X, MeeToOoAttacker.Y, attacked1.X, attacked1.Y) <= 5)
  202.                                                 {
  203.                                                     if (Handle.CanAttack(MeeToOoAttacker, attacked1, spell, false))
  204.                                                     {
  205.                                                         lastAttacked = attacked1;
  206.                                                         uint damages = Game.Attacking.Calculate.Melee(MeeToOoAttacker, attacked1, spell, ref attack);
  207.                                                         suse.Effect1 = attack.Effect1;
  208.                                                         if (damages == 0) break;
  209.                                                         Handle.ReceiveAttack(MeeToOoAttacker, attacked1, attack, damages, spell);
  210.                                                         suse.AddTarget(attacked1.UID, damages, attack);
  211.                                                         byte num = 0;
  212.                                                         switch (spell.Level)
  213.                                                         {
  214.                                                             case 0: num = 5; break;
  215.                                                             case 1: num = 6; break;
  216.                                                             case 2: num = 7; break;
  217.                                                             case 3: num = 8; break;
  218.                                                             case 4: num = 9; break;
  219.                                                             case 5: num = 10; break;
  220.                                                             case 6: num = 11; break;
  221.                                                             case 7: num = 12; break;
  222.                                                             case 8: num = 14; break;
  223.                                                             case 9: num = 20; break;
  224.  
  225.                                                         }
  226.                                                         if (MeeToOoAttacker.Stamina <= 150)
  227.                                                         {
  228.                                                             MeeToOoAttacker.Stamina += num;
  229.                                                             MeeToOoAttacker.Owner.Send(new Message("the~caster~has~a~100%~chance~to~recover~Stamina~by~" + num + ".", System.Drawing.Color.Red, Message.TopLeft));
  230.                                                         }
  231.                                                     }
  232.                                                 }
  233.                                             }
  234.                                             else if (_obj.MapObjType == MapObjectType.SobNpc)
  235.                                             {
  236.                                                 MeeToOoAttackedsob = _obj as SobNpcSpawn;
  237.                                                 if (Kernel.GetDistance(lastAttacked.X, lastAttacked.Y, MeeToOoAttackedsob.X, MeeToOoAttackedsob.Y) <= 5)
  238.                                                 {
  239.                                                     if (Handle.CanAttack(MeeToOoAttacker, MeeToOoAttackedsob, spell))
  240.                                                     {
  241.                                                         lastAttacked = MeeToOoAttackedsob;
  242.                                                         uint damages = Game.Attacking.Calculate.Melee(MeeToOoAttacker, MeeToOoAttackedsob, ref attack);
  243.                                                         suse.Effect1 = attack.Effect1;
  244.                                                         if (damages == 0) break;
  245.                                                         Handle.ReceiveAttack(MeeToOoAttacker, MeeToOoAttackedsob, attack, damages, spell);
  246.                                                         suse.AddTarget(MeeToOoAttackedsob.UID, damages, attack);
  247.                                                     }
  248.                                                 }
  249.                                             }
  250.                                         }
  251.                                         MeeToOoAttacker.Owner.SendScreen(suse, true);
  252.                                         return;
  253.                                     }
  254.                                 }
  255.                             }
  256.                         }
  257.                         #endregion
  258.                         #region 11990
  259.                         if (MeeToOoAttacker.EpicTrojan())
  260.                         {
  261.                             if (MeeToOoAttacker.Owner.Spells.ContainsKey(11990))
  262.                             {
  263.                                 var spell = Database.SpellTable.GetSpell(11990, MeeToOoAttacker.Owner);
  264.                                 if (spell != null)
  265.                                 {
  266.                                     spell.CanKill = true;
  267.                                     if (Kernel.Rate(32))
  268.                                     {
  269.                                         SpellUse suse = new SpellUse(true);
  270.                                         suse.Attacker = MeeToOoAttacker.UID;
  271.                                         suse.SpellID = spell.ID;
  272.                                         suse.SpellLevel = spell.Level;
  273.                                         suse.X = MeeToOoAttacker.X;
  274.                                         suse.Y = MeeToOoAttacker.Y;
  275.                                         IMapObject lastAttacked = MeeToOoAttacker;
  276.                                         if (Handle.CanAttack(MeeToOoAttacker, MeToOoAttacked, spell, false))
  277.                                         {
  278.                                             lastAttacked = MeToOoAttacked;
  279.                                             uint damages = Game.Attacking.Calculate.Melee(MeeToOoAttacker, MeToOoAttacked, spell, ref attack);
  280.                                             suse.Effect1 = attack.Effect1;
  281.                                             Handle.ReceiveAttack(MeeToOoAttacker, MeToOoAttacked, attack, damages, spell);
  282.                                             suse.AddTarget(MeToOoAttacked.UID, damages, attack);
  283.                                         }
  284.                                         foreach (Interfaces.IMapObject _obj in MeeToOoAttacker.Owner.Screen.Objects)
  285.                                         {
  286.                                             if (_obj == null) continue;
  287.                                             if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player)
  288.                                             {
  289.                                                 if (_obj.UID == MeToOoAttacked.UID) continue;
  290.                                                 var attacked1 = _obj as Entity;
  291.                                                 if (Kernel.GetDistance(lastAttacked.X, lastAttacked.Y, attacked1.X, attacked1.Y) <= 5)
  292.                                                 {
  293.                                                     if (Handle.CanAttack(MeeToOoAttacker, attacked1, spell, false))
  294.                                                     {
  295.                                                         lastAttacked = attacked1;
  296.                                                         uint damages = Game.Attacking.Calculate.Melee(MeeToOoAttacker, attacked1, spell, ref attack);
  297.                                                         suse.Effect1 = attack.Effect1;
  298.                                                         if (damages == 0) break;
  299.                                                         Handle.ReceiveAttack(MeeToOoAttacker, attacked1, attack, damages, spell);
  300.                                                         suse.AddTarget(attacked1.UID, damages, attack);
  301.                                                     }
  302.                                                 }
  303.                                             }
  304.                                             else if (_obj.MapObjType == MapObjectType.SobNpc)
  305.                                             {
  306.                                                 MeeToOoAttackedsob = _obj as SobNpcSpawn;
  307.                                                 if (Kernel.GetDistance(lastAttacked.X, lastAttacked.Y, MeeToOoAttackedsob.X, MeeToOoAttackedsob.Y) <= 5)
  308.                                                 {
  309.                                                     if (Handle.CanAttack(MeeToOoAttacker, MeeToOoAttackedsob, spell))
  310.                                                     {
  311.                                                         lastAttacked = MeeToOoAttackedsob;
  312.                                                         uint damages = Game.Attacking.Calculate.Melee(MeeToOoAttacker, MeeToOoAttackedsob, ref attack);
  313.                                                         suse.Effect1 = attack.Effect1;
  314.                                                         if (damages == 0) break;
  315.                                                         Handle.ReceiveAttack(MeeToOoAttacker, MeeToOoAttackedsob, attack, damages, spell);
  316.                                                         suse.AddTarget(MeeToOoAttackedsob.UID, damages, attack);
  317.                                                     }
  318.                                                 }
  319.                                             }
  320.                                         }
  321.                                         MeeToOoAttacker.Owner.SendScreen(suse, true);
  322.                                         return;
  323.                                     }
  324.                                 }
  325.                             }
  326.                         }
  327.                         #endregion  // All That By MeToOo Dont CHange Please
  328.  
  329.  
  330.                     }
  331.                     else
  332.                     {
  333.                         if (!MeeToOoAttacker.Transformed)
  334.                         {
  335.                             if (MeeToOoAttacker.EntityFlag == EntityFlag.Player && MeToOoAttacked.EntityFlag != EntityFlag.Player)
  336.                                 if (damage > MeToOoAttacked.Hitpoints)
  337.                                 {
  338.                                     MeeToOoAttacker.Owner.IncreaseProficiencyExperience(Math.Min(damage, MeToOoAttacked.Hitpoints), 0);
  339.                                 }
  340.                                 else
  341.                                 {
  342.                                     MeeToOoAttacker.Owner.IncreaseProficiencyExperience(damage, 0);
  343.                                 }
  344.                         }
  345.                     }
  346.                     ReceiveAttack(MeeToOoAttacker, MeToOoAttacked, attack, damage, null);
  347.                     attack.AttackType = Attack.Melee;
  348.                 }
  349.  
  350.  
  351.             }  // All That By MeToOo Dont CHange Please
  352.             else if (MeeToOoAttacker.Owner.Screen.TryGetSob(attack.Attacked, out MeeToOoAttackedsob))
  353.             {
  354.                 CheckForExtraWeaponPowers(MeeToOoAttacker.Owner, null);
  355.                 if (CanAttack(MeeToOoAttacker, MeeToOoAttackedsob, null))
  356.                 {
  357.                     ushort range = MeeToOoAttacker.AttackRange;
  358.                     if (MeeToOoAttacker.Transformed)
  359.                         range = (ushort)MeeToOoAttacker.TransformationAttackRange;
  360.  
  361.                     attack.Effect1 = Attack.AttackEffects1.None;
  362.                     uint damage = Game.Attacking.Calculate.Melee(MeeToOoAttacker, MeeToOoAttackedsob, ref attack);
  363.  
  364.                     var weapons = MeeToOoAttacker.Owner.Weapons;
  365.                     if (weapons.Item1 != null)
  366.                     {
  367.                         ConquerItem rightweapon = weapons.Item1;
  368.                         ushort wep1subyte = (ushort)(rightweapon.ID / 1000), wep2subyte = 0;
  369.                         bool wep1bs = false, wep2bs = false;
  370.                         if (wep1subyte == 421)
  371.                         {
  372.                             wep1bs = true;
  373.                             wep1subyte--;
  374.                         }
  375.                         ushort wep1spellid = 0, wep2spellid = 0;
  376.                         if (Database.SpellTable.WeaponSpells.ContainsKey(wep1subyte))
  377.                             wep1spellid = Database.SpellTable.WeaponSpells[wep1subyte];
  378.                         Database.SpellInformation wep1spell = null, wep2spell = null;
  379.                         if (MeeToOoAttacker.Owner.Spells.ContainsKey(wep1spellid) && Database.SpellTable.SpellInformations.ContainsKey(wep1spellid))
  380.                         {
  381.                             wep1spell = Database.SpellTable.SpellInformations[wep1spellid][MeeToOoAttacker.Owner.Spells[wep1spellid].Level];
  382.                             doWep1Spell = Kernel.Rate(wep1spell.Percent);
  383.                         }
  384.                         if (!doWep1Spell)
  385.                         {
  386.                             if (weapons.Item2 != null)
  387.                             {
  388.                                 ConquerItem leftweapon = weapons.Item2;
  389.                                 wep2subyte = (ushort)(leftweapon.ID / 1000);
  390.                                 if (wep2subyte == 421)
  391.                                 {
  392.                                     wep2bs = true;
  393.                                     wep2subyte--;
  394.                                 }
  395.                                 if (Database.SpellTable.WeaponSpells.ContainsKey(wep2subyte))
  396.                                     wep2spellid = Database.SpellTable.WeaponSpells[wep2subyte];
  397.                                 if (MeeToOoAttacker.Owner.Spells.ContainsKey(wep2spellid) && Database.SpellTable.SpellInformations.ContainsKey(wep2spellid))
  398.                                 {
  399.                                     wep2spell = Database.SpellTable.SpellInformations[wep2spellid][MeeToOoAttacker.Owner.Spells[wep2spellid].Level];
  400.                                     doWep2Spell = Kernel.Rate(wep2spell.Percent);
  401.                                 }
  402.                             }
  403.                         }
  404.  
  405.  
  406.                         // All That By MeToOo Dont CHange Please
  407.                     }
  408.  
  409.                     attack.Damage = damage;
  410.                     ReceiveAttack(MeeToOoAttacker, MeeToOoAttackedsob, attack, damage, null);
  411.                     // All That By MeToOo Dont CHange Please
  412.  
  413.                 }
  414.  
  415.             }
  416.  
  417.  
  418.  
  419.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement