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 });
            }
        }
        public bool CheckLoot(Character c, float reussite)
        {
            GameObjectDescription god = (GameObjectDescription)GameObjectDescription.all[id];

            if (god == null)
            {
                return(false);
            }

            ArrayList loot = new ArrayList();

            c.LootOwner = Guid;
            if (god.Loots != null)
            {            /*
                          *     foreach( Loot l in god.Loots )
                          *     {
                          *             if ( Utility.RandomDouble() * 100 < l.Probability )
                          *             {
                          *                     int n = (int)( reussite * l.Probability );
                          *                     if ( n < 1 )
                          *                             n = 1;
                          *                     if ( n > 10 )
                          *                             n = 6;
                          *                     loot.Add( l.Create( n ) );
                          *             }
                          *     }*/
                int lootMoney = 0;
                foreach (BaseTreasure l in god.Loots)
                {
                    if (l.IsDrop())
                    {
                        ArrayList ret = l.RandomDrop(ref lootMoney);
                        if (ret != null)
                        {
                            loot.AddRange(ret);
                        }
                    }
                }
                Treasure = (Item[])loot.ToArray(typeof(Item));

                c.SendLootDetails(Guid, this, lootMoney);
            }
            else
            {
                return(false);
            }
            return(true);
        }
Esempio n. 3
0
        public bool CheckLoot( Character c, float reussite )
        {
            GameObjectDescription god = (GameObjectDescription)GameObjectDescription.all[ id ];
            if ( god == null )
                return false;

            ArrayList loot = new ArrayList();
            c.LootOwner = Guid;
            if ( god.Loots != null )
            {/*
                foreach( Loot l in god.Loots )
                {
                    if ( Utility.RandomDouble() * 100 < l.Probability )
                    {
                        int n = (int)( reussite * l.Probability );
                        if ( n < 1 )
                            n = 1;
                        if ( n > 10 )
                            n = 6;
                        loot.Add( l.Create( n ) );
                    }
                }*/
                int lootMoney = 0;
                foreach( BaseTreasure l in god.Loots )
                {
                    if ( l.IsDrop() )
                    {
                        ArrayList ret = l.RandomDrop( ref lootMoney );
                        if ( ret != null )
                            loot.AddRange( ret );
                    }
                }
                Treasure = (Item[])loot.ToArray( typeof( Item ) );

                c.SendLootDetails( Guid, this, lootMoney  );
            }
            else
                return false;
            return true;
        }
Esempio n. 4
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 } );
			}
		}