public static void GiveArtifact(BaseCreature bc) { //**Begin Artifact Randomness**\\ if (percent > Utility.RandomDouble()) // 0.7 = 70% = chance to drop { bc.PackItem(ArtifactList.RandomArtifact()); } }
public static void GiveArtifact(BaseCreature bc) { //**Begin Artifact Randomness**\\ if ( percent > Utility.RandomDouble() ) // 0.7 = 70% = chance to drop bc.PackItem(ArtifactList.RandomArtifact()); }
public static void PackPicnicBasket(BaseCreature solen) { if (1 > Utility.Random(100)) { PicnicBasket basket = new PicnicBasket(); basket.DropItem(new BeverageBottle(BeverageType.Wine)); basket.DropItem(new CheeseWedge()); solen.PackItem(basket); } }
// modify these custom conversion methods to create unique paragons for spawners with this attachment #region custom conversion methods public virtual void XmlAddChest(BaseCreature bc, int treasureLevel) { if (bc == null) return; bc.PackItem(new ParagonChest(bc.Name, treasureLevel)); }
public static void AddChest(BaseCreature bc, int treasureLevel) { XmlParagon xa = GetXmlParagon(bc); if (xa != null) { xa.XmlAddChest(bc, treasureLevel); } else { bc.PackItem(new ParagonChest(bc.Name, treasureLevel)); } }
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 ) ); }
//25JUL2008 Lord_Greywolf fix for bad X *** START *** // protected void Spawn( Point2D p, Map map, BaseCreature spawn ) // { // if ( map == null ) // { // spawn.Delete(); // return; // } // int x = p.X, y = p.Y; //// for ( int j = 0; j < 5; ++j ) //// { //// int tx = p.X - 2 + Utility.Random( 5 ); //// int ty = p.Y - 2 + Utility.Random( 5 ); //// } // spawn.MoveToWorld( new Point3D( x, y, 0 ), map ); // spawn.PackItem( new TreasureMessageChest() ); //} protected void Spawn(Point2D p, Map map, BaseCreature spawn) { if (map == null) { spawn.Delete(); return; } int x = p.X, y = p.Y; if (map.CanSpawnMobile(x, y, 0)) { spawn.MoveToWorld(new Point3D(x, y, 0), map); } else { int z = map.GetAverageZ(x, y); if (map.CanSpawnMobile(x, y, z)) { spawn.MoveToWorld(new Point3D(x, y, z), map); } else if (map.CanSpawnMobile(x, y, z + 10)) { spawn.MoveToWorld(new Point3D(x, y, z + 10), map); } else if (map.CanSpawnMobile(x + 1, y + 1, z)) { spawn.MoveToWorld(new Point3D(x + 1, y + 1, z), map); } else if (map.CanSpawnMobile(x + 1, y + 1, z + 10)) { spawn.MoveToWorld(new Point3D(x + 1, y + 1, z + 10), map); } else { spawn.MoveToWorld(new Point3D(x - 1, y - 1, 100), map); } } spawn.PackItem(new TreasureMessageChest(Utility.RandomMinMax((((m_Level - 1) * 400) + 100), (((m_Level - 1) * 400) + 500)))); }
public static void TryPossessCreature(Mobile from, BaseCreature Subject) { if (from == null || Subject == null) return; if (HasPermissionsToPossess(from, Subject)) { if (Subject.NetState != null) { from.SendMessage("Target creature is already under player control!"); return; } if (from.AccessLevel < FullAccessStaffLevel) { if (IsInHouseOrBoat(Subject.Location, Map.Felucca)) { from.SendMessage("You cannot possess a creature in a house or boat."); return; } if (Subject.Blessed == true) { from.SendMessage("You cannot possess invulnerable mobs."); return; } } if (Subject.Controlled && !IsAuthorizedStaff(from)) { from.SendMessage("You cannot possess tamed or summoned creatures!"); return; } //Subject.HasBeenPseudoseerControlled = true; if (Subject.Backpack == null) { // create a backpack for things like animals that have no backpack // ... this prevents client crash in case somebody has their pack auto-opening on login Subject.PackItem(new Gold(1)); } LoggingCustom.LogPseudoseer(DateTime.Now + "\t" + from.Account + "\t" + from.Name + "\tpossessing\t" + Subject + "\tRegion: " + Subject.Region + "\tLocation: " + Subject.Location); ConnectClientToNPC(from.NetState, Subject); } else { from.SendMessage("You are not permitted to possess that creature type, only staff can grant this permission."); } }
public void Spawn(int index) { Map map = Map; if (map == null || map == Map.Internal || m_CreaturesName.Count == 0 || index >= m_CreaturesName.Count) { return; } Defrag(); if (m_Creatures.Count >= m_Count) { return; } Type type = SpawnerType.GetType((string)m_CreaturesName[index]); if (type != null) { try { object o = Activator.CreateInstance(type); if (o is Mobile) { Mobile m = (Mobile)o; m_Creatures.Add(m); InvalidateProperties(); m.Map = map; m.Location = GetSpawnPosition(); GuardKey key = new GuardKey(key_KeyVal, key_Description, key_Max, key_Delay); // m.AddToBackpack( key ); if (m is BaseCreature) { BaseCreature c = (BaseCreature)m; c.PackItem(key); c.RangeHome = m_HomeRange; c.CurrentWayPoint = m_WayPoint; if (m_Team > 0) { c.Team = m_Team; } c.Home = this.Location; } } } catch { } } }
public static BaseInstrument CheckBarding(BaseCreature from) { BaseInstrument inst = BaseInstrument.GetInstrument(from); if (inst == null) { if (from.Backpack == null) return null; inst = (BaseInstrument)from.Backpack.FindItemByType(typeof(BaseInstrument)); if (inst == null) { inst = new Harp(); inst.SuccessSound = 0x58B; inst.FailureSound = 0x58C; inst.Movable = false; from.PackItem(inst); } } BaseInstrument.SetInstrument(from, inst); return inst; }
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() ); }
public void HandleInvaderDeath(BaseCreature invader) { if (CurrentLevel.RewardItems != null && CurrentLevel.RewardItems.Count > 0) { Type selected = CurrentLevel.RewardItems.GetRandom(); if (selected.IsEqualOrChildOf<Item>()) { var item = selected.CreateInstanceSafe<Item>(); if (item != null && Utility.RandomDouble() <= (CurrentLevel.DropChance/100)) { invader.PackItem(item); } } } CurrentLevelKills++; RemoveInvader(invader); }