Exemplo n.º 1
0
 public void DetermineBuryLocation(ZombieAvatar pm, object target, IEntity cache)
 {
     if (target is LandTarget)
     {
         var loc  = ((LandTarget)target).Location;
         var list = loc.GetEntitiesInRange(Map.ZombieLand, 3);
         if (list.Exists(x => x is CacheChest && ((CacheChest)x).Buried))
         {
             pm.SendMessage(54, "You cannot bury a cache here.  There is one already present in this location!  Try to dig it up first.");
         }
         else if (DigTimer == null || !DigTimer.Running)
         {
             var chest = cache as CacheChest;
             if (chest != null)
             {
                 pm.PublicOverheadMessage(MessageType.Label, pm.SpeechHue, true, "*Begins to bury a cache*");
                 chest.MoveToWorld(loc, Map.ZombieLand);
                 DigTimer = new InternalBuryTimer(chest, pm);
                 DigTimer.Start();
                 pm.Frozen = true;
             }
         }
         else
         {
             pm.SendMessage(54, "You are already digging with this shovel!");
         }
     }
 }
Exemplo n.º 2
0
        public void DetermineTarget(ZombieAvatar pm, object target)
        {
            IEntity targetedEntity = target as IEntity;

            if (targetedEntity is CacheChest)
            {
                pm.SendMessage(54, "Where do you wish to bury this cache chest?");
                pm.Target = new GenericSelectTarget <object>((m, t) => DetermineBuryLocation(pm, t, targetedEntity), m => { }, -1, true, TargetFlags.None);
                return;
            }
            if (target is LandTarget)
            {
                var tile = ((LandTarget)target);
                if (!Mining.m_MountainAndCaveTiles.Contains(tile.TileID))
                {
                    pm.PlaySound(Utility.RandomList(0x126));
                    pm.Animate(11, 5, 1, true, false, 0);
                    pm.PublicOverheadMessage(MessageType.Label, pm.SpeechHue, true, "*Begins to dig*");
                    var list = tile.Location.GetEntitiesInRange(Map.ZombieLand, 3);
                    if (list.Exists(x => x is CacheChest && ((CacheChest)x).Buried))
                    {
                        pm.SendMessage(54, "You have found a cache!");
                        var chest = list.First(x => x is CacheChest) as CacheChest;
                        if (chest != null)
                        {
                            DigTimer = new InternalDigTimer(chest, pm);
                            DigTimer.Start();
                            pm.Frozen = true;
                        }
                        return;
                    }
                    pm.SendMessage(54, "There is nothing of note in this location.");
                }
                else
                {
                    if (!HarvestSystem.CheckHarvest(pm, this))
                    {
                        return;
                    }

                    DoHarvest(pm, target);
                }
            }
        }
Exemplo n.º 3
0
        public void DoHarvest(ZombieAvatar pm, object targeted)
        {
            IEntity targetedEntity = targeted as IEntity;

            if (XmlScript.HasTrigger(targetedEntity, TriggerName.onTargeted) && UberScriptTriggers.Trigger(targetedEntity, pm, TriggerName.onTargeted, this))
            {
                return;
            }

            CustomRegion customRegion = pm.Region as CustomRegion;

            if (customRegion != null && customRegion.Controller != null)
            {
                SkillName skill = SkillName.Spellweaving; // placeholder
                if (HarvestSystem is Mining)
                {
                    skill = SkillName.Mining;
                }

                if (customRegion.Controller.IsRestrictedSkill((int)skill))
                {
                    pm.SendMessage("You cannot use that skill here.");
                    return;
                }
            }

            //conquest skill check
            Skill tskill = null;

            if (HarvestSystem is Mining)
            {
                tskill = pm.Skills[SkillName.Mining];
            }

            HarvestSystem.StartHarvesting(pm, this, targeted);
        }