help

07/28/2009 02:02 taylor2846#1
Can Somone help me add wepskills such as rage snow and stuff.. tell me what i need to add where to add it and stuff i dont mean give me the code so i don't haft to do noting i mean guide me threw it so i can learn how and code the other weapon skills. some say for rage just copy Hercules. but i just don't see how that would work and do i code them in the same place or what.. plz help me if u can
07/28/2009 04:21 samehvan#2
my way is pretty simple but not that good i think

step1- check the Right Hand weapon chance
step2- if the r8 hand chance returns false check the left hand chance

step3- if one of them returns true do the weapon skill , and here is my code for it ,u will need to add more weapons of course

at the Melee region (Handlers/Attack.cs) put this

Code:
#region R8 hand chances
                    byte WeaponChance = (byte)Nano.Rand.Next(255);
                    if (CSocket.Client.Equipment.ContainsKey(4))
                    {
                        
                        if (WeaponChance > 150)
                        {
                            switch (RightHand.ID)
                            {
                                
                                case 480://Club
                                    {
                                        if (Attacker.Skills.ContainsKey((int)Struct.SkillIds.Rage))
                                        {
                                            WeaponEffect = "RHFound";
                                            NoTargetMagic(CSocket, (int)Struct.SkillIds.Rage, CSocket.Client.X, CSocket.Client.Y);
                                        }
                                        break;
                                    }
                                case 510://Glaive 2Hand
                                    {
                                        if (Attacker.Skills.ContainsKey((int)Struct.SkillIds.WideStrike))
                                        {
                                            WeaponEffect = "RHFound";
                                            NoTargetMagic(CSocket, (int)Struct.SkillIds.WideStrike, X, Y);
                                        }
                                        break;
                                    }
                                case 561://Wand 2Hand
                                    {
                                        if (Attacker.Skills.ContainsKey((int)Struct.SkillIds.Snow))
                                        {
                                            WeaponEffect = "RHFound";
                                            NoTargetMagic(CSocket, (int)Struct.SkillIds.Snow, CSocket.Client.X, CSocket.Client.Y);
                                        }
                                        break;
                                    }
                                case 560://Spear 2Hand
                                    {
                                        if (Attacker.Skills.ContainsKey((int)Struct.SkillIds.SpeedGun))
                                        {
                                            WeaponEffect = "RHFound";
                                            NoTargetMagic(CSocket, (int)Struct.SkillIds.SpeedGun, X, Y);
                                        }
                                        break;
                                    }
                                case 530://Poleaxe 2Hand
                                    {
                                        if (Attacker.Skills.ContainsKey((int)Struct.SkillIds.Boreas))
                                        {
                                            WeaponEffect = "RHFound";
                                            NoTargetMagic(CSocket, (int)Struct.SkillIds.Boreas, X, Y);
                                        }
                                        break;
                                    }
                            }
                        }
                    }
                    #endregion
                    #region Left hand chances
                    if (CSocket.Client.Equipment.ContainsKey(5))
                    {
                        if (WeaponEffect == "")
                        {
                            WeaponChance = (byte)Nano.Rand.Next(255);
                            if (WeaponChance > 180)
                            {
                                switch (LeftHand.ID)
                                {
                                
                                    case 480://Club
                                        {
                                            if (Attacker.Skills.ContainsKey((int)Struct.SkillIds.Rage))
                                            {
                                                NoTargetMagic(CSocket, (int)Struct.SkillIds.Rage, CSocket.Client.X, CSocket.Client.Y);
                                            }
                                            break;
                                        }
                                    case 510://Glaive 2Hand
                                        {
                                            if (Attacker.Skills.ContainsKey((int)Struct.SkillIds.WideStrike))
                                            {
                                                NoTargetMagic(CSocket, (int)Struct.SkillIds.WideStrike, X, Y);
                                            }
                                            break;
                                        }
                                    case 561://Wand 2Hand
                                        {
                                            if (Attacker.Skills.ContainsKey((int)Struct.SkillIds.Snow))
                                            {
                                                NoTargetMagic(CSocket, (int)Struct.SkillIds.Snow, CSocket.Client.X, CSocket.Client.Y);
                                            }
                                            break;
                                        }
                                    case 560://Spear 2Hand
                                        {
                                            if (Attacker.Skills.ContainsKey((int)Struct.SkillIds.SpeedGun))
                                            {
                                                NoTargetMagic(CSocket, (int)Struct.SkillIds.SpeedGun, X, Y);
                                            }
                                            break;
                                        }
                                    case 530://Poleaxe 2Hand
                                        {
                                            if (Attacker.Skills.ContainsKey((int)Struct.SkillIds.Boreas))
                                            {
                                                NoTargetMagic(CSocket, (int)Struct.SkillIds.Boreas, X, Y);
                                            }
                                            break;
                                        }
                                }
                            }
                        }
                    }
                    #endregion
u will need to copy/paste this 2wice , once at the player attacking player and once again at player attacking mob if u can't know where exactly to put them , let me know

then u will need to add a case for every skill at NoTargetMagic Void ,it is in the same file .
under the Herc case add your other weapons skills let's say u want Rage for example

Code:
#region Rage
                    case 7020:
                        {
                            int Distance = 2;
                            Dictionary<int, Monster> ToDo = new Dictionary<int, Monster>();
                            Dictionary<int, int> Targets = new Dictionary<int, int>();
                            try
                            {
                                Monitor.Enter(Nano.Monsters);
                                foreach (KeyValuePair<int, Monster> Mob in Nano.Monsters)
                                {
                                    if ((int)CSocket.Client.Map == Mob.Value.Map)
                                    {
                                        if (Calculation.InRange(Mob.Value.X, Mob.Value.Y, CSocket.Client.X, CSocket.Client.Y, Distance))
                                        {
                                            if (Mob.Value.Info.Name == "Guard" || Mob.Value.Info.Name == "Patrol" || Mob.Value.Info.Name == "GuardReviver")
                                            {
                                                if (CSocket.Client.PKMode == Struct.PkType.PK)
                                                {
                                                    if (!ToDo.ContainsKey(Mob.Value.UID))
                                                        ToDo.Add(Mob.Key, Mob.Value);
                                                }
                                            }
                                            else
                                            {
                                                if (!ToDo.ContainsKey(Mob.Value.UID))
                                                    ToDo.Add(Mob.Key, Mob.Value);
                                            }
                                        }
                                    }
                                }
                                //}
                            }
                            catch (Exception e)
                            {
                                Console.WriteLine(e.ToString());
                            }
                            finally
                            {
                                Monitor.Exit(Nano.Monsters);
                            }
                            try
                            {
                                Monitor.Enter(Nano.ClientPool);
                                foreach (KeyValuePair<int, ClientSocket> Clients in Nano.ClientPool)
                                {
                                    ClientSocket ASocket = Clients.Value;
                                    if ((int)CSocket.Client.Map == (int)ASocket.Client.Map && CSocket.Client.ID != ASocket.Client.ID)
                                    {
                                        if (Calculation.InRange(ASocket.Client.X, ASocket.Client.Y, CSocket.Client.X, CSocket.Client.Y, Distance) && !ASocket.Client.Dead)
                                        {
                                            if (CheckMode(CSocket, ASocket))
                                            {
                                                int Damage = Calculation.Damage(CSocket.Client, ASocket.Client, 2, 0, 0);
                                                Damage = (Damage / 3);
                                                Calculation.doPlayer(CSocket, ASocket, Damage, 21);
                                                if (!Targets.ContainsKey(ASocket.Client.ID))
                                                {
                                                    Targets.Add(ASocket.Client.ID, Damage);
                                                    Calculation.SkillExp(Skill.ID, CSocket, (int)(Damage / 15));
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            catch (Exception e)
                            {
                                Console.WriteLine(e.ToString());
                            }
                            finally
                            {
                                Monitor.Exit(Nano.ClientPool);
                            }
                            foreach (KeyValuePair<int, Struct.TerrainNPC> TNPCS in Nano.TerrainNpcs)
                            {
                                Struct.TerrainNPC Tnpc = TNPCS.Value;
                                if ((int)CSocket.Client.Map == Tnpc.Map)
                                {
                                    if (Calculation.InRange(Tnpc.X, Tnpc.Y, CSocket.Client.X, CSocket.Client.Y, Distance))
                                    {
                                        int Damage = 0;
                                        if (CSocket.Client.MinAttack < CSocket.Client.MaxAttack)
                                        {
                                            Damage = Nano.Rand.Next(CSocket.Client.MinAttack, CSocket.Client.MaxAttack);
                                            Damage = (Damage / 3);
                                        }
                                        Calculation.doTNpc(CSocket, Tnpc, Damage, 21);
                                        if (!Targets.ContainsKey(Tnpc.UID))
                                        {
                                            Targets.Add(Tnpc.UID, Damage);
                                            Calculation.SkillExp(Skill.ID, CSocket, (int)(Damage / 25));
                                        }
                                    }
                                }
                            }
                            foreach (KeyValuePair<int, Monster> Mob in ToDo)
                            {
                                int Damage = Calculation.Damage(CSocket.Client, Mob.Value, 2, 0, 0);
                                Damage = (Damage / 3);
                                Calculation.doMonster(Mob.Value, Damage, 21, CSocket);
                                if (!Targets.ContainsKey(Mob.Value.UID))
                                {
                                    Targets.Add(Mob.Key, Damage);
                                    Calculation.SkillExp(Skill.ID, CSocket, (int)(Damage / 12));
                                }
                            }
                            ToDo.Clear();
                            ConquerPacket.ToLocal(ConquerPacket.MagicAttack(CSocket.Client.ID, Skill.ID, Skill.Level, Targets, CSocket.Client.X, CSocket.Client.Y), CSocket.Client.X, CSocket.Client.Y, (int)CSocket.Client.Map, 0, 0);
                            Targets.Clear();
                            break;
                        }

                    #endregion
hope that helped
07/28/2009 04:49 taylor2846#3
ty this helps
07/28/2009 19:43 Arcotemple:]#4
is it for lotf or coemu?
07/28/2009 19:53 samehvan#5
Coemu
07/28/2009 20:07 Arcotemple:]#6
oh well nvm then i coulda helped you if it was lotf
07/29/2009 10:54 taylor2846#7
ya lol lotf is easier to code skills i thank but thats just becaz i under stand how thay are codded there thers not much to look at for coemu xD