Пример #1
0
		public PlayerQuestDeed(BaseContainer c) : base( 0x14F0 )
		{
			base.Weight = 1.0;
			base.Name = "a quest ticket";
			m_container = c;										// the prize
			m_expires = DateTime.Now + TimeSpan.FromHours(24.0);	// Heartbeat has it's own hadrcoded notion of 24 hours not tied to this value
			m_PrizeID = (int)m_container.Serial;					// identifies the prize
			PlayerQuestManager.Deeds.Add(this);						// add to our managers list
			PlayerQuestManager.Announce();							// force an announcement now
			LogHelper Logger = new LogHelper("PlayerQuest.log", false);
			string temp = String.Format("A Player Quest Deed({0}) has been created.", this.Serial);
			Logger.Log(LogType.Item, m_container, temp);
			Logger.Finish();
		}
Пример #2
0
		private int AccountCleanupWorker (out int AcctsDeleted)
		{
			int iChecked = 0;
			AcctsDeleted = 0;

			if (CoreAI.TCAcctCleanupEnable == false)
				return 0;

			try
			{
				ArrayList results = new ArrayList();

				foreach (Account acct in Accounts.Table.Values)
				{
					iChecked++;
					if (AccountCleanupRule(acct) != 0)
					{
						results.Add(acct);
					}
				}

				if (results.Count > 0)
				{
					LogHelper Logger = new LogHelper("accountDeletion.log", false);
					for (int i = 0; i < results.Count; i++)
					{
						AcctsDeleted++;
						Account acct = (Account)results[i];

						// log it
						string temp = string.Format("Rule:{3}, Username:{0}, Created:{1}, Last Login:{4}, Email:{2}",
							acct.Username,
							acct.Created,
							acct.EmailAddress,
							AccountCleanupRule(acct),
							acct.LastLogin);
						Logger.Log(LogType.Text, temp);

						// delete it!
						acct.Delete();
					}
					Logger.Finish();
				}
			}
			catch (Exception e)
			{
				LogHelper.LogException(e);
				System.Console.WriteLine("Exception Caught in Account Cleanup code: " + e.Message);
				System.Console.WriteLine(e.StackTrace);
			}
			return iChecked;
		}
Пример #3
0
		private void ConsumerPriceIndexWorker()
		{
			try
			{
				LogHelper Logger1 = new LogHelper("ConsumerPriceIndexNightly.log", true);	// this one gets emailed each night
				LogHelper Logger2 = new LogHelper("ConsumerPriceIndex.log", false);			// this is a running account

				string s1, s2;
				Scripts.Commands.Diagnostics.CPI_Worker(out s1, out s2);
				Logger1.Log(LogType.Text, s1);
				Logger1.Log(LogType.Text, s2);
				Logger2.Log(LogType.Text, s1);
				Logger2.Log(LogType.Text, s2);

				Logger1.Finish();
				Logger2.Finish();
			}
			catch (Exception e)
			{
				LogHelper.LogException(e);
				System.Console.WriteLine("ConsumerPriceIndex code: " + e.Message);
				System.Console.WriteLine(e.StackTrace);
			}
		}
Пример #4
0
		private void WealthTrackerWorker()
		{
			try
			{
				int limit = 10;     // top 10 farmers
				int timeout = 90;   // active within the last 90 minutes

				// compile the constrained list
				Server.Engines.WealthTracker.IPDomain[] list = Server.Engines.WealthTracker.ReportCompiler(limit, timeout);

				LogHelper Logger1 = new LogHelper("WealthTrackerNightly.log", true);	// this one gets emailed each night
				LogHelper Logger2 = new LogHelper("WealthTracker.log", false);			// this is a running account

				// write a super minimal report
				for (int ix = 0; ix < list.Length; ix++)
				{
					Server.Engines.WealthTracker.IPDomain node = list[ix] as Server.Engines.WealthTracker.IPDomain;
					Server.Engines.WealthTracker.AccountDomain ad = Server.Engines.WealthTracker.GetFirst(node.accountList) as Server.Engines.WealthTracker.AccountDomain; // just first account
					Mobile m = Server.Engines.WealthTracker.GetFirst(ad.mobileList) as Mobile;                   // just first mobile
					string sx = String.Format("mob:{2}, gold:{0}, loc:{1}", node.gold, node.location, m);
					Logger1.Log(LogType.Text, sx);
					Logger2.Log(LogType.Text, sx);
				}

				Logger1.Finish();
				Logger2.Finish();
			}
			catch (Exception e)
			{
				LogHelper.LogException(e);
				System.Console.WriteLine("WealthTracker code: " + e.Message);
				System.Console.WriteLine(e.StackTrace);
			}
		}
Пример #5
0
		private int PlayerQuestCleanupWorker(out int PlayerQuestsDeleted)
		{
			PlayerQuestsDeleted = 0;
			int count = 0;
			LogHelper Logger = null;
			try
			{
				ArrayList ToDelete = new ArrayList();

				// find expired
				foreach (Item ix in World.Items.Values)
				{
					if (ix is BaseContainer == false) continue;
					BaseContainer bc = ix as BaseContainer;
					if (bc.PlayerQuest == false) continue;
					if (bc.Deleted == true) continue;

					count++;
					// expiration date. See sister check in PlayerQuestDeed.cs
					if (DateTime.Now > bc.LastMoved + TimeSpan.FromHours(24.0))
						ToDelete.Add(bc);
				}

				// okay, now create the log file
				if (ToDelete.Count > 0)
					Logger = new LogHelper("PlayerQuest.log", false);

				// cleanup
				for (int i = 0; i < ToDelete.Count; i++)
				{
					BaseContainer bc = ToDelete[i] as BaseContainer;
					if (bc != null)
					{
						// record the expiring quest chest
						Logger.Log(LogType.Item, bc, "Player Quest prize being deleted because the quest has expired.");
						bc.Delete();
						PlayerQuestsDeleted++;
					}
				}

			}
			catch (Exception e)
			{
				LogHelper.LogException(e);
				Console.WriteLine("Exception while running Heartbeat.PlayerQuestCleanup() job");
				Console.WriteLine(e);
			}
			finally
			{
				if (Logger != null)
					Logger.Finish();
			}

			return count;
		}
Пример #6
0
		private int StrongboxCleanupWorker(out int NumberDeleted)
		{
			int iChecked = 0;
			NumberDeleted = 0;
			try
			{
				LogHelper Logger = new LogHelper("StrongboxCleanup.log", false);

				// first time we see something we think we should delete, we simply mark it 
				//	as something to delete. If we see it again and we still think we should
				//	delete it, we delete it.
				ArrayList list = new ArrayList();
				foreach (Item i in World.Items.Values)
				{
					// only look at guildstones
					if (!(i is StrongBox)) continue;
					StrongBox sb = i as StrongBox;

					iChecked++;
					if (i.Map != Map.Internal)			// not internal (internal cleanup done elsewhere)
					{
						if (sb.Owner != null					// it is owned
							&& sb.House != null					// in a house
														&& !sb.Deleted                          // duh
							&& !sb.House.IsCoOwner(sb.Owner))	// yet owner is not a co owner of the house
						{

							// if already marked, add to delete list
							if (i.ToDelete == true)
							{
								list.Add(i);
								Logger.Log(LogType.Item, i, "(Deleted)");
							}

							// mark to delete
							else
							{
								i.ToDelete = true;
								Logger.Log(LogType.Item, i, "(Marked For Deletion)");
							}
						}
						else
						{
							if (i.ToDelete == true)
								Logger.Log(LogType.Item, i, "(Unmarked For Deletion)");
							i.ToDelete = false;
						}
					}
				}

				// Cleanup
				foreach (Item item in list)
				{
					NumberDeleted++;
					item.Delete();
				}

				Logger.Finish();
			}
			catch (Exception e)
			{
				LogHelper.LogException(e);
				System.Console.WriteLine("Exception Caught in StrongboxCleanup removal code: " + e.Message);
				System.Console.WriteLine(e.StackTrace);
			}

			return iChecked;
		}
Пример #7
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();
			m_container = reader.ReadItem() as BaseContainer;
			m_expires = reader.ReadDateTime();
			m_PrizeID = reader.ReadInt();

			// okay, add deeds read from disk to our quest manager
			if (m_container != null && Expired == false)
				// when we deserialize we don't know the ordr in which the deeds will be read,
				//	so insure they are stored sorted.
				PlayerQuestManager.AddSorted(this);
			else
			{
				LogHelper Logger = new LogHelper("PlayerQuest.log", false);
				string temp;
				if (m_container == null)
					temp = String.Format("Orphaned Quest Deed({0}) loaded for nonexistent Chest(0x{1:X}).", this.Serial, m_PrizeID);
				else // Expired == true
					temp = String.Format("Expired Quest Deed({0}) loaded for (non)existent Chest(0x{1:X}).", this.Serial, m_PrizeID);
				Logger.Log(LogType.Text, temp);
				Logger.Finish();
			}
		}
Пример #8
0
		// Expire the rare
		public void Expire()
		{
			// Log this deletion before we lose all the associated data :P
			LogHelper lh = new LogHelper("RareExpiration.log", false, true );
			lh.Log(LogType.Item, this.RareTemplate,string.Format("{0}", this.Name));
			lh.Finish();
						
			
			// Delete the "in storage" rare 
			this.RareTemplate.Delete();
			
			// Find it in the group lists + remove
			for (int i = 0; i < RareFactory.DODGroup.Count; i++)
			{
				DODGroup dg = (DODGroup)RareFactory.DODGroup[i];
				for (int ir = 0; ir < dg.DODInst.Count; ir++)
                    if (((DODInstance)dg.DODInst[ir]) == this)
                    {   // There should never be more than one of these right?
                        dg.DODInst.RemoveAt(ir);
                        break; 
                    }
			}

			// Find it in the main rare list + remove
			for (int i = 0; i < RareFactory.DODInst.Count; i++)
			{
				DODInstance di = (DODInstance)RareFactory.DODInst[i];
                if (di == this)
                {   // There should never be more than one of these right?
                    RareFactory.DODInst.RemoveAt(i);
                    break;  
                }
			}
		}
        protected override void OnTarget(Mobile from, object target) // Override the protected OnTarget() for our feature
        {
            if (target is HouseSign && (target as HouseSign).Owner != null)
            {
                HouseSign sign = target as HouseSign;
                LogHelper Logger = null;

                try
                {
                    if (sign.Owner.IsFriend(from) == false)
                    {
                        from.SendLocalizedMessage(502094); // You must be in your house to do this.
                        return;
                    }
                    else if (UpgradeCheck(from, (target as HouseSign).Owner) == false)
                    {
                        // filters out any oddball cases and askes the user to correct it
                    }
                    else
                    {
                        BaseHouse house = (target as HouseSign).Owner;
                        Logger = new LogHelper("StorageUpgrade.log", false);
                        Logger.Log(LogType.Item, house, String.Format("Upgraded with: {0}", m_Deed.ToString()));
                        house.MaxLockDowns = (int)m_Deed.Lockdowns;
                        house.MaxSecures = (int)m_Deed.Secures;
                        // give the deeds lockboxes PLUS any taxable lockboxes thay may have purchased.
                        house.MaxLockBoxes = (int)m_Deed.LockBoxes + (int)(house.MaxLockBoxes - house.LockBoxFloor); 
                        house.LockBoxFloor = m_Deed.LockBoxes;
                        house.LockBoxCeling = m_Deed.LockBoxes * 2;
                        house.UpgradeCosts += m_Deed.Price;
                        from.SendMessage(String.Format("Upgrade complete with: {0} lockdowns, {1} secures, and {2} lockboxes.", house.MaxLockDowns, house.MaxSecures, house.MaxLockBoxes));
                        m_Deed.Delete();
                    }
                }
                catch (Exception ex)
                {
                    LogHelper.LogException(ex);
                }
                finally
                {
                    if (Logger != null)
                        Logger.Finish();
                }
            }
            else
            {
                from.SendMessage("That is not a house sign.");
            }
        }
Пример #10
0
        public static DODInstance AddRare(DODGroup group, Item src)
        {
            // Make a copy of the rare
            Item StoredItem = DupeItem(src);

            // Log the fact that we're about to move the item into storage
            LogHelper lh = new LogHelper("RareTemplateCreation.log", false, true);
            lh.Log(LogType.Item, StoredItem);
            lh.Finish();

            // Store the copy away
            StoredItem.MoveItemToIntStorage();

            // Instance the DOD on this copy
            DODInstance di = new DODInstance(StoredItem);

            // Add a new DOD instance based on the item passed
            m_DODInst.Add(di);

            // Add a reference to our active group
            group.DODInst.Add(di);

            return di;
        }
Пример #11
0
		public static Item AcquireRare(short iRarity, string sGroupName)
		{
			Item item = _AcquireRare( iRarity, sGroupName );
			LogHelper lh = new LogHelper("RareAcquired.log", false, true);
			try
			{	// log the acquired rare
				lh.Log(LogType.Item, item, String.Format("type: ({0}).",item.GetType().ToString()));
				lh.Finish();
				return item;
			}
			catch (Exception ex)
			{   
				LogHelper.LogException(ex);
			}
			finally
			{
				lh.Finish();
			}

			return (new Rocks());
		}
Пример #12
0
        // log non frineds marking in a house
        public void LogMark(Mobile m)
        {
            // log non frineds marking in a house
            try
            {
                ArrayList regions = Region.FindAll(m.Location, m.Map);
                for (int ix = 0; ix < regions.Count; ix++)
                {
                    if (regions[ix] is Regions.HouseRegion == false)
                        continue;

                    Regions.HouseRegion hr = regions[ix] as Regions.HouseRegion;
                    BaseHouse bh = hr.House;

                    if (bh != null)
                    {
                        if (bh.IsFriend(m) == false)
                        {
                            LogHelper Logger = new LogHelper("mark.log", false, true);
                            Logger.Log(LogType.Mobile, m);
                            Logger.Log(LogType.Item, this);
                            Logger.Finish();
                        }
                    }
                }
            }
            catch (Exception ex) { LogHelper.LogException(ex); }
        }
Пример #13
0
        protected override void OnTarget(Mobile from, object target) // Override the protected OnTarget() for our feature
        {
            if (target is HouseSign && (target as HouseSign).Owner != null)
            {
                HouseSign sign = target as HouseSign;
                LogHelper Logger = null;

                try
                {
                    if (sign.Owner.IsFriend(from) == false)
                    {
                        from.SendLocalizedMessage(502094); // You must be in your house to do this.
                        return;
                    }
                    else if (UpgradeCheck(from, (target as HouseSign).Owner) == false)
                    {
                        // filters out any oddball cases and askes the user to correct it
                    }
                    else
                    {
                        BaseHouse house = (target as HouseSign).Owner;
                        Logger = new LogHelper("WorkPermit.log", false);
						Logger.Log(LogType.Item, house, String.Format("WorkPermit applied: {0}", m_Deed.ToString()));
						house.MaximumBarkeepCount++;
						from.SendMessage(String.Format("Permit Accepted. You may now employ up to {0} barkeepers.", house.MaximumBarkeepCount));
                        m_Deed.Delete();
                    }
                }
                catch (Exception ex)
                {
                    LogHelper.LogException(ex);
                }
                finally
                {
                    if (Logger != null)
                        Logger.Finish();
                }
            }
            else
            {
                from.SendMessage("That is not a house sign.");
            }
        }
Пример #14
0
		public override void OnDoubleClick( Mobile from )
		{
			// must not be locked down
			if (this.IsLockedDown == true || this.IsSecure == true)
			{
				from.SendMessage( "That is locked down." );
				return;
			}
			
			LogHelper Logger = new LogHelper("PlayerQuest.log", false);
			
			// Heartbeat cleanup will cleanup the prize automatically
			if (m_container != null && m_container.Deleted == false && Expired == false)
			{
				m_container.MoveToWorld( from.Location, from.Map );		// move the the map
				m_container.PlayerQuest = false;						// unmark as special
				from.SendMessage( "You have completed the quest!" );
				string temp = String.Format("Mobile({0}) using Deed({1}) has completed the quest.", from.Serial, this.Serial);
				Logger.Log(LogType.Item, m_container, temp);
			}
			else
			{
				from.SendMessage( "That quest item has expired." );
				string temp = String.Format("Quest expired for Mobile({0}) using Deed({1}) on quest Chest(0x{2:X}).", from.Serial, this.Serial, m_PrizeID);
				Logger.Log(LogType.Text, temp);
			}
			
			// cleanup
			Logger.Finish();
			this.Delete();
		}
Пример #15
0
		private int GuildstoneCleanupWorker (out int NumberDeleted)
		{
			int iChecked = 0;
			NumberDeleted = 0;
			try
			{
				LogHelper Logger = new LogHelper("GuildstoneCleanup.log", false);

				// first time we see something we think we should delete, we simply mark it 
				//	as something to delete. If we see it again and we still think we should
				//	delete it, we delete it.
				ArrayList list = new ArrayList();
				foreach (Item i in World.Items.Values)
				{
					// only look at guildstones
					if (!(i is Guildstone)) continue;

					iChecked++;
					if (i.Map != Map.Internal)		// not internal (internal cleanup done elsewhere)
					{
						if (i.Parent == null		// not being carried
							&& !i.SpawnerTempItem	// spawner template item no deleteing!
							&& !i.IsIntMapStorage	// int storage item no deleteing!
							&& !i.Deleted			// duh
							&& !InHouse(i))			// not in a house
						{

							// if already marked, add to delete list
							if (i.ToDelete == true)
							{
								list.Add(i);
								Logger.Log(LogType.Item, i, "(Deleted)");
							}

								// mark to delete
							else
							{
								i.ToDelete = true;
								Logger.Log(LogType.Item, i, "(Marked For Deletion)");
							}
						}
						else
						{
							if (i.ToDelete == true)
								Logger.Log(LogType.Item, i, "(Unmarked For Deletion)");
							i.ToDelete = false;
						}
					}
				}

				// Cleanup
				foreach (Item item in list)
				{
					NumberDeleted++;
					item.Delete();
				}

				Logger.Finish();
			}
			catch (Exception e)
			{
				LogHelper.LogException(e);
				System.Console.WriteLine("Exception Caught in GuildstoneCleanup removal code: " + e.Message);
				System.Console.WriteLine(e.StackTrace);
			}

			return iChecked;
		}
Пример #16
0
        public void OnTarget(Mobile from, Map map, Point3D start, Point3D end, object state)
        {
            try
            {
                object[]    states  = (object[])state;
                BaseCommand command = (BaseCommand)states[0];
                string[]    args    = (string[])states[1];

                ObjectConditional cond = ObjectConditional.Parse(from, ref args);

                Rectangle2D rect = new Rectangle2D(start.X, start.Y, end.X - start.X + 1, end.Y - start.Y + 1);

                bool items, mobiles;

                if (!CheckObjectTypes(command, cond, out items, out mobiles))
                {
                    return;
                }

                IPooledEnumerable eable;

                if (items && mobiles)
                {
                    eable = map.GetObjectsInBounds(rect);
                }
                else if (items)
                {
                    eable = map.GetItemsInBounds(rect);
                }
                else if (mobiles)
                {
                    eable = map.GetMobilesInBounds(rect);
                }
                else
                {
                    return;
                }

                ArrayList objs = new ArrayList();

                foreach (object obj in eable)
                {
                    if (mobiles && obj is Mobile && !BaseCommand.IsAccessible(from, obj))
                    {
                        continue;
                    }

                    if (cond.CheckCondition(obj))
                    {
                        objs.Add(obj);
                    }
                }

                eable.Free();

                RunCommand(from, objs, command, args);
            }
            catch (Exception ex)
            {
                LogHelper.LogException(ex);
                from.SendMessage(ex.Message);
            }
        }
Пример #17
0
		private int PlayerNPCCleanupWorker(out int NumberDeleted)
		{
			int iChecked = 0;
			NumberDeleted = 0;
			try
			{
				LogHelper Logger = new LogHelper("PlayerNPCCleanup.log", false);

				// first time we see something we think we should delete, we simply mark it 
				//	as something to delete. If we see it again and we still think we should
				//	delete it, we delete it.
				ArrayList list = new ArrayList();
				foreach (Mobile i in World.Mobiles.Values)
				{
					// only look at Player owned NPCs
					bool PlayerNPC =
						i is PlayerBarkeeper ||
						i is PlayerVendor ||
						i is RentedVendor ||
						i is HouseSitter;

					if (!PlayerNPC) continue;

					iChecked++;
					if (i.Map != Map.Internal)		// not internal (internal cleanup done elsewhere)
					{
						if (!i.SpawnerTempMob		// spawner template Mobile no deleteing!
							&& !InHouse(i)			// not in a house (not with a mouse)
							&& !i.Deleted			// duh
							&& !GmPlaced(i))		// not GM placed
						{

							// if already marked, add to delete list
							if (i.ToDelete == true)
							{
								list.Add(i);
								Logger.Log(LogType.Mobile, i, "(Deleted)");
							}

								// mark to delete
							else
							{
								i.ToDelete = true;
								Logger.Log(LogType.Mobile, i, "(Marked For Deletion)");
							}
						}
						else
						{
							if (i.ToDelete == true)
								Logger.Log(LogType.Mobile, i, "(Unmarked For Deletion)");
							i.ToDelete = false;
						}
					}
				}

				// Cleanup
				foreach (Mobile m in list)
				{
					NumberDeleted++;
					m.Delete();
				}

				Logger.Finish();
			}
			catch (Exception e)
			{
				LogHelper.LogException(e);
				System.Console.WriteLine("Exception Caught in PlayerNPCCleanup removal code: " + e.Message);
				System.Console.WriteLine(e.StackTrace);
			}

			return iChecked;
		}
Пример #18
0
        private void NewPlayerGuild(Mobile from)
        {	// sanity
			if (from == null || from.Deleted == true || from.NetState == null)
				return;

            Accounting.Account a = from.Account as Accounting.Account;
            if (a != null && a.AccessLevel == AccessLevel.Player)
            {
                // 30 days young
                TimeSpan delta = DateTime.Now - a.Created;
                if (delta.TotalDays <= 30 && Accounting.Accounts.IPLookup(from.NetState.Address) == false)
				{	// unconditional add
					// from.SendGump(new JoinNEWGuildGump(from));
					Guildstone stone = FindGuild("new");
					if (stone != null && stone.Guild != null)
					{   // log it
						LogHelper logger = new LogHelper("PlayerAddedToNEWGuild.log", false, true);
						logger.Log(LogType.Mobile, from);
						logger.Finish();
						// do it
						stone.Guild.AddMember(from);
						from.DisplayGuildTitle = true;
						DateTime tx = DateTime.Now.AddDays(14);
						string title = String.Format("{0}/{1}", tx.Month, tx.Day);
						from.GuildTitle = title;
						from.GuildFealty = stone.Guild.Leader != null ? stone.Guild.Leader : from;
						stone.Guild.GuildMessage(String.Format("{0} has just joined {1}.", from.Name, stone.Guild.Abbreviation == null ? "your guild" : stone.Guild.Abbreviation));
					}
					else
						from.SendMessage("We're sorry, but the new player guild is temporarily unavailable.");
				}
                    
            }
        }
Пример #19
0
        private void FillChest()
        {
            int RaresDropped = 0;
            LogHelper Logger = new LogHelper("PirateChampChest.log", false);

            // 25 piles * 1200 = 30K gold
            for (int ix = 0; ix < 25; ix++)
            {   // force the separate piles
                Gold gold = new Gold(800, 1200);
                gold.Stackable = false;
                m_MetalChest.DropItem(gold);
                gold.Stackable = true;
            }

            // "a smelly old mackerel"
            if (Utility.RandomChance(10))
            {
                Item ii;
                ii = new BigFish();
                ii.Name = "a smelly old mackerel";
                ii.Weight = 5;
                m_MetalChest.DropItem(ii);
                RaresDropped++;
                Logger.Log(LogType.Item, ii);
            }

            // single gold ingot weight 12
            if (Utility.RandomChance(10 * 2))
            {
                Item ii;
                if (Utility.RandomBool())
                    ii = new Item(7145);
                else
                    ii = new Item(7148);

                ii.Weight = 12;
                m_MetalChest.DropItem(ii);
                RaresDropped++;
                Logger.Log(LogType.Item, ii);
            }

            // 3 gold ingots 12*3
            if (Utility.RandomChance(5 * 2))
            {
                Item ii;
                if (Utility.RandomBool())
                    ii = new Item(7146);
                else
                    ii = new Item(7149);

                ii.Weight = 12 * 3;
                m_MetalChest.DropItem(ii);
                RaresDropped++;
                Logger.Log(LogType.Item, ii);
            }

            // 5 gold ingots 12*5
            if (Utility.RandomChance(1 * 2))
            {
                Item ii;
                if (Utility.RandomBool())
                    ii = new Item(7147);
                else
                    ii = new Item(7150);

                ii.Weight = 12 * 5;
                m_MetalChest.DropItem(ii);
                RaresDropped++;
                Logger.Log(LogType.Item, ii);
            }

            // single silver ingot weight 6
            if (Utility.RandomChance(10 * 2))
            {
                Item ii;
                if (Utility.RandomBool())
                    ii = new Item(7157);
                else
                    ii = new Item(7160);

                ii.Weight = 6;
                m_MetalChest.DropItem(ii);
                RaresDropped++;
                Logger.Log(LogType.Item, ii);
            }

            // 3 silver ingots 6*3
            if (Utility.RandomChance(5 * 2))
            {
                Item ii;
                if (Utility.RandomBool())
                    ii = new Item(7158);
                else
                    ii = new Item(7161);

                ii.Weight = 6 * 3;
                m_MetalChest.DropItem(ii);
                RaresDropped++;
                Logger.Log(LogType.Item, ii);
            }

            // 5 silver ingots 6*5
            if (Utility.RandomChance(1 * 2))
            {
                Item ii;
                if (Utility.RandomBool())
                    ii = new Item(7159);
                else
                    ii = new Item(7162);

                ii.Weight = 6 * 5;
                m_MetalChest.DropItem(ii);
                RaresDropped++;
                Logger.Log(LogType.Item, ii);
            }

            // rolled map w1
            if (Utility.RandomChance(20 * 2))
            {
                Item ii;
                if (Utility.RandomBool())
                    ii = new Item(5357);
                else
                    ii = new Item(5358);

                ii.Weight = 1;
                m_MetalChest.DropItem(ii);
                RaresDropped++;
                Logger.Log(LogType.Item, ii);
            }

            // ship plans
            if (Utility.RandomChance(10 * 2))
            {
                Item ii;
                if (Utility.RandomBool())
                    ii = new Item(5361);
                else
                    ii = new Item(5362);

                ii.Weight = 1;
                m_MetalChest.DropItem(ii);
                RaresDropped++;
                Logger.Log(LogType.Item, ii);
            }

            // ship model
            if (Utility.RandomChance(5 * 2))
            {
                Item ii;
                if (Utility.RandomBool())
                    ii = new Item(5363);
                else
                    ii = new Item(5364);

                ii.Weight = 3;
                m_MetalChest.DropItem(ii);
                RaresDropped++;
                Logger.Log(LogType.Item, ii);
            }

            // "scale shield" w6
            if (Utility.RandomChance(1))
            {
                Item ii;
                if (Utility.RandomBool())
                    ii = new Item(7110);
                else
                    ii = new Item(7111);

                ii.Name = "scale shield";
                ii.Weight = 6;
                m_MetalChest.DropItem(ii);
                RaresDropped++;
                Logger.Log(LogType.Item, ii);
            }

            // level 5 chest regs & gems
            TreasureMapChest.PackRegs(m_MetalChest, 5 * 10);
            TreasureMapChest.PackGems(m_MetalChest, 5 * 5);

            // level 5 magic items
            DungeonTreasureChest.PackMagicItem(m_MetalChest, 3, 3, 0.20);
            DungeonTreasureChest.PackMagicItem(m_MetalChest, 3, 3, 0.10);
            DungeonTreasureChest.PackMagicItem(m_MetalChest, 3, 3, 0.05);

            // an a level 5 treasure map
            m_MetalChest.DropItem(new TreasureMap(5, Map.Felucca));

            Logger.Finish();
        }
Пример #20
0
		//Pix: Re-added this function because I want the safeguard before we charge
		// fees.
		public int ValidateSellItems()
		{
			int invalid = 0;

			try
			{
				Hashtable newsellitems = new Hashtable();

				Scripts.Commands.LogHelper lh = null;

				foreach (VendorItem vi in m_SellItems.Values)
				{
					if (vi == null)
					{
						if (lh == null)
						{
							lh = new Server.Scripts.Commands.LogHelper("ValidateSellItems.log");
						}

						System.Text.StringBuilder sb = new System.Text.StringBuilder();
						sb.Append("Found null VendorItem entry in vendor: ");
						sb.Append(this.Serial);
						lh.Log(sb.ToString());
						invalid++;
						continue;
					}

					if (vi.Item != null && vi.Item.Deleted == false)
					{
						Item t = vi.Item;

						if (t == null)
						{
							if (lh == null)
							{
								lh = new Server.Scripts.Commands.LogHelper("ValidateSellItems.log");
							}

							System.Text.StringBuilder sb = new System.Text.StringBuilder();
							sb.Append("Found null item entry in vendor: ");
							sb.Append(this.Serial);
							lh.Log(sb.ToString());
							invalid++;
						}
						else
						{
							while (t != null && t.Parent != this.Backpack)
							{
								t = t.Parent as Item;
							}

							if (t != null && t.Parent == this.Backpack)
							{
								newsellitems[vi.Item] = vi;
							}
							else
							{
								if (lh == null)
								{
									lh = new Server.Scripts.Commands.LogHelper("ValidateSellItems.log");
								}

								System.Text.StringBuilder sb = new System.Text.StringBuilder();
								sb.Append("Found item-not-on-vendor entry in vendor: ");
								sb.Append(this.Serial);
								sb.Append(".  Item serial is: ");
								sb.Append(vi.Item.Serial);
								lh.Log(sb.ToString());
								invalid++;
							}
						}
					}
				}

				if (lh != null)
				{
					lh.Finish();
				}

				// patch it
				m_SellItems = newsellitems;
			}
			catch (Exception e)
			{
				Scripts.Commands.LogHelper.LogException(e);
			}

			return invalid;
		}