Пример #1
0
        public static void OnLogout(PlayerMobile pm)
        {
            if (pm == null)
            {
                return;
            }

            BaseCreature check = (BaseCreature)SummonFamiliarSpell.Table[pm];

            if (check != null)
            {
                check.Delete();
            }
        }
Пример #2
0
        public override void OnAfterDelete()
        {
            base.OnAfterDelete();

            for (int i = 0; i < m_Statues.Count; i++)
            {
                BaseCreature bc = m_Statues[i];

                if (!bc.Deleted)
                {
                    bc.Delete();
                }
            }
        }
Пример #3
0
        public virtual void DonatePet(PlayerMobile player, BaseCreature pet)
        {
            for (int i = 0; i < this.m_Donations.Count; i++)
            {
                if (this.m_Donations[i].Type == pet.GetType())
                {
                    pet.Delete();
                    this.Donate(player, this.m_Donations[i], 1);
                    return;
                }
            }

            player.SendLocalizedMessage(1073113); // This Collection is not accepting that type of creature.
        }
Пример #4
0
        //RUFO beginfunction
        private void SellPetForGold(Mobile from, BaseCreature pet, int goldamount)
        {
            Item gold = new Gold(goldamount);

            pet.ControlTarget = null;
            pet.ControlOrder  = OrderType.None;
            pet.Internalize();
            pet.SetControlMaster(null);
            pet.SummonMaster = null;
            pet.Delete();

            Container backpack = from.Backpack;

            if (backpack == null || !backpack.TryDropItem(from, gold, false))
            {
                gold.MoveToWorld(from.Location, from.Map);
            }
        }
Пример #5
0
        public override void OnActionCombat()
        {
            Mobile combatant = Combatant;

            if (combatant == null || combatant.Deleted || combatant.Map != Map || !InRange(combatant, 12) || !CanBeHarmful(combatant) || !InLOS(combatant))
            {
                if (m_DarkWisp != null)
                {
                    m_DarkWisp.Delete();
                }
            }
            else if (m_DarkWisp != null && !m_DarkWisp.Deleted)
            {
                m_DarkWisp.Combatant = combatant;
            }
            else if (!Paralyzed && DateTime.Now >= m_NextAttack)
            {
                DarkWispAttack(combatant);
                m_NextAttack = DateTime.Now + TimeSpan.FromSeconds(8.0 + (8.0 * Utility.RandomDouble()));
            }
        }
Пример #6
0
        public static void Summon(BaseCreature creature, Mobile caster, int sound, TimeSpan duration, bool scaleDuration, bool scaleStats)
        {
            Map map = caster.Map;

            if (map == null)
                return;

            double scale = 1.0 + ((caster.Skills[SkillName.Magery].Value - 100.0) / 200.0);

            if (scaleDuration)
                duration = TimeSpan.FromSeconds(duration.TotalSeconds * scale);

            if (scaleStats)
            {
                creature.RawStr = (int)(creature.RawStr * scale);
                creature.Hits = creature.HitsMax;

                creature.RawDex = (int)(creature.RawDex * scale);
                creature.Stam = creature.StamMax;

                creature.RawInt = (int)(creature.RawInt * scale);
                creature.Mana = creature.ManaMax;
            }

            Point3D p = new Point3D(caster);

            if (SpellHelper.FindValidSpawnLocation(map, ref p, true))
            {
                BaseCreature.Summon(creature, caster, p, sound, duration);
                return;
            }

            /*
            int offset = Utility.Random( 8 ) * 2;

            for( int i = 0; i < m_Offsets.Length; i += 2 )
            {
            int x = caster.X + m_Offsets[(offset + i) % m_Offsets.Length];
            int y = caster.Y + m_Offsets[(offset + i + 1) % m_Offsets.Length];

            if( map.CanSpawnMobile( x, y, caster.Z ) )
            {
            BaseCreature.Summon( creature, caster, new Point3D( x, y, caster.Z ), sound, duration );
            return;
            }
            else
            {
            int z = map.GetAverageZ( x, y );

            if( map.CanSpawnMobile( x, y, z ) )
            {
            BaseCreature.Summon( creature, caster, new Point3D( x, y, z ), sound, duration );
            return;
            }
            }
            }
            * */

            creature.Delete();
            caster.SendLocalizedMessage(501942); // That location is blocked.
        }
Пример #7
0
		public static bool Summon( BaseCreature creature, bool controlled, Mobile caster, Point3D p, int sound, TimeSpan duration )
		{
			if ( caster.Followers + creature.ControlSlots > caster.FollowersMax )
			{
				caster.SendLocalizedMessage( 1049645 ); // You have too many followers to summon that creature.
				creature.Delete();
				return false;
			}

			m_Summoning = true;

			if ( controlled )
				creature.SetControlMaster( caster );

			creature.RangeHome = 10;
			creature.Summoned = true;

			creature.SummonMaster = caster;

			Container pack = creature.Backpack;

			if ( pack != null )
			{
				for ( int i = pack.Items.Count - 1; i >= 0; --i )
				{
					if ( i >= pack.Items.Count )
						continue;

					pack.Items[i].Delete();
				}
			}

			new UnsummonTimer( caster, creature, duration ).Start();
			creature.m_SummonEnd = DateTime.Now + duration;

			creature.MoveToWorld( p, caster.Map );

			Effects.PlaySound( p, creature.Map, sound );

			m_Summoning = false;

			return true;
		}
Пример #8
0
        protected void Spawn(Point3D p, Map map, BaseCreature spawn)
        {
            if (map == null)
            {
                spawn.Delete();
                return;
            }

            int x = p.X, y = p.Y;

            for (int j = 0; j < 20; ++j)
            {
                int tx = p.X - 2 + Utility.Random(5);
                int ty = p.Y - 2 + Utility.Random(5);

                LandTile t = map.Tiles.GetLandTile(tx, ty);

                if (t.Z == p.Z && ((t.ID >= 0xA8 && t.ID <= 0xAB) || (t.ID >= 0x136 && t.ID <= 0x137)) && !Spells.SpellHelper.CheckMulti(new Point3D(tx, ty, p.Z), map))
                {
                    x = tx;
                    y = ty;
                    break;
                }
            }

            spawn.MoveToWorld(new Point3D(x, y, p.Z), map);

            if (spawn is Kraken && 0.2 > Utility.RandomDouble())
                spawn.PackItem(new MessageInABottle(map == Map.Felucca ? Map.Felucca : Map.Trammel));
        }
Пример #9
0
        public static bool Summon( BaseCreature creature, bool controlled, Mobile caster, Point3D p, int sound, TimeSpan duration )
        {
            if ( caster.Followers + creature.ControlSlots > caster.FollowersMax )
            {
                caster.SendLocalizedMessage( 1049645 ); // You have too many followers to summon that creature.
                creature.Delete();
                return false;
            }

            m_Summoning = true;

            creature.RangeHome = 10;
            creature.Summoned = true;

            if ( controlled )
                creature.SetControlMaster( caster );

            creature.SummonMaster = caster;

            Container pack = creature.Backpack;

            if ( pack != null )
            {
                for ( int i = pack.Items.Count - 1; i >= 0; --i )
                {
                    if ( i >= pack.Items.Count )
                        continue;

                    ( (Item) pack.Items[i] ).Delete();
                }
            }

            double hitsScalar = 1.0 + ( ArcaneEmpowermentSpell.GetSummonHitsBonus( caster ) / 100 );

            if ( hitsScalar != 1.0 )
                creature.SetHits( (int) ( creature.HitsMax * hitsScalar ) );

            new UnsummonTimer( caster, creature, duration ).Start();
            creature.m_SummonEnd = DateTime.Now + duration;

            creature.MoveToWorld( p, caster.Map );

            Effects.PlaySound( p, creature.Map, sound );

            if ( creature is EnergyVortex || creature is BladeSpirits )
                SpellHelper.CheckSummonLimits( creature );

            m_Summoning = false;

            return true;
        }
Пример #10
0
        public virtual void DonatePet(PlayerMobile player, BaseCreature pet)
        {
            for (int i = 0; i < this.m_Donations.Count; i ++)
                if (this.m_Donations[i].Type == pet.GetType())
                {
                    pet.Delete();
                    this.Donate(player, this.m_Donations[i], 1);
                    return;
                }

            player.SendLocalizedMessage(1073113); // This Collection is not accepting that type of creature.
        }
Пример #11
0
        public static void Summon( BaseCreature creature, Mobile caster, int sound, TimeSpan duration, bool scaleDuration, bool scaleStats )
        {
            Map map = caster.Map;

            if( map == null )
                return;

            double scale = 1.0 + ((caster.Skills[SkillName.Magery].Value - 100.0) / 200.0);

            if( scaleDuration )
                duration = TimeSpan.FromSeconds(duration.TotalSeconds * scale);

            if ( creature != null && creature.ControlMaster != null && creature.ControlMaster is Player)
            {
                Summoner sum = Perk.GetByType<Summoner>((Player)creature.ControlMaster);

                if (sum != null && sum.Remanence())
                {
                    duration += TimeSpan.FromSeconds(90.0);
                }

            }

            Point3D p = new Point3D(caster);

            if( SpellHelper.FindValidSpawnLocation(map, ref p, true) )
            {
                BaseCreature.Summon(creature, caster, p, sound, duration);

                if (creature != null && creature.ControlMaster != null && creature.ControlMaster is Player)
                {
                    Summoner sum = Perk.GetByType<Summoner>((Player)creature.ControlMaster);

                    if (sum != null && sum.IntelligentDesign())
                    {
                        creature.SetSkill(SkillName.Wrestling, creature.Skills.Wrestling.Value + Utility.RandomMinMax(15, 20));
                        creature.SetSkill(SkillName.Tactics, creature.Skills.Tactics.Value + Utility.RandomMinMax(20, 25));
                        creature.SetSkill(SkillName.MagicResist, creature.Skills.MagicResist.Value + Utility.RandomMinMax(30, 40));
                        creature.SetSkill(SkillName.Meditation, creature.Skills.Meditation.Value + Utility.RandomMinMax(30, 40));
                        creature.SetSkill(SkillName.Magery, creature.Skills.Magery.Value + Utility.RandomMinMax(15, 20));
                        creature.SetSkill(SkillName.EvalInt, creature.Skills.EvalInt.Value + Utility.RandomMinMax(15, 20));
                    }

                    if (sum != null && sum.SecondNature())
                    {
                        creature.HitsMaxSeed += (int)(creature.HitsMaxSeed * 0.33) + Utility.RandomMinMax(20, 40);
                        creature.Hits = creature.HitsMax;
                    }

                    if (sum != null && sum.Horde())
                    {

                        for(int x = 1; x <= 3; x ++)
                        {
                            if (creature.ControlMaster.Followers + creature.ControlSlots <= creature.ControlMaster.FollowersMax)
                            {
                                BaseCreature newSummon;
                                newSummon = Activator.CreateInstance(creature.GetType()) as BaseCreature;

                                if (SpellHelper.FindValidSpawnLocation(map, ref p, true))
                                    BaseCreature.Summon(newSummon, caster, p, sound, duration);

                                if (sum != null && sum.IntelligentDesign())
                                {
                                    newSummon.SetSkill(SkillName.Wrestling, creature.Skills.Wrestling.Value + Utility.RandomMinMax(15, 20));
                                    newSummon.SetSkill(SkillName.Tactics, creature.Skills.Tactics.Value + Utility.RandomMinMax(20, 25));
                                    newSummon.SetSkill(SkillName.MagicResist, creature.Skills.MagicResist.Value + Utility.RandomMinMax(30, 40));
                                    newSummon.SetSkill(SkillName.Meditation, creature.Skills.Meditation.Value + Utility.RandomMinMax(30, 40));
                                    newSummon.SetSkill(SkillName.Magery, creature.Skills.Magery.Value + Utility.RandomMinMax(15, 20));
                                    newSummon.SetSkill(SkillName.EvalInt, creature.Skills.EvalInt.Value + Utility.RandomMinMax(15, 20));
                                }

                                if (sum != null && sum.SecondNature())
                                {
                                    newSummon.HitsMaxSeed += (int)(newSummon.HitsMaxSeed * 0.33) + Utility.RandomMinMax(20, 40);
                                    newSummon.Hits = newSummon.HitsMax;
                                }
                            }
                        }
                    }
                }

                return;
            }

            creature.Delete();
            caster.SendLocalizedMessage(501942); // That location is blocked.
        }
Пример #12
0
        public void Summon(BaseCreature creature, Mobile caster, int sound, TimeSpan duration, Point3D spawnAt)
        {
            Map map = caster.Map;

            if (map == null)
                return;

            if (map.CanFit(spawnAt.X, spawnAt.Y, spawnAt.Z, 1, true, false, true))
            {
                BaseCreature.Summon(creature, caster, spawnAt, sound, duration);
                return;
            }

            creature.Delete();
            caster.SendLocalizedMessage(501942); // That location is blocked.
        }
Пример #13
0
		protected static void Spawn( Point3D p, Map map, BaseCreature spawn )
		{
			if ( map == null )
			{
				spawn.Delete();
				return;
			}

			int x = p.X, y = p.Y;

			for ( int j = 0; j < 20; ++j )
			{
				int tx = p.X - 2 + Utility.Random( 5 );
				int ty = p.Y - 2 + Utility.Random( 5 );

				LandTile t = map.Tiles.GetLandTile( tx, ty );

				if ( t.Z == p.Z && ( (t.ID >= 0xA8 && t.ID <= 0xAB) || (t.ID >= 0x136 && t.ID <= 0x137) ) && !SpellHelper.CheckMulti( new Point3D( tx, ty, p.Z ), map ) )
				{
					x = tx;
					y = ty;
					break;
				}
			}

			spawn.MoveToWorld( new Point3D( x, y, p.Z ), map );

			if ( spawn is AncientLich && 0.1 > Utility.RandomDouble() )
				spawn.PackItem( new MysticFishingNet() );
		}
Пример #14
0
      		public override void Deserialize( GenericReader reader )
      		{
         		base.Deserialize( reader );

         		int version = reader.ReadInt();

			switch ( version )
			{
				case 14: // Fixed War Horese
				{
					m_PetTitle = reader.ReadString();
					goto case 13;
				}
				case 13: // Fixed War Horese
				{
					m_Faction = Faction.ReadReference( reader );
					goto case 12;
				}
				case 12: // Advanced Pet Addon
				{
					m_Exp = reader.ReadInt();
					m_NextLevel = reader.ReadInt();
					m_Level = reader.ReadInt();
					m_MaxLevel = reader.ReadInt();
					m_AllowMating = reader.ReadBool();
					m_Evolves = reader.ReadBool();
					m_Gen = reader.ReadInt();
					m_MatingDelay = reader.ReadDeltaTime();
					m_Form1 = reader.ReadInt();
					m_Form2 = reader.ReadInt();
					m_Form3 = reader.ReadInt();
					m_Form4 = reader.ReadInt();
					m_Form5 = reader.ReadInt();
					m_Form6 = reader.ReadInt();
					m_Form7 = reader.ReadInt();
					m_Form8 = reader.ReadInt();
					m_Form9 = reader.ReadInt();
					m_Sound1 = reader.ReadInt();
					m_Sound2 = reader.ReadInt();
					m_Sound3 = reader.ReadInt();
					m_Sound4 = reader.ReadInt();
					m_Sound5 = reader.ReadInt();
					m_Sound6 = reader.ReadInt();
					m_Sound7 = reader.ReadInt();
					m_Sound8 = reader.ReadInt();
					m_Sound9 = reader.ReadInt();
					m_UsesForm1 = reader.ReadBool();
					m_UsesForm2 = reader.ReadBool();
					m_UsesForm3 = reader.ReadBool();
					m_UsesForm4 = reader.ReadBool();
					m_UsesForm5 = reader.ReadBool();
					m_UsesForm6 = reader.ReadBool();
					m_UsesForm7 = reader.ReadBool();
					m_UsesForm8 = reader.ReadBool();
					m_UsesForm9 = reader.ReadBool();
					m_F0 = reader.ReadBool();
					m_F1 = reader.ReadBool();
					m_F2 = reader.ReadBool();
					m_F3 = reader.ReadBool();
					m_F4 = reader.ReadBool();
					m_F5 = reader.ReadBool();
					m_F6 = reader.ReadBool();
					m_F7 = reader.ReadBool();
					m_F8 = reader.ReadBool();
					m_F9 = reader.ReadBool();
					goto case 11;
				}
				case 11: // Fixed Pets Losing Bond Time
				{
					m_BondingBegin = reader.ReadDateTime();
					goto case 10;
				}
				case 10: // Ability Points Fix
				{
					m_AbilityPoints = reader.ReadInt();
					goto case 9;
				}
				case 9: // Swamp Dragon Armor Fix
				{
					m_BardingExceptional = reader.ReadBool();
					m_BardingCrafter = reader.ReadMobile();
					m_HasBarding = reader.ReadBool();
					m_BardingHP = reader.ReadInt();
					m_BardingResource = (CraftResource) reader.ReadInt();
					goto case 8;
				}
				case 8: // Pet Skill Cap Fix
				{
					m_CapWrestling = reader.ReadDouble();
					m_CapTactics = reader.ReadDouble();
					m_CapResist = reader.ReadDouble();
					m_CapAnatomy = reader.ReadDouble();
					m_CapPoisoning = reader.ReadDouble();
					m_CapMagery = reader.ReadDouble();
					m_CapEvalInt = reader.ReadDouble();
					m_CapMed = reader.ReadDouble();
					goto case 7;
				} 
				case 7: // Sheep Wool Fix
				{
					m_SheepWool = reader.ReadDeltaTime();
					goto case 6;
				}
				case 6: // Disable Command Addon
				{
					m_Disabled = reader.ReadBool();
					goto case 5;
				}
				case 5: // Evo Pet Fix
				{
					m_PetS1 = reader.ReadBool();
					m_PetS2 = reader.ReadBool();
					m_PetS3 = reader.ReadBool();
					m_PetS4 = reader.ReadBool();
					m_PetS5 = reader.ReadBool();
					m_PetS6 = reader.ReadBool();
					goto case 4;
				}
				case 4: // Evo Pet Fix
				{
					m_IsFemale = reader.ReadBool();
					goto case 3;
				}
				case 3: // Insta Heal On Shrink Fix
				{
					m_PetHitsNow = reader.ReadInt();
					m_PetStamNow = reader.ReadInt();
					m_PetManaNow = reader.ReadInt();
					goto case 2;
				}
				case 2: // Mount Fix
				{
					m_MountID = reader.ReadInt();
					goto case 1;
				}	
				case 1: // Evo Dragon Addon
				{
					m_PetKP = reader.ReadInt();
					m_PetStage = reader.ReadInt();
					m_PetHasEgg = reader.ReadBool();
					m_PetAllowMating = reader.ReadBool();
					m_PetPregnant = reader.ReadBool();
					goto case 0;
				}
				case 0: // Initial Release
				{
					m_IsDeed = reader.ReadBool();
					m_Mob = (BaseCreature)reader.ReadMobile();
					m_PetHue = reader.ReadInt();
					m_PetBonded = reader.ReadBool();
					m_PetOwner = reader.ReadMobile();
					m_MobTypeString = reader.ReadString();
					m_Locked = reader.ReadBool();
					m_PetMinTame = reader.ReadDouble();
					m_PetControlSlots = reader.ReadInt();
					m_PetName = reader.ReadString();
					m_PetMinDamage = reader.ReadInt();
					m_PetMaxDamage = reader.ReadInt();
					m_PetBody = reader.ReadInt();
					m_PetSound = reader.ReadInt();
					m_PetVArmor = reader.ReadInt();
					m_PetStr = reader.ReadInt();
					m_PetDex = reader.ReadInt();
					m_PetInt = reader.ReadInt();
					m_PetHits = reader.ReadInt();
					m_PetStam = reader.ReadInt();
					m_PetMana = reader.ReadInt();
					m_PetPhysicalResist = reader.ReadInt();
					m_PetColdResist = reader.ReadInt();
					m_PetFireResist = reader.ReadInt();
					m_PetPoisonResist = reader.ReadInt();
					m_PetEnergyResist = reader.ReadInt();
					m_PetPhysicalDamage = reader.ReadInt();
					m_PetColdDamage = reader.ReadInt();
					m_PetFireDamage = reader.ReadInt();
					m_PetPoisonDamage = reader.ReadInt();
					m_PetEnergyDamage = reader.ReadInt();
					m_PetWrestling = reader.ReadDouble();
					m_PetTactics = reader.ReadDouble();
					m_PetResist = reader.ReadDouble();
					m_PetAnatomy = reader.ReadDouble();
					m_PetPoisoning = reader.ReadDouble();
					m_PetMagery = reader.ReadDouble();
					m_PetEvalInt = reader.ReadDouble();
					m_PetMed = reader.ReadDouble();
					break;
				}

			}

			if ( m_Mob != null && !m_Mob.Tamable )
			{
				m_Mob.Delete();
				this.Delete();
			}
      		}
Пример #15
0
        public static void RemoveAllEffects(BaseCreature target, Mobile caster)
        {
            //We need to make sure that the creature has no timers on before we delete it
            RemoveAllEffects((Mobile)target, caster);

            if (target.Summoned && !target.IsAnimatedDead)
            {
                Effects.PlaySound(target, target.Map, 513);
                Effects.PlaySound(target, target.Map, 510);
                Effects.SendLocationParticles(EffectItem.Create(target.Location, target.Map, EffectItem.DefaultDuration), 0x3728, 20, 20, 2023);
                target.Delete();
            }
        }