private void GenerateContractItemObject(string template, string contractId, int count, ConcurrentDictionary <string, ServerInventoryItem> newObjects) { if (string.IsNullOrEmpty(template)) { return; } ContractItemObject obj = new ContractItemObject(template, contractId); newObjects.TryAdd(obj.Id, new ServerInventoryItem(obj, count)); }
public int TestAddContractItems() { var ids = player.resource.contractItems.ids; foreach (var id in ids) { ContractItemObject itemObject = new ContractItemObject(id, "ct007"); player.Inventory.Add(itemObject, 1); } player.EventOnInventoryUpdated(); return((int)RPCErrorCode.Ok); }
public override void OnAccepted() { base.OnAccepted(); var player = contractOwner.GetComponent <MmoActor>(); if (player != null) { if (player.Inventory.HasFreeSpace()) { ContractItemObject itemObject = new ContractItemObject(itemId, id); if (player.Inventory.Add(itemObject, 1)) { player.EventOnInventoryUpdated(); player.GetComponent <MmoMessageComponent>().ReceiveItemsAdded(InventoryType.ship); } } } }
public bool HasContractItems(string contractId) { if (Items.ContainsKey(InventoryObjectType.contract_item)) { foreach (var pit in Items[InventoryObjectType.contract_item]) { ContractItemObject obj = pit.Value.Object as ContractItemObject; if (obj != null) { if (obj.contractId == contractId) { return(true); } } } } return(false); }