public PyDataType CharGetInfo(CallInformation call) { int callerCharacterID = call.Client.EnsureCharacterIsSelected(); Character character = this.ItemManager.LoadItem(callerCharacterID) as Character; if (character == null) { throw new CustomError($"Cannot get information for character {callerCharacterID}"); } PyItemInfo itemInfo = new PyItemInfo(); itemInfo.AddRow( character.ID, character.GetEntityRow(), character.GetEffects(), character.Attributes, DateTime.UtcNow.ToFileTime() ); foreach (KeyValuePair <int, ItemEntity> pair in character.Items) { switch (pair.Value.Flag) { case ItemFlags.Booster: case ItemFlags.Implant: case ItemFlags.Skill: case ItemFlags.SkillInTraining: itemInfo.AddRow( pair.Value.ID, pair.Value.GetEntityRow(), pair.Value.GetEffects(), pair.Value.Attributes, DateTime.UtcNow.ToFileTime() ); break; } } return(itemInfo); }
public PyDataType ShipGetInfo(CallInformation call) { int callerCharacterID = call.Client.EnsureCharacterIsSelected(); if (call.Client.ShipID == null) { throw new CustomError($"The character is not aboard any ship"); } Ship ship = this.ItemManager.LoadItem((int)call.Client.ShipID) as Ship; if (ship == null) { throw new CustomError($"Cannot get information for ship {call.Client.ShipID}"); } if (ship.OwnerID != callerCharacterID) { throw new CustomError("The ship you're trying to get info off does not belong to you"); } PyItemInfo itemInfo = new PyItemInfo(); // TODO: find all the items inside this ship that are not characters itemInfo.AddRow( ship.ID, ship.GetEntityRow(), ship.GetEffects(), ship.Attributes, DateTime.UtcNow.ToFileTime() ); foreach (KeyValuePair <int, ItemEntity> pair in ship.Items) { switch (pair.Value.Flag) { case ItemFlags.HiSlot0: case ItemFlags.HiSlot1: case ItemFlags.HiSlot2: case ItemFlags.HiSlot3: case ItemFlags.HiSlot4: case ItemFlags.HiSlot5: case ItemFlags.HiSlot6: case ItemFlags.HiSlot7: case ItemFlags.MedSlot0: case ItemFlags.MedSlot1: case ItemFlags.MedSlot2: case ItemFlags.MedSlot3: case ItemFlags.MedSlot4: case ItemFlags.MedSlot5: case ItemFlags.MedSlot6: case ItemFlags.MedSlot7: case ItemFlags.LoSlot0: case ItemFlags.LoSlot1: case ItemFlags.LoSlot2: case ItemFlags.LoSlot3: case ItemFlags.LoSlot4: case ItemFlags.LoSlot5: case ItemFlags.LoSlot6: case ItemFlags.LoSlot7: case ItemFlags.FixedSlot: case ItemFlags.RigSlot0: case ItemFlags.RigSlot1: case ItemFlags.RigSlot2: case ItemFlags.RigSlot3: case ItemFlags.RigSlot4: case ItemFlags.RigSlot5: case ItemFlags.RigSlot6: case ItemFlags.RigSlot7: itemInfo.AddRow( pair.Value.ID, pair.Value.GetEntityRow(), pair.Value.GetEffects(), pair.Value.Attributes, DateTime.UtcNow.ToFileTime() ); break; } } return(itemInfo); }