protected override void OnTick()
            {
                int  z      = m_Map.GetAverageZ(m_X, m_Y);
                bool canFit = m_Map.CanFit(m_X, m_Y, z, 6, false, false);

                for (int i = -3; !canFit && i <= 3; ++i)
                {
                    canFit = m_Map.CanFit(m_X, m_Y, z + i, 6, false, false);

                    if (canFit)
                    {
                        z += i;
                    }
                }

                if (!canFit)
                {
                    return;
                }

                Item g = new Gold(100, 200); g.Delete();

                int r1 = (int)(Utility.RandomMinMax(80, 160) * (MyServerSettings.GetGoldCutRate() * .01));
                int r2 = (int)(Utility.RandomMinMax(200, 400) * (MyServerSettings.GetGoldCutRate() * .01));
                int r3 = (int)(Utility.RandomMinMax(400, 800) * (MyServerSettings.GetGoldCutRate() * .01));
                int r4 = (int)(Utility.RandomMinMax(800, 1200) * (MyServerSettings.GetGoldCutRate() * .01));
                int r5 = (int)(Utility.RandomMinMax(1200, 1600) * (MyServerSettings.GetGoldCutRate() * .01));

                switch (Utility.Random(21))
                {
                case 0: g = new Crystals(r1); break;

                case 1: g = new DDGemstones(r2); break;

                case 2: g = new DDJewels(r2); break;

                case 3: g = new DDGoldNuggets(r3); break;

                case 4: g = new Gold(r3); break;

                case 5: g = new Gold(r3); break;

                case 6: g = new Gold(r3); break;

                case 7: g = new DDSilver(r4); break;

                case 8: g = new DDSilver(r4); break;

                case 9: g = new DDSilver(r4); break;

                case 10: g = new DDSilver(r4); break;

                case 11: g = new DDSilver(r4); break;

                case 12: g = new DDSilver(r4); break;

                case 13: g = new DDCopper(r5); break;

                case 14: g = new DDCopper(r5); break;

                case 15: g = new DDCopper(r5); break;

                case 16: g = new DDCopper(r5); break;

                case 17: g = new DDCopper(r5); break;

                case 18: g = new DDCopper(r5); break;

                case 19: g = new DDCopper(r5); break;

                case 20: g = new DDCopper(r5); break;
                }

                g.MoveToWorld(new Point3D(m_X, m_Y, z), m_Map);

                if (0.5 >= Utility.RandomDouble())
                {
                    switch (Utility.Random(3))
                    {
                    case 0:                             // Fire column
                    {
                        Effects.SendLocationParticles(EffectItem.Create(g.Location, g.Map, EffectItem.DefaultDuration), 0x3709, 10, 30, 5052);
                        Effects.PlaySound(g, g.Map, 0x208);

                        break;
                    }

                    case 1:                             // Explosion
                    {
                        Effects.SendLocationParticles(EffectItem.Create(g.Location, g.Map, EffectItem.DefaultDuration), 0x36BD, 20, 10, 5044);
                        Effects.PlaySound(g, g.Map, 0x307);

                        break;
                    }

                    case 2:                             // Ball of fire
                    {
                        Effects.SendLocationParticles(EffectItem.Create(g.Location, g.Map, EffectItem.DefaultDuration), 0x36FE, 10, 10, 5052);

                        break;
                    }
                    }
                }
            }
示例#2
0
        public static void AddCustomers(Mobile from, BaseShoppe shoppe, int customer)
        {
            string client = shoppe.Customer01;

            if (customer == 1)
            {
                client = shoppe.Customer01;
            }
            else if (customer == 2)
            {
                client = shoppe.Customer02;
            }
            else if (customer == 3)
            {
                client = shoppe.Customer03;
            }
            else if (customer == 4)
            {
                client = shoppe.Customer04;
            }
            else if (customer == 5)
            {
                client = shoppe.Customer05;
            }
            else if (customer == 6)
            {
                client = shoppe.Customer06;
            }
            else if (customer == 7)
            {
                client = shoppe.Customer07;
            }
            else if (customer == 8)
            {
                client = shoppe.Customer08;
            }
            else if (customer == 9)
            {
                client = shoppe.Customer09;
            }
            else if (customer == 10)
            {
                client = shoppe.Customer10;
            }
            else if (customer == 11)
            {
                client = shoppe.Customer11;
            }
            else if (customer == 12)
            {
                client = shoppe.Customer12;
            }

            int exist = Convert.ToInt32(GetDataElement(client, 3));

            if (from != null && exist == 0)
            {
                int repMax = (int)(GetReputation(from, shoppe) / 10);
                int repMin = (int)(repMax / 5);
                if (repMin < 10)
                {
                    repMin = 10;
                }
                if (repMin >= repMax)
                {
                    repMax = repMin + 10;
                }

                int gold = Utility.RandomMinMax(repMin, repMax);

                gold = (int)((gold * 4) * (MyServerSettings.GetGoldCutRate() * .01));

                int fame = Utility.RandomMinMax(((int)(gold / 20)), ((int)(gold / 20) + Utility.RandomMinMax(0, 3)));
                if (fame < 5)
                {
                    fame = 5;
                }
                else if (fame > 50)
                {
                    fame = 50;
                }

                int skill = Utility.RandomMinMax(((int)((gold / 125) + 35)), ((int)((gold / 125) + 35) + Utility.RandomMinMax(0, 5)));
                if (skill < 30)
                {
                    skill = 30;
                }
                else if (skill > 120)
                {
                    skill = 120;
                }

                int tools = Utility.RandomMinMax(((int)(gold / 100)), ((int)(gold / 100) + Utility.RandomMinMax(0, 2)));
                if (tools < 1)
                {
                    tools = 1;
                }
                else if (tools > 10)
                {
                    tools = 10;
                }

                int resource = Utility.RandomMinMax(((int)(gold / 20)), ((int)(gold / 20) + Utility.RandomMinMax(0, 5)));
                if (resource < 5)
                {
                    resource = 5;
                }

                string customerName = NameList.RandomName("male");
                if (Utility.RandomBool())
                {
                    customerName = NameList.RandomName("female");
                }

                string customerTitle = HenchmanFunctions.GetTitle();

                string customerTask = Server.Items.BaseShoppe.MakeTask(shoppe);

                string finalCustomer = customerTask + "#" + customerName + " " + customerTitle + "#";
                finalCustomer = finalCustomer + "1" + "#" + gold + "#" + tools + "#" + resource + "#" + skill + "#" + fame + "";

                if (customer == 1)
                {
                    shoppe.Customer01 = finalCustomer;
                }
                else if (customer == 2)
                {
                    shoppe.Customer02 = finalCustomer;
                }
                else if (customer == 3)
                {
                    shoppe.Customer03 = finalCustomer;
                }
                else if (customer == 4)
                {
                    shoppe.Customer04 = finalCustomer;
                }
                else if (customer == 5)
                {
                    shoppe.Customer05 = finalCustomer;
                }
                else if (customer == 6)
                {
                    shoppe.Customer06 = finalCustomer;
                }
                else if (customer == 7)
                {
                    shoppe.Customer07 = finalCustomer;
                }
                else if (customer == 8)
                {
                    shoppe.Customer08 = finalCustomer;
                }
                else if (customer == 9)
                {
                    shoppe.Customer09 = finalCustomer;
                }
                else if (customer == 10)
                {
                    shoppe.Customer10 = finalCustomer;
                }
                else if (customer == 11)
                {
                    shoppe.Customer11 = finalCustomer;
                }
                else if (customer == 12)
                {
                    shoppe.Customer12 = finalCustomer;
                }
            }
        }