Пример #1
0
        public void UseSkinning(Mobile.Casting cast, Character c, Mobile go)
        {
            c.cast = cast;
            int rdiff = CurrentVal(c) - 1;
            int res   = StrSkillCheck(c, rdiff);

            if (res > 50 && !go.Skinned)
            {
                //c.SpellSuccess();
                float reussite = (float)res;

                reussite = reussite / 10f;
                ArrayList loot = new ArrayList();
                c.LootOwner = go.Guid;
                if (go.SkinLoot != null)
                {
                    ArrayList sl = new ArrayList();
                    foreach (Loot l in go.SkinLoot)
                    {
                        if (Utility.RandomDouble() * 100 < l.Probability)
                        {
                            int n = (int)(reussite * l.Probability);
                            sl.Add(l.Create(1));
                        }
                    }
                    if (sl.Count == 0)
                    {
                        c.SpellFaillure(SpellFailedReason.FailedAttempt);
                        return;
                    }
                    go.Skinned = true;
                    if (Current < Cap(c) && c.SkillUp(Current, rdiff, 1))
                    {
                        Current++;
                        c.SendSkillUpdate();
                    }
                    c.SpellSuccess();
                    c.previousSpellCasted = cast.id;

                    go.Treasure = (Item[])sl.ToArray(typeof(Item));
                    c.SendLootDetails(go.Guid, go, 0);
                    go.SendSmallUpdateToPlayerNearMe(new int[] { (int)UpdateFields.UNIT_DYNAMIC_FLAGS, (int)UpdateFields.UNIT_FIELD_FLAGS }, new object[] { go.DynFlags(c), go.Flags });
                }
                else
                {
                    c.SpellFaillure(SpellFailedReason.FailedAttempt);
                }
            }
            else
            {
                c.SpellFaillure(SpellFailedReason.FailedAttempt);
                go.SendSmallUpdateToPlayerNearMe(new int[] { (int)UpdateFields.UNIT_DYNAMIC_FLAGS, (int)UpdateFields.UNIT_FIELD_FLAGS }, new object[] { go.DynFlags(c), go.Flags });
            }
        }
Пример #2
0
 public virtual void SendCooldown(Mobile.Casting cast, Mobile c)
 {
     if (c is Character)
     {
         int offset = 4;
         Converter.ToBytes((uint)cast.id, c.tempBuff, ref offset);
         Converter.ToBytes((ulong)c.Guid, c.tempBuff, ref offset);
         Converter.ToBytes((ushort)cast.cool, c.tempBuff, ref offset);
         (c as Character).Send(OpCodes.SMSG_SPELL_COOLDOWN, c.tempBuff, offset);
     }
 }
Пример #3
0
        public void UseHerbalist(Mobile.Casting cast, Character c, GameObject go)
        {
            Hashtable diff = new Hashtable();

            diff[29] = 0;
            diff[8]  = 20;
            diff[9]  = 50;
            diff[10] = 75;
            diff[11] = 100;
            diff[26] = 125;
            diff[27] = 150;
            diff[35] = 140;
            diff[45] = 125;
            diff[47] = 160;
            diff[48] = 215;
            diff[49] = 185;
            diff[50] = 205;
            diff[51] = 195;
            int rdiff = CurrentVal(c) - (int)diff[(int)go.Sound[0]];
            int res   = IqSkillCheck(c, rdiff);

            if (res > 50)
            {
                if (Current < Cap(c) && c.SkillUp(Current, rdiff, 1))
                {
                    Current++;
                    c.SendSkillUpdate();
                    //c.SendSmallUpdate( new int[]{ Index, Index + 1, Index + 2 }, new object[]{ (int)Id, (short)CurrentVal(c), (short)Cap( c ), (int)0 } );
                }
                c.SpellSuccess();
                float reussite = (float)res;

                reussite = reussite / 10f;
                string str = "Reussite : " + reussite.ToString();
                c.SendMessage(str);
                if (!go.CheckLoot(c, reussite))
                {
                    c.SpellFaillure(SpellFailedReason.FailedAttempt);
                }
            }
            else
            {
                //	Console.WriteLine("SPELL RESULT :{0}", result );
                c.SpellFaillure(SpellFailedReason.FailedAttempt);
            }
        }
Пример #4
0
        public void UseMining(Mobile.Casting cast, Character c, GameObject go)
        {
            Hashtable diff = new Hashtable();

            diff[18] = 25;
            diff[19] = 50;
            diff[20] = 75;
            diff[21] = 100;
            diff[22] = 125;
            diff[25] = 150;
            diff[38] = 0;              //	Copper
            diff[39] = 50;             // Tin
            diff[40] = 100;            //	Silver
            diff[41] = 150;            // Iron
            diff[42] = 200;            //	Gold
            int rdiff = CurrentVal(c) - (int)diff[(int)go.Sound[0]];
            int res   = StrSkillCheck(c, rdiff);

            if (res > 50)
            {
                if (Current < Cap(c) && c.SkillUp(Current, rdiff, 1))
                {
                    Current++;
                    c.SendSkillUpdate();
                }
                c.SpellSuccess();
                float reussite = (float)res;

                reussite = reussite / 10f;
                //	string str = "Reussite : " + reussite.ToString();
                //	c.SendMessage( str );
                if (!go.CheckLoot(c, reussite))
                {
                    c.SpellFaillure(SpellFailedReason.FailedAttempt);
                }
            }
            else
            {
                //	Console.WriteLine("SPELL RESULT :{0}", result );
                c.SpellFaillure(SpellFailedReason.FailedAttempt);
            }
        }
Пример #5
0
        public void UseFishing(Mobile.Casting cast, Character c)
        {
            GameObject desc = c.InsideFishingZone();

            if (desc == null)
            {
                c.SpellFaillure(SpellFailedReason.TheyArentAnyFishHere);
                return;
            }
            int rdiff = CurrentVal(c);
            int res   = AgiSkillCheck(c, rdiff);

            if (res > 50)
            {
                if (Current < Cap(c) && c.SkillUp(Current, rdiff, 1))
                {
                    Current++;
                    c.SendSkillUpdate();
                }
                c.SpellSuccess();
                float reussite = (float)res;

                reussite = reussite / 10f;
                string str = "Reussite : " + reussite.ToString();
                c.SendMessage(str);
                if (!desc.CheckLoot(c, reussite))
                {
                    c.SpellFaillure(SpellFailedReason.FailedAttempt);
                }
            }
            else
            {
                //	Console.WriteLine("SPELL RESULT :{0}", result );
                c.SpellFaillure(SpellFailedReason.FailedAttempt);
            }
        }
        public void Create(Mobile.Casting cast, Mobile c)
        {
            bool ok = true;

            if ((c as Character).FindAFreeSlot() != Slots.None)
            {
                ArrayList toConsume = new ArrayList();
                for (int t = 0; t < nMaterials.Length; t++)
                {
                    if (nMaterials[t] > 0)
                    {
                        int amount = nMaterials[t];
                        if (c is Character)
                        {
                            int ihave = (c as Character).FindAmountOfItemById(materials[t]);
                            if (amount > ihave)
                            {
                                ok = false;
                                c.SpellFaillure(SpellFailedReason.Required, World.CreateItemInPoolById(materials[t]).Name);
                                break;
                            }
                        }
                    }
                    else
                    {
                        break;
                    }
                }
                if (ok)
                {
                    for (int t = 0; t < nMaterials.Length; t++)
                    {
                        if (nMaterials[t] > 0)
                        {
                            if (c is Character)
                            {
                                (c as Character).ConsumeItemByIdUpTo(materials[t], nMaterials[t]);
                            }
                        }
                    }
                }
            }
            if (ok)
            {
                int id = c.cast.id;
                c.SpellSuccess();
                Item i = World.CreateItemInPoolById(objectCraft);
                if (i.MaxCount == 0)
                {
                    i.MaxCount = 1;
                }
                if (c is Character)
                {
                    c.cast.id = id;
                    //c.SpellFaillure( (SpellFailedReason)8 );
                    (c as Character).PutObjectInBackpack(i, 1, true);
                    object o = AbilityClasses.abilityClasses[id];
                    if (o != null)
                    {
                        int skill = 0;
                        switch ((int)o)
                        {
                        case (int)ClassesOfSpells.Leatherworking:
                        {
                            skill = LeatherSkill.SkillId;
                            break;
                        }

                        case (int)ClassesOfSpells.Blacksmithing:
                        {
                            skill = 164;
                            break;
                        }

                        case (int)ClassesOfSpells.Enchanting:
                        {
                            skill = 333;
                            break;
                        }

                        case (int)ClassesOfSpells.Engineering:
                        {
                            skill = 202;
                            break;
                        }

                        case (int)ClassesOfSpells.Tailoring:
                        {
                            skill = 197;
                            break;
                        }

                        case (int)ClassesOfSpells.Cooking:
                        {
                            skill = 185;
                            break;
                        }

                        case (int)ClassesOfSpells.Mining:
                        {
                            skill = 186;
                            break;
                        }
                        }
                        Skill sk = c.AllSkills[(ushort)skill];
                        if (sk != null && sk.Current < sk.Cap(c) && c.SkillUp(sk.Current, 30, 1))
                        {
                            sk.Current++;
                            (c as Character).SendSkillUpdate();
                        }
                    }
                }
                return;
            }
        }