/// <summary> /// Gives this player a certain amount of a particular type of item /// </summary> /// <param name="itemSource"></param> /// <param name="amount"></param> public void GiveItemsOfType(ItemSource itemSource, int amount) { for (var i = 0; i < amount; i++) { var newItem = Item.Create(this, itemSource); Items.Add(newItem); } }
private bool HasRoomForNewItem(Item item) { // bots have inlimited inventory sizes if (this.BotId != AIStatics.ActivePlayerBotId) { return(true); } var carriedItemCount = this.GetCarriedItemCount(); var maxInventorySize = this.GetMaxInventorySize(); var hasRoom = carriedItemCount < maxInventorySize; var petAlreadyEquipped = item.ItemSource.ItemType == PvPStatics.ItemType_Pet && this.Items.Count(i => i.ItemSource.ItemType == PvPStatics.ItemType_Pet) >= 1; return(hasRoom && !petAlreadyEquipped); }
public LogBox TurnIntoItem(Player attacker, FormSource formSource, ItemSource itemSource, bool dropItems, bool activePlayer) { var logbox = new LogBox(); this.FormSource = formSource; this.Mobility = formSource.MobilityType; var newItem = Item.CreateFromPlayer(this, itemSource, attacker, activePlayer); this.Item = newItem; if (dropItems) { this.DropAllItems(); } if (attacker == null) { newItem.SetLocation(this.Location); } else { if (attacker.Id != this.Id && attacker.HasRoomForNewItem(newItem)) { attacker.GiveItem(newItem); newItem.ChangeOwner(attacker); } else { newItem.SetLocation(this.Location); } } logbox.AttackerLog = $"<br><b>You fully transformed {this.GetFullName()} into a {itemSource.FriendlyName}</b>!"; logbox.VictimLog = $"<br><b>You have been fully transformed into a {itemSource.FriendlyName}!</b>!"; logbox.LocationLog = $"<br><b>{this.GetFullName()} was completely transformed into a {itemSource.FriendlyName}</b> here."; return(logbox); }
public void SetItem(Item item) { this.Item = item; }
public void GiveItem(Item item) { item.SetLocation(String.Empty); Items.Add(item); }