示例#1
0
        public override void OnHarvestFinished(Mobile from, Item tool, HarvestDefinition def, HarvestVein vein, HarvestBank bank, HarvestResource resource, object harvested)
        {
            Map     map = from.Map;
            Point3D loc = from.Location;

            HarvestResource res = vein.PrimaryResource;

            if (res == resource)
            {
                try
                {
                    if (from.Karma > -2459)
                    {
                        Titles.AwardKarma(from, -50, true);
                    }

                    if (Utility.RandomMinMax(1, 100) < 3)                         // CHECK TO SEE IF THEY WERE WITNESSED DIGGING UP A GRAVE 2%
                    {
                        int caught = 1;
                        if (from.Skills[SkillName.Hiding].Value >= 30)
                        {
                            from.SendMessage("Someone passed by, but your stealthiness has avoided you from being seen.");
                            if (from.CheckSkill(SkillName.Stealth, 0, 100))
                            {
                                caught = 0;
                            }
                        }
                        if (caught > 0)
                        {
                            from.PrivateOverheadMessage(MessageType.Regular, 1150, false, "Someone has spotted you in the distance!", from.NetState);
                            from.SendMessage("You have been reported as a criminal!");
                            from.Criminal = true;
                            Server.Items.DisguiseTimers.RemoveDisguise(from);
                        }
                    }

                    map = from.Map;

                    if (map == null)
                    {
                        return;
                    }

                    BaseCreature spawned = new Zombie();

                    switch (Utility.Random(19))
                    {
                    case 0: spawned = new Zombie(); break;

                    case 1: spawned = new Skeleton(); break;

                    case 2: spawned = new Ghoul(); break;

                    case 3: spawned = new Shade(); break;

                    case 4: spawned = new Spectre(); break;

                    case 5: spawned = new Wraith(); break;

                    case 6: spawned = new BoneKnight(); break;

                    case 7: spawned = new BoneMagi(); break;

                    case 8: spawned = new Ghostly(); break;

                    case 9: spawned = new Lich(); break;

                    case 10: spawned = new LichLord(); break;

                    case 11: spawned = new Mummy(); break;

                    case 12: spawned = new RottingCorpse(); break;

                    case 13: spawned = new Shade(); break;

                    case 14: spawned = new SkeletalKnight(); break;

                    case 15: spawned = new SkeletalWizard(); break;

                    case 16: spawned = new SkeletalMage(); break;

                    case 17: spawned = new Phantom(); break;

                    case 18: spawned = new Vampire(); break;
                    }

                    int nSpiritSpeak = (int)(from.Skills[SkillName.SpiritSpeak].Value / 10);

                    string sSaying = "";
                    switch (Utility.Random(9))
                    {
                    case 0: sSaying = "Who has disturbed me!"; break;

                    case 1: sSaying = "You dare steal from my grave?"; break;

                    case 2: sSaying = "Those that take from me will join me!"; break;

                    case 3: sSaying = "Your soul is now mine for the taking!"; break;

                    case 4: sSaying = "Who dares waken me?"; break;

                    case 5: sSaying = "Your life will be extinguished!"; break;

                    case 6: sSaying = "Do you have no respect for the dead?"; break;

                    case 7: sSaying = "I have been waiting to feast off the living!"; break;

                    case 8: sSaying = "Soon you will join my legion of the dead!"; break;
                    }

                    if ((spawned != null) && (Utility.Random(100) > (nSpiritSpeak + 85)))                             // 10% chance you will get a grave raiser
                    {
                        from.CheckSkill(SkillName.SpiritSpeak, 0, 100);
                        int offset = Utility.Random(8) * 2;

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

                            if (map.CanSpawnMobile(x, y, from.Z))
                            {
                                spawned.OnBeforeSpawn(new Point3D(x, y, from.Z), map);
                                spawned.Home      = new Point3D(x, y, from.Z);
                                spawned.RangeHome = 5;
                                spawned.Title    += " [Awakened]";
                                spawned.MoveToWorld(new Point3D(x, y, from.Z), map);
                                spawned.Say(sSaying);
                                spawned.ControlSlots = 666;
                                spawned.Combatant    = from;
                                return;
                            }
                            else
                            {
                                int z = map.GetAverageZ(x, y);

                                if (map.CanSpawnMobile(x, y, z))
                                {
                                    spawned.OnBeforeSpawn(new Point3D(x, y, z), map);
                                    spawned.Home      = new Point3D(x, y, z);
                                    spawned.RangeHome = 5;
                                    spawned.Title    += " [Awakened]";
                                    spawned.MoveToWorld(new Point3D(x, y, z), map);
                                    spawned.Say(sSaying);
                                    spawned.ControlSlots = 666;
                                    spawned.Combatant    = from;
                                    return;
                                }
                            }
                        }
                        spawned.OnBeforeSpawn(from.Location, from.Map);
                        spawned.Home      = from.Location;
                        spawned.RangeHome = 5;
                        spawned.Title    += " [Awakened]";
                        spawned.MoveToWorld(from.Location, from.Map);
                        spawned.Say(sSaying);
                        spawned.ControlSlots = 666;
                        spawned.Combatant    = from;
                    }

                    int digger = (int)(from.Skills[SkillName.Forensics].Value / 10);
                    if ((2 + digger) > Utility.Random(100))                       // chance to dig up a box
                    {
                        if (from.CheckSkill(SkillName.Forensics, 0, 125))
                        {
                            Item chest = new GraveChest(6, from);
                            switch (Utility.Random(10 + digger))
                            {
                            case 0: chest = new GraveChest(1, from); break;

                            case 1: chest = new GraveChest(1, from); break;

                            case 2: chest = new GraveChest(1, from); break;

                            case 3: chest = new GraveChest(1, from); break;

                            case 4: chest = new GraveChest(1, from); break;

                            case 5: chest = new GraveChest(1, from); break;

                            case 6: chest = new GraveChest(2, from); break;

                            case 7: chest = new GraveChest(2, from); break;

                            case 8: chest = new GraveChest(2, from); break;

                            case 9: chest = new GraveChest(2, from); break;

                            case 10: chest = new GraveChest(2, from); break;

                            case 11: chest = new GraveChest(3, from); break;

                            case 12: chest = new GraveChest(3, from); break;

                            case 13: chest = new GraveChest(3, from); break;

                            case 14: chest = new GraveChest(3, from); break;

                            case 15: chest = new GraveChest(4, from); break;

                            case 16: chest = new GraveChest(4, from); break;

                            case 17: chest = new GraveChest(4, from); break;

                            case 18: chest = new GraveChest(5, from); break;

                            case 19: chest = new GraveChest(5, from); break;
                            }
                            if (chest != null)
                            {
                                chest.MoveToWorld(loc, map);
                                from.SendMessage("you dig up a graveyard chest.");
                            }
                        }
                    }
                }
                catch
                {
                }
            }
        }