عرض مشاركة واحدة
قديم 2019-07-28, 10:04 PM
المشاركة 9
Rider
.:: نائب المدير ::.
  • غير متواجد
افتراضي رد: مشكله في اسكله TwilightDance هنا
Handle.cs
سيرش علي
كود:
TwilightAction 

و بدله ب ده

كود:
private void TwilightAction(Player attacker, MsgMagicEffect suse, SpellInformation spell, ushort X, ushort Y)
        {
            
byte dist = (byte)spell.Distance;
            var 
map = attacker.Owner.Map;

            var 
algo = new InLineAlgorithm(attacker.X, X, attacker.Y, Y, dist);

            var 
count = (double)algo.lcoords.Count / 3;
            
int i = 1;
            var 
myx = attacker.X;
            var 
myy = attacker.Y;
            
Server.Thread.DelayedTask.StartDelayedTask(() =>
            {
                var 
selected = (i * (int)count) - 2;
                
selected = Math.Min(algo.lcoords.Count - 1, selected);
                
X = (ushort)algo.lcoords[selected].X;
                
Y = (ushort)algo.lcoords[selected].Y;


                
MsgMapItem floorItem = new MsgMapItem(true);
                
floorItem.MapObjType = MapObjectType.FloorSpell;
                
floorItem.ItemID = MsgMapItem.Twilight;
                
floorItem.ItemColor = (Enums.Color)(i + 1);
                
floorItem.MapID = attacker.MapID;
                
floorItem.Type = MsgMapItem.Effect;
                
floorItem.X = X;
                
floorItem.Y = Y;
                
floorItem.OnFloor = Time32.Now;
                
floorItem.Owner = attacker.Owner;
                while (
map.Npcs.ContainsKey(floorItem.UID))
                    
floorItem.UID = Network.GamePackets.MsgMapItem.FloorUID.Next;
                
map.AddFloorItem(floorItem);

                
attacker.Owner.SendScreenSpawn(floorItem, true);

                if (
i != 0)
                {
                    
MsgAction data = new Network.GamePackets.MsgAction(true);
                    
data.UID = attacker.UID;
                    
data.X2 = X;
                    
data.Y2 = Y;
                    
data.ID = MsgAction.Mode.RemoveTrap;
                    
data.wParam1 = myx;
                    
data.wParam2 = myy;
                    
attacker.Owner.SendScreen(data, true);
               
                    
//double percent = 1;
                    //switch (i)
                    //{
                    //    case 1:
                    //        percent = 0.92;
                    //        break;
                    //    case 2:
                    //        percent = 1.02;
                    //        break;
                    //    case 3:
                    //        percent = 1.2;
                    //        break;
                    //}


                    
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
                    {
                        
bool hit = false;
                        var 
selected2 = Math.Max(0, i - 1) * (int)count;
                        
selected2 = Math.Min(algo.lcoords.Count - 1, selected2);
                        if (
Kernel.GetDistance(_obj.X, _obj.Y, (ushort)algo.lcoords[selected].X, (ushort)algo.lcoords[selected].Y) <= spell.Range)
                            
hit = true;
                        
//for (int j = selected2; j < selected; j++)
                        //    if (Kernel.GetDistance(_obj.X, _obj.Y, (ushort)algo.lcoords[j].X, (ushort)algo.lcoords[j].Y) <= spell.Range)
                        //        hit = true;
                        
if (hit)
                        {
                            if (
_obj.MapObjType == MapObjectType.Monster)
                            {
                                
attacked = _obj as Player;
                                if (
CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
                                {
                                    var 
damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
                                    
ReceiveAttack(attacker, attacked, attack, ref damage, spell);

                                    
suse.AddTarget(attacked.UID, damage, attack);
                                }
                            }
                            else if (
_obj.MapObjType == MapObjectType.Player)
                            {
                                
attacked = _obj as Player;
                                if (
attacked.ContainsFlag((ulong)MsgUpdate.Flags.Intensify))
                                {
                                    
attacked.RemoveFlag((ulong)MsgUpdate.Flags.Intensify);
                                    
attacked.IntensifyPercent = 0;
                                }
                                if (
CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
                                {
                                    var 
damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
                                    
damage = (uint)(damage * spell.IncreaseDMG);
                                    
damage = (uint)(damage / spell.DecreaseDMG);
                                    
//damage = (uint)((double)(damage * percent));
                                    
ReceiveAttack(attacker, attacked, attack, ref damage, spell);

                                    
suse.AddTarget(attacked.UID, damage, attack);
                                }

                            }
                            else if (
_obj.MapObjType == MapObjectType.SobNpc)
                            {
                                var 
attackedsob = _obj as MsgNpcInfoEX;
                                if (
CanAttack(attacker, attackedsob, spell))
                                {
                                    var 
damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);

                                    
ReceiveAttack(attacker, attackedsob, attack, damage, spell);

                                    
suse.AddTarget(attackedsob.UID, damage, attack);
                                }
                            }
                        }
                    }
                   
                    if (
suse.Targets.Count > 0)
                        
attacker.Owner.SendScreen(suse, true);
                    
suse.Targets.Clear();
                }
                
i++;
            }, 
0, 2, 250);
        } 

بعدها روح للاسكله
و بدلها ب دي

كود:
 #region TwilightDance
                                
case 12070:
                                    {
                                        if (
CanUseSpell(spell, attacker.Owner))
                                        {
                                            
PrepareSpell(spell, attacker.Owner);
                                            
MsgMagicEffect suse = new MsgMagicEffect(true);
                                            
suse.Attacker = attacker.UID;
                                            
suse.Attacker1 = attacker.UID;
                                            
suse.SpellID = spell.ID;
                                            
suse.SpellLevel = spell.Level;

                                            
TwilightAction(attacker, suse, spell, X, Y);
                                            
attacker.Stamina -= 20;
                                            
attacker.Owner.SendScreen(suse, true);
                                            
attacker.AttackPacket = null;

                                        }
                                        break;
                                    }
                                
#endregion 

في انتظار ردك