public virtual EquippableSlot GetBestEquipSlot(ICharacterCollection equipCollection) { Assert.IsNotNull(equipCollection); var equipSlots = equipCollection.GetEquippableSlots(this); if (equipSlots.Length == 0) { DevdogLogger.LogVerbose("No equipment location found for item: #" + ID + " " + name); return(null); } EquippableSlot equipSlot = equipSlots[0]; foreach (var e in equipSlots) { if (equipCollection.equippableSlots[e.index].slot.item == null) { equipSlot = e; // Prefer an empty slot over swapping a filled one. break; } } return(equipSlot); }
public override void NotifyItemUnEquipped(ICharacterCollection equipTo, uint amountUnEquipped) { base.NotifyItemUnEquipped(equipTo, amountUnEquipped); var item = ufpsInventory.GetItem(itemType) as vp_UnitBankInstance; if (item != null) { int unitCount = item.Count; if (unitCount > 0) { // Remove from weapon clip item.DoRemoveUnits(9999); } ufpsInventory.TryRemoveItem(itemType, 0); currentClipCount = 0; if (unitCount > 0) { // Give to inventory ufpsInventory.TryGiveUnits(item.UnitType, unitCount); } return; } ufpsInventory.TryRemoveItem(itemType, 0); currentClipCount = 0; }
public override void NotifyItemUnEquipped(ICharacterCollection equipTo, uint amountUnEquipped) { base.NotifyItemUnEquipped(equipTo, amountUnEquipped); foreach (var umaEquipSlot in equipSlotsData) { var slot = GetUMASlot(umaEquipSlot.umaEquipSlot.slotName); if (slot == null && umaEquipSlot.umaSlotDataAsset == null) { Debug.LogWarning("Couldn't visually equip UMA item, no slot found with name " + umaEquipSlot.umaEquipSlot.slotName, transform); return; // No visual eqipment } if (umaEquipSlot.umaPrevReplacedSlot != null) { UMARestoreReplacedSlot(umaEquipSlot); UMAMarkAllDirty(); } else { if (slot != null) { UMARemoveOverlay(slot, umaEquipSlot.umaOverlayDataAsset.overlayName); } } } umaData.isTextureDirty = true; umaData.isAtlasDirty = true; umaData.Dirty(); }
public IActionResult AddNewCharacter(AddCharacterViewModel model) { ICharacterCollection characterCollection = _characterFactory.CharacterCollection(); characterCollection.AddCharacter(new Character(model.Name, model.SpecializationId)); return(RedirectToAction("Index", "Character")); }
public override EquippableSlot GetBestEquipSlot(ICharacterCollection equipCollection) { var result = base.GetBestEquipSlot(equipCollection); //Debug.Log(string.Format("Best equipment slot for item: {0}, {1}", name, result)); return(result); }
public override bool CanEquip(ICharacterCollection equipTo) { var result = base.CanEquip(equipTo); //Debug.Log(string.Format("Can equip item: {0}, {1}", name, result)); return(result); }
public MatchManager(ILogger <MatchManager> logger, ICharacterCollection charColl, IItemCollection itemColl, IRealtimeEventBroadcastService events, IMatchEventBroadcastService matchEvents, IRealtimeMonitor realtime, IChallengeEventBroadcastService challengeEvents, IMatchMessageBroadcastService matchMessages, IAdminMessageBroadcastService adminMessages, IChallengeManager challenges, ISecondTimer timer) { _Logger = logger ?? throw new ArgumentNullException(nameof(logger)); _CharacterColleciton = charColl ?? throw new ArgumentNullException(nameof(charColl)); _ItemCollection = itemColl ?? throw new ArgumentNullException(nameof(itemColl)); _Realtime = realtime ?? throw new ArgumentNullException(nameof(realtime)); _RealtimeEvents = events ?? throw new ArgumentNullException(nameof(events)); _MatchEvents = matchEvents ?? throw new ArgumentNullException(nameof(matchEvents)); _ChallengeEvents = challengeEvents ?? throw new ArgumentNullException(nameof(challengeEvents)); _MatchMessages = matchMessages ?? throw new ArgumentNullException(nameof(matchMessages)); _AdminMessages = adminMessages ?? throw new ArgumentNullException(nameof(adminMessages)); _Challenges = challenges ?? throw new ArgumentNullException(nameof(challenges)); _Timer = timer ?? throw new ArgumentNullException(nameof(timer)); SetSettings(new MatchSettings()); AddListeners(); }
public override void NotifyItemUnEquipped(ICharacterCollection equipTo, uint amountUnEquipped) { base.NotifyItemUnEquipped(equipTo, amountUnEquipped); RemoveAmmo(currentStackSize); ufpsEventHandler.Unregister(this); // Disable UFPS events }
public IActionResult SaveEdit(ShowAllCharactersViewModel model) { ICharacterCollection characterCollection = _characterFactory.CharacterCollection(); characterCollection.Update(new Character(model.CharacterId, model.Name, model.SpecializationId)); return(RedirectToAction("Index", "Character")); }
public void SetGroup(Character leader) { this.group = leader.GetGroup(); this.leader = leader; activePageIndex = 0; Refresh(); }
/// <summary> /// Verifies if the item can be equipped or not. /// This is validated after CanSetItem, so the item can be rejected before it gets here, if it doesn't match onlyAllowTypes. /// </summary> /// <returns>True if the item can be equipped, false if not.</returns> public virtual bool CanEquip(ICharacterCollection equipTo) { if (CanUse() == false) { return(false); } return(GetBestEquipSlot(equipTo) != null); }
public override void NotifyItemUnEquipped(ICharacterCollection equipTo, uint amountUnEquipped) { if (m_Handler != null) { m_Handler.UnequipItem(this); } base.NotifyItemUnEquipped(equipTo, amountUnEquipped); }
public EventHandler(ILogger <EventHandler> logger, ICharacterCollection charCollection, IRealtimeEventBroadcastService eventBroadcast) { _Logger = logger; _Recent = new List <JToken>(); _Characters = charCollection ?? throw new ArgumentNullException(nameof(charCollection)); _EventBroadcast = eventBroadcast ?? throw new ArgumentNullException(nameof(eventBroadcast)); }
public void SelectGroup(ICharacterCollection targetGroup) { // for now assume the player's character is the leader selectedCharacter = Character; foreach (Character member in targetGroup) { if (member != Character) { member.Mind = container.Create <AI.FellowerMind>(new object[] { member, SelectedCharacter }); } } singleMode = targetGroup.Count == 1; }
public override void NotifyItemUnEquipped(ICharacterCollection equipTo, uint amountUnEquipped) { if (isEquipped) { uConstructInventoryPlacer placer = PlayerManager.instance.currentPlayer.transform.GetComponentInParent <uConstructInventoryPlacer>(); if (placer == null) { Debug.LogError("uConstruct Inventory placer cant be found on the player!"); return; } placer.onDeEquip(); } base.NotifyItemUnEquipped(equipTo, amountUnEquipped); }
public override bool CanEquip(ICharacterCollection equipTo) { bool can = base.CanEquip(equipTo); if (can == false) { return(false); } if (Player.Instance.actor.actorClass.currLevel < requiredLevel) { InventoryManager.langDatabase.itemCannotBeUsedLevelToLow.Show(name, description, requiredLevel); return(false); } return(true); }
public override void SwapItems(ICharacterCollection collection, uint fromSlot, uint toSlot) { // Items are already swapped here... var fromItem = (EquippableInventoryItem)collection.equippableSlots[fromSlot].slot.item; var toItem = (EquippableInventoryItem)collection.equippableSlots[toSlot].slot.item; UnEquipItemVisually(toItem); // Remove from old position if (fromItem != null) { UnEquipItemVisually(fromItem); } EquipItemVisually(toItem, characterCollection.equippableSlots[toSlot]); if (fromItem != null) { EquipItemVisually(fromItem, characterCollection.equippableSlots[fromSlot]); } }
public GameStateService( IUniverseCollection universeCollection, IWorldCollection worldCollection, IAreaCollection areaCollection, ISectionCollection sectionCollection, IPlayerCollection playerCollection, ICharacterCollection characterCollection, IBattleCollection battleCollection, ILogService logService, IHubService hubService) { UniverseCollection = universeCollection; WorldCollection = worldCollection; AreaCollection = areaCollection; SectionCollection = sectionCollection; PlayerCollection = playerCollection; CharacterCollection = characterCollection; BattleCollection = battleCollection; this.logService = logService; this.hubService = hubService; }
public abstract void SwapItems(ICharacterCollection collection, uint fromSlot, uint toSlot);
public virtual void Turn() { if (IsDead) { return; } if (Player == null) { TurnNonPlayer(); return; } // npc is with boss if (IsWithBoss) { Group group = Player.Group; if (Food == 0) { IItemCollection owner; Item item = group.FindFood(out owner); if (item != null) { group.Eat(null, item.FoodValue); owner.Remove(item); } } if (Water == 0) { Item item = group.FindWater(); if (item != null) { group.Drink(null, item.WaterValue); item.Type = item.Type.Empty; } } } else // npc is stationed { ICharacterCollection group = GetGroup(); if (Location.NPCFoodProduction > 0) { Location.NPCFoodProduction--; Food++; } else if (Food == 0) { IItemCollection owner; // search for food in rooms Item item = Location.FindFood(out owner); // if not available then try the inventory if (item == null) { item = group.FindFood(out owner); } if (item != null) { group.Eat(null, item.FoodValue); owner.Remove(item); } } Location.Source.Reserve = group.Drink(null, Location.Source.Reserve); if (Water == 0) { // search for stored water in rooms Item item = Location.FindWater(); // if not available then try the inventory if (item == null) { item = group.FindWater(); } if (item != null) { group.Drink(null, item.WaterValue); item.Type = item.Type.Empty; } } } if (Food == 0) { health -= 25; } if (Water == 0) { health -= 25; } bool doctorAvailable = false; if (Player != null && location == null) { for (int i = 0; i < Player.Group.Count; i++) { doctorAvailable |= (Player.Group[i].Class == CharClass.Doctor); } } if (doctorAvailable) { if (health >= 50) { health += 4; } } else { if (health >= 70) { health += 2; } } if (health > 100) { health = 100; } if (health <= 0) { Die(); return; } Food--; if (Food < 0) { Food = 0; } Water--; if (Water < 0) { Water = 0; } //Dialog.Turn(); }
public CharacterCollectionEnumerator(ICharacterCollection collection) { this.collection = collection; Reset(); }
/// <summary> /// Called by the collection once the item is successfully un-equipped /// </summary> public virtual void NotifyItemUnEquipped(ICharacterCollection equipTo, uint amountUnEquipped) { this.equippedToCollection = null; equipTo.character.stats.ChangeAll(stats, -1f); }
protected override void OnActivateScene(object parameter) { leader = parameter as Character; group = leader.GetGroup(); BurntimeClassic classic = app as BurntimeClassic; inventory.SetGroup(leader); if (classic.InventoryBackground == -1) { Background = "hint2.pac"; } else { Background = "raum_" + classic.InventoryBackground.ToString() + ".pac"; } Size = new Vector2(320, 200); if (grid != null) { Windows -= grid; grid = null; } if (classic.InventoryRoom != null) { Music = classic.InventoryRoom.IsWaterSource ? "22_MUS 22_HSC.ogg" : "04_MUS 04_HSC.ogg"; grid = new ItemGridWindow(app); grid.LockPositions = true; grid.DoubleLayered = !classic.InventoryRoom.IsWaterSource; grid.Position = new Vector2(160, classic.InventoryRoom.IsWaterSource ? 128 : 20); grid.Spacing = new Vector2(4, 4); grid.Grid = new Vector2(4, classic.InventoryRoom.IsWaterSource ? 2 : 5); grid.Layer++; grid.LeftClickItemEvent += OnLeftClickItemRoom; grid.RightClickItemEvent += OnRightClickItemRoom; Windows += grid; grid.Add(classic.InventoryRoom.Items); // group drinks water if (classic.InventoryRoom.IsWaterSource) { int r = group.Drink(leader, classic.Game.World.ActiveLocationObj.Source.Reserve); classic.Game.World.ActiveLocationObj.Source.Reserve = r; } } else if (classic.PickItems != null) { Music = "04_MUS 04_HSC.ogg"; grid = new ItemGridWindow(app); grid.Position = new Vector2(170, 10); grid.Spacing = new Vector2(2, 2); grid.Grid = new Vector2(4, 5); grid.Layer++; grid.LeftClickItemEvent += OnLeftClickItemRoom; grid.RightClickItemEvent += OnRightClickItemRoom; Windows += grid; grid.Add(classic.PickItems); } else { Music = "04_MUS 04_HSC.ogg"; } }
public PingCommand(IServiceProvider services) { _Logger = (ILogger <PingCommand>)services.GetService(typeof(ILogger <PingCommand>)); _Characters = (ICharacterCollection)services.GetService(typeof(ICharacterCollection)); }
public override void NotifyItemUnEquipped(ICharacterCollection equipTo, uint amountUnEquipped) { base.NotifyItemUnEquipped(equipTo, amountUnEquipped); SetPlyGameValues(-1.0f); }
public void Init(ICharacterCollection col) { characterCollection = col; }