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);
            }
        }
        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);
            }
        }
Esempio n. 3
0
			public TestTimer( Character c, Mobile f ) : base( WowTimer.Priorities.Milisec100 , 1000, "TestTimer" )
			{
				from = c;
				to = f;
				float ax = ( c.X - to.X );
				float ay = ( c.Y - to.Y );
				float az = ( c.Z - to.Z );
				float dist = (float)Math.Sqrt( ax * ax + ay * ay + az * az );
				from.SendMessage( "dist = " + dist.ToString() );
				Start();
			}
Esempio n. 4
0
        public override void OnTick()
        {
            /*	if ( World.allConnectedChars.Count > 0 && this.Distance( World.allConnectedChars[ 0 ] as Object ) > 200 * 200 )
             *      {
             *              ( World.allConnectedChars[ 0 ] as Character ).SendMessage( this.GetType().ToString() + " dist = " + this.Distance( World.allConnectedChars[ 0 ]  as Object ).ToString() );
             *      }*/
            if (!IsStillActive())
            {
                HitPoints = BaseHitPoints;
                Mana      = BaseMana;
                //	active = false;
                LastSeen = null;
                Delete();
                return;
            }
            if (DebugSniffer != null)
            {
                TimeSpan ts = DateTime.Now.Subtract(debugLast);
                DebugSniffer.SendMessage("BaseCreature::OnTick " + ts.TotalMilliseconds.ToString());
                debugLast = DateTime.Now;
            }
            if (Deleted)
            {
                return;
            }
            if (Dead)
            {
                return;
            }
            if (Freeze)
            {
                return;
            }

            this.UpdateXYZ();

            if (!(ForceFlee || ForceStun || ForceRoot) && aiEngine != null)
            {
                if (SpawnerLink != null && aiEngine.CustomBehaviours.Contains(CustomBehavioursTypes.Stay))
                {
                    switch (AIState)
                    {
                    case AIStates.Fighting:
                    case AIStates.Flee:
                    case AIStates.Explore:
                    case AIStates.Attack:
                    case AIStates.BeingAttacked:
                        break;

                    default:
                        //UpdateXYZ();
                        if (Distance(SpawnerLink) > 5)
                        {
                            AIState = AIStates.ReturnHome;
                            if (Math.Abs(Z - SpawnerLink.Z) > 3)
                            {
                                MoveTo(X + (SpawnerLink.X - X) / 2, Y + (SpawnerLink.Y - Y) / 2, Z + (SpawnerLink.Z - Z) / 2);
                            }
                            else
                            {
                                MoveTo(SpawnerLink.X, SpawnerLink.Y, SpawnerLink.Z);
                            }
                        }
                        else
                        {
                            if (Math.Abs(Z - SpawnerLink.Z) > 1)
                            {
                                InstantMoveTo(SpawnerLink.X, SpawnerLink.Y, SpawnerLink.Z);
                            }
                            AIState = AIStates.Pause1;
                        }
                        break;
                    }
                }
                if (SpawnerLink != null && aiEngine.CustomBehaviours.Contains(CustomBehavioursTypes.KeepOrientation))
                {
                    switch (AIState)
                    {
                    case AIStates.Fighting:
                    case AIStates.Flee:
                    case AIStates.Explore:
                    case AIStates.Attack:
                    case AIStates.BeingAttacked:
                    case AIStates.ReturnHome:
                        break;

                    default:
                        if (Math.Abs(Orientation - SpawnerLink.Orientation) > 0.1)
                        {
                            UpdateXYZ();
                            float x = X + (float)Math.Cos(SpawnerLink.Orientation) / 2;
                            float y = Y + (float)Math.Sin(SpawnerLink.Orientation) / 2;
                            MoveTo(x, y, Z);
                            Orientation = SpawnerLink.Orientation;
                        }
                        break;
                    }
                }
                aiEngine.OnTick();
            }


            Regeneration();
            if (this.ForceFlee)
            {
                AIState = AIStates.Flee;
            }
            if (this.ForceStun)
            {
                AIState = AIStates.Pause1;
            }

            //if ( this.GetType().ToString().EndsWith( "DarkeyeBonecaster" ) )
            //	World.allConnectedAccounts.BroadCastMessage( "blabla " + AIState.ToString() );

            switch (AIState)
            {
            case AIStates.BeingAttacked:
                if (AttackTarget != null && AttackTarget.HitPoints > 0)
                {
                    AIState = AIStates.Fighting;
                    BeginCombatWith(AttackTarget);
                }
                else
                {
                    AIState = AIStates.DoingNothing;
                }
                break;

            case AIStates.Flee:
                if (!ForceFlee && Distance(AttackTarget) > 40 * 40)
                {
                    Running      = false;
                    AIState      = AIStates.Explore;
                    AttackTarget = null;
                }
                else
                {
                    Running = true;
                    Flee(AttackTarget);
                }
                break;

            case AIStates.Explore:
            case AIStates.LookingForPrey:
                OnMovementHeartBeat();
                break;

            case AIStates.Fighting:
            case AIStates.Attack:
                break;

            default:
                break;
            }
            if (DebugSniffer != null)
            {
                DebugSniffer.SendMessage("BaseCreature::OnTick::FinalAIState = " + AIState);
            }
        }
 public override void DisplayInfo(Character ch)
 {
     ch.SendMessage("Spawner for " + Name);
     ch.SendMessage("Amount " + CurrentAmount.ToString() + "/" + this.howMuch.ToString());
 }
 public override void DisplayInfo(Character ch)
 {
     ch.SendMessage("Spawner for " + Name);
 }
Esempio n. 7
0
        public static void OnCMSG_TAXIQUERYAVAILABLENODES(Character ch)
        {
            ushort block;
            uint part;
            uint []TaxiField = new uint[8];

            uint CurrentNode = Taxi.ChoseTaxiNode(ch);
            block = (ushort)((CurrentNode - 1) / 32);
            part = (uint)1 << (ushort)((CurrentNode - 1) % 32);
            if((ch.TaxiField[block] & part) != part)
            {
                ch.TaxiField[block] |=(uint)part;
                ch.SendMessage("You find new taxi position");

                byte []b = new byte[16];
                int w = 4;
                Converter.ToBytes( ch.Guid, b, ref w );
                Converter.ToBytes( (ushort)1, b, ref w );
                ch.Send( OpCodes.SMSG_TAXINODE_STATUS, b, w );
            }
            uint []AvailableTaxiField = AvailableTaxiPaths(CurrentNode);
            TaxiField[block] |= part;
            AvailableTaxiField[block] = AvailableTaxiField[block] | TaxiField[block];

            byte []c = new byte[388];
            int t = 4;
            Converter.ToBytes( (uint)1, c, ref t );
            Converter.ToBytes( ch.Guid, c, ref t );
            Converter.ToBytes( (uint)CurrentNode, c, ref t );
            for(int i = 0; i < 8;i++)
            {
            /*	if (ch.Player.AccessLevel == AccessLevels.GM || ch.Player.AccessLevel == AccessLevels.Admin)
                {
                    if(i == 0 || i == 1)
                        TaxiField[ i ] = 0xffffffff;
                }
                else */
                TaxiField[i] = TaxiField[i] | ch.TaxiField[i];
                TaxiField[i] = TaxiField[i] & AvailableTaxiField[i];
                Converter.ToBytes( (uint)TaxiField[i], c, ref t );
            }
            ch.Send( OpCodes.SMSG_SHOWTAXINODES, c, t );
        }
Esempio n. 8
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 );
			}
		}
Esempio n. 9
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 );
			}
		}
Esempio n. 10
0
 public override void DisplayInfo( Character ch )
 {
     ch.SendMessage( "Spawner for " + Name );
 }