コード例 #1
0
        /// <summary>
        /// Initializes the item Recycler, determining the state and creating the setup string.
        /// </summary>
        public static void Init()
        {
            if (Config.getTableEntry("recycler_enable") == "1")
            {
                Config.enableRecycler = true;
                Out.WriteLine("Initializing recycler...");

                int[] rclrCosts   = DB.runReadColumn("SELECT rclr_cost FROM system_recycler", 0, null);
                int[] rclrRewards = DB.runReadColumn("SELECT rclr_reward FROM system_recycler", 0, null);

                sessionLength          = int.Parse(Config.getTableEntry("recycler_session_length"));
                sessionExpireLength    = int.Parse(Config.getTableEntry("recycler_session_expirelength"));
                itemMinOwnershipLength = int.Parse(Config.getTableEntry("recycler_minownertime"));
                sessionRewards         = new Hashtable();

                setupString = "I" + Encoding.encodeVL64(itemMinOwnershipLength) + Encoding.encodeVL64(sessionLength) + Encoding.encodeVL64(sessionExpireLength) + Encoding.encodeVL64(rclrCosts.Length);
                for (int i = 0; i < rclrCosts.Length; i++)
                {
                    catalogueManager.itemTemplate Template = catalogueManager.getTemplate(rclrRewards[i]);
                    if (Template.Sprite != "")
                    {
                        sessionRewards.Add(rclrCosts[i], rclrRewards[i]);
                        setupString += Encoding.encodeVL64(rclrCosts[i]) + "H" + Template.Sprite + Convert.ToChar(2) + "H" + Encoding.encodeVL64(Template.Length) + Encoding.encodeVL64(Template.Width) + Convert.ToChar(2);
                        //setupString += Encoding.encodeVL64(rclrCosts[i]) + "H" + Template.cctName + Convert.ToChar(2) + "HJI" + Convert.ToChar(2);
                    }
                }

                Out.WriteLine("Recycler enabled.");
            }
            else
            {
                setupString = "H";
                Out.WriteLine("Recycler disabled.");
            }
        }
コード例 #2
0
        /// <summary>
        /// Initializes the item Recycler, determining the state and creating the setup string.
        /// </summary>
        public static void Init(bool Update)
        {
            if (Config.getTableEntry("recycler_enable") == "1")
            {
                Config.enableRecycler = true;
                Logging.WriteLine("Initializing recycler...");

                DataTable dTable;
                using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient())
                {
                    dTable = dbClient.getTable("SELECT rclr_cost, rclr_reward FROM system_recycler");
                }
                sessionLength          = int.Parse(Config.getTableEntry("recycler_session_length"));
                sessionExpireLength    = int.Parse(Config.getTableEntry("recycler_session_expirelength"));
                itemMinOwnershipLength = int.Parse(Config.getTableEntry("recycler_minownertime"));
                sessionRewards         = new Hashtable();

                setupString = "I" + Encoding.encodeVL64(itemMinOwnershipLength) + Encoding.encodeVL64(sessionLength) + Encoding.encodeVL64(sessionExpireLength) + Encoding.encodeVL64(dTable.Rows.Count);

                foreach (DataRow dRow in dTable.Rows)
                {
                    catalogueManager.itemTemplate Template = catalogueManager.getTemplate(Convert.ToInt32(dRow["rclr_reward"]));
                    if (Template.Sprite != "")
                    {
                        sessionRewards.Add(Convert.ToInt32(dRow["rclr_cost"]), Convert.ToInt32(dRow["rclr_reward"]));
                        setupString += Encoding.encodeVL64(Convert.ToInt32(dRow["rclr_cost"])) + "H" + Template.Sprite + Convert.ToChar(2) + "H" + Encoding.encodeVL64(Template.Length) + Encoding.encodeVL64(Template.Width) + Convert.ToChar(2);
                        //setupString += Encoding.encodeVL64(rclrCosts[i]) + "H" + Template.cctName + Convert.ToChar(2) + "HJI" + Convert.ToChar(2);
                    }
                }

                Logging.WriteLine("Recycler enabled.");
            }
            else
            {
                setupString = "H";
                Logging.WriteLine("Recycler disabled.");
            }
            if (Update)
            {
                Thread.CurrentThread.Abort();
            }
        }