private void RollStartEquipment(IInventoryModule inventory, HumanPerson person) { var headDropScheme = GetHeads(); FillSlot(person, headDropScheme, HEAD_SLOT_INDEX); var armorDropScheme = GetArmors(); FillSlot(person, armorDropScheme, BODY_SLOT_INDEX); var mainWeaponDropScheme = GetMainWeapons(); FillSlot(person, mainWeaponDropScheme, MAIN_HAND_SLOT_INDEX); var offWeaponDropScheme = GetOffWeapons(); FillSlot(person, offWeaponDropScheme, OFF_HAND_SLOT_INDEX); var startPropDropScheme = GetStartProps(); var startProps = _dropResolver.Resolve(new[] { startPropDropScheme }); foreach (var prop in startProps) { AddPropToInventory(inventory, prop); } AddResource(inventory, "packed-food", 1); AddResource(inventory, "water-bottle", 1); AddResource(inventory, "med-kit", 1); AddEquipment(inventory, "pick-axe"); AddEquipment(inventory, "shovel"); AddEquipment(inventory, "shotgun"); AddResource(inventory, "bullet-45", 100); }
protected void AddEquipment(IInventoryModule inventory, string sid) { var scheme = SchemeService.GetScheme <IPropScheme>(sid); var prop = _propFactory.CreateEquipment(scheme); AddPropToInventory(inventory, prop); }
protected override void RollStartEquipment(IInventoryModule inventory, HumanPerson person) { var templates = GetPersonTemplateByFraction(person.Fraction, SchemeService); var rolledTemplate = Dice.RollFromList(templates); person.PersonEquipmentTemplate = rolledTemplate.Name; var headDropScheme = rolledTemplate.HeadEquipments; FillSlot(person, headDropScheme, HeadSlotIndex); var armorDropScheme = rolledTemplate.BodyEquipments; FillSlot(person, armorDropScheme, BodySlotIndex); var mainWeaponDropScheme = rolledTemplate.MainHandEquipments; FillSlot(person, mainWeaponDropScheme, MainHandSlotIndex); var offWeaponDropScheme = rolledTemplate.OffHandEquipments; FillSlot(person, offWeaponDropScheme, OffHandSlotIndex); var startPropDropScheme = rolledTemplate.InventoryProps; var startProps = DropResolver.Resolve(new[] { startPropDropScheme }); foreach (var prop in startProps) { AddPropToInventory(inventory, prop); } AddDefaultProps(inventory); }
protected override void RollStartEquipment(IInventoryModule inventory, HumanPerson person) { var headDropScheme = GetHeads(); FillSlot(person, headDropScheme, HeadSlotIndex); var armorDropScheme = GetArmors(); FillSlot(person, armorDropScheme, BodySlotIndex); var mainWeaponDropScheme = GetMainWeapons(); FillSlot(person, mainWeaponDropScheme, MainHandSlotIndex); var offWeaponDropScheme = GetOffWeapons(); FillSlot(person, offWeaponDropScheme, OffHandSlotIndex); var startPropDropScheme = GetStartProps(); var startProps = DropResolver.Resolve(new[] { startPropDropScheme }); foreach (var prop in startProps) { AddPropToInventory(inventory, prop); } AddDefaultProps(inventory); AddEquipment(inventory, "pick-axe"); AddEquipment(inventory, "shovel"); AddEquipment(inventory, "shotgun"); AddResource(inventory, "bullet-45", 100); }
protected void AddDefaultProps(IInventoryModule inventory) { AddResource(inventory, "packed-food", 1); AddResource(inventory, "water-bottle", 1); AddResource(inventory, "med-kit", 1); AddEquipment(inventory, "med-mask"); AddEquipment(inventory, "med-gloves"); }
private void AddResource(IInventoryModule inventory, string resourceSid, int count) { try { var resourceScheme = _schemeService.GetScheme <IPropScheme>(resourceSid); var resource = _propFactory.CreateResource(resourceScheme, count); inventory.Add(resource); } catch (KeyNotFoundException) { Debug.LogError($"Не найден объект {resourceSid}"); } }
private void AddEquipment(IInventoryModule inventory, string equipmentSid) { try { var equipmentScheme = _schemeService.GetScheme <IPropScheme>(equipmentSid); var resource = _propFactory.CreateEquipment(equipmentScheme); inventory.Add(resource); } catch (KeyNotFoundException) { Debug.LogError($"Не найден объект {equipmentSid}"); } }
protected void AddResource(IInventoryModule inventory, string resourceSid, int count) { if (inventory is null) { throw new ArgumentNullException(nameof(inventory)); } try { var resourceScheme = SchemeService.GetScheme <IPropScheme>(resourceSid); var resource = _propFactory.CreateResource(resourceScheme, count); inventory.Add(resource); } catch (KeyNotFoundException exception) { throw new CreatePersonException($"Не найден объект {resourceSid}", exception); } }
public InventoryService(IInventoryModule inventoryApi, IMemoryCache memoryCache) { _inventoryApi = inventoryApi; _memoryCache = memoryCache; }
public InventoryService(IInventoryModule inventoryApi, IStorefrontMemoryCache memoryCache, IApiChangesWatcher apiChangesWatcher) { _inventoryApi = inventoryApi; _memoryCache = memoryCache; _apiChangesWatcher = apiChangesWatcher; }
protected abstract void RollStartEquipment(IInventoryModule inventory, HumanPerson person);
protected Character(string name, params IModule[] modules) : base(modules) { _inventory = GetOrAddModule(new Inventory()); //TODO: Broken because their could be different types if inventories. Name = name; }