Exemplo n.º 1
0
        public override void OnNPCAtStockpile(ref NPCBase.NPCState state)
        {
            if (_weapon != null)
            {
                return;
            }

            if (_playerState.CallToArmsEnabled && Items.ItemFactory.WeaponGuardSettings.Count != 0)
            {
                _weapon = GetWeapon(usedNPC);

                if (_weapon == null)
                {
                    foreach (var w in Items.ItemFactory.WeaponGuardSettings)
                    {
                        if (_stock.Contains(w.recruitmentItem))
                        {
                            _stock.TryRemove(w.recruitmentItem);
                            usedNPC.Inventory.Add(w.recruitmentItem);
                            _weapon = w;
                            break;
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
 public static GuardBaseJob.GuardSettings GetGuardSettings()
 {
     if (guardsettings == null)
     {
         GuardBaseJob.GuardSettings set = new GuardBaseJob.GuardSettings();
         set.cooldownMissingItem     = 1.5f;
         set.cooldownSearchingTarget = 0.5f;
         set.cooldownShot            = 3f;
         set.range           = 12;
         set.recruitmentItem = new InventoryItem(BuiltinBlocks.Sling);
         set.shootItem       = new List <InventoryItem>()
         {
             new InventoryItem(BuiltinBlocks.SlingBullet)
         };
         set.shootDamage       = 25f;
         set.sleepSafetyPeriod = 1f;
         set.typeXN            = ItemTypes.IndexLookup.GetIndex("Ulfric.ColonyAddOns.Blocks.MilitiaJobx-");
         set.typeXP            = ItemTypes.IndexLookup.GetIndex("Ulfric.ColonyAddOns.Blocks.MilitiaJobx+");
         set.typeZN            = ItemTypes.IndexLookup.GetIndex("Ulfric.ColonyAddOns.Blocks.MilitiaJobz-");
         set.typeZP            = ItemTypes.IndexLookup.GetIndex("Ulfric.ColonyAddOns.Blocks.MilitiaJobz+");
         set.OnShootAudio      = "sling";
         set.OnHitAudio        = "fleshHit";
         guardsettings         = set;
     }
     return(guardsettings);
 }
Exemplo n.º 3
0
        public static GuardBaseJob.GuardSettings GetWeapon(NPC.NPCBase npc)
        {
            GuardBaseJob.GuardSettings weapon = null;
            var inv = SettlerInventory.GetSettlerInventory(npc);

            foreach (var w in Items.ItemFactory.WeaponGuardSettings)
            {
                if (npc.Inventory.Contains(w.recruitmentItem) || inv.Weapon.Id == w.recruitmentItem.Type)
                {
                    weapon = w;
                    break;
                }
            }

            return(weapon);
        }