public PyDataType CharGetInfo(CallInformation call) { int callerCharacterID = call.Client.EnsureCharacterIsSelected(); Character character = this.ItemFactory.GetItem <Character>(callerCharacterID); if (character is null) { throw new CustomError($"Cannot get information for character {callerCharacterID}"); } ItemInfo itemInfo = new ItemInfo(); itemInfo.AddRow( character.ID, character.GetEntityRow(), character.GetEffects(), character.Attributes, DateTime.UtcNow.ToFileTime() ); foreach ((int _, ItemEntity item) in character.Items) { switch (item.Flag) { case Flags.Booster: case Flags.Implant: case Flags.Skill: case Flags.SkillInTraining: itemInfo.AddRow( item.ID, item.GetEntityRow(), item.GetEffects(), item.Attributes, DateTime.UtcNow.ToFileTime() ); break; } } return(itemInfo); }
public PyDataType ShipGetInfo(CallInformation call) { int callerCharacterID = call.Client.EnsureCharacterIsSelected(); int?shipID = call.Client.ShipID; if (shipID is null) { throw new CustomError($"The character is not aboard any ship"); } // TODO: RE-EVALUATE WHERE THE SHIP LOADING IS PERFORMED, SHIPGETINFO DOESN'T LOOK LIKE A GOOD PLACE TO DO IT Ship ship = this.ItemFactory.LoadItem <Ship>((int)shipID); if (ship is 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"); } ItemInfo itemInfo = new ItemInfo(); // 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 ((int _, ItemEntity item) in ship.Items) { switch (item.Flag) { case Flags.HiSlot0: case Flags.HiSlot1: case Flags.HiSlot2: case Flags.HiSlot3: case Flags.HiSlot4: case Flags.HiSlot5: case Flags.HiSlot6: case Flags.HiSlot7: case Flags.MedSlot0: case Flags.MedSlot1: case Flags.MedSlot2: case Flags.MedSlot3: case Flags.MedSlot4: case Flags.MedSlot5: case Flags.MedSlot6: case Flags.MedSlot7: case Flags.LoSlot0: case Flags.LoSlot1: case Flags.LoSlot2: case Flags.LoSlot3: case Flags.LoSlot4: case Flags.LoSlot5: case Flags.LoSlot6: case Flags.LoSlot7: case Flags.FixedSlot: case Flags.RigSlot0: case Flags.RigSlot1: case Flags.RigSlot2: case Flags.RigSlot3: case Flags.RigSlot4: case Flags.RigSlot5: case Flags.RigSlot6: case Flags.RigSlot7: itemInfo.AddRow( item.ID, item.GetEntityRow(), item.GetEffects(), item.Attributes, DateTime.UtcNow.ToFileTime() ); break; } } return(itemInfo); }