Пример #1
0
        public StructureItemDetails GetStructureDetails(ulong objectID, ulong?ownerID)
        {
            GetStructureItemDetailsRequest req = null;

            if (ownerID.HasValue)
            {
                req = GetStructureItemDetailsRequest.CreateBuilder()
                      .SetObjectId(objectID)
                      .SetOwnerObjectId(ownerID.Value)
                      .Build();
            }
            else
            {
                req = GetStructureItemDetailsRequest.CreateBuilder()
                      .SetObjectId(objectID)
                      .Build();
            }


            RcfProtoChannel channel = (RcfProtoChannel)RPCServiceStub.Channel;

            RPCServiceStub.GetStructureItemDetails(null, req, null);

            GetStructureItemDetailsResponse res = (GetStructureItemDetailsResponse)channel.GetResponse();

            if (res != null)
            {
                var structDetails = res.StructuresList.FirstOrDefault();
                if (structDetails != null)
                {
                    return(StructureTransform.TransformStructureDetails(structDetails));
                }
            }
            return(null);
        }
Пример #2
0
        protected List <CharacterDetailsResponse> MakeRPCRequest(GetCharacterDetailsRequest req)
        {
            RcfProtoChannel channel = (RcfProtoChannel)RPCServiceStub.Channel;

            RPCServiceStub.GetCharacterDetails(null, req, null);

            GetCharacterDetailsResponse res = (GetCharacterDetailsResponse)channel.GetResponse();

            if (res == null)
            {
                return(null);
            }

            List <CharacterDetailsResponse> characters = new List <CharacterDetailsResponse>();

            foreach (var character in res.CharacterDetailsList)
            {
                var charDetails = new CharacterDetailsResponse()
                {
                    account_id    = character.AccountId,
                    bank_credits  = character.BankCredits,
                    base_action   = character.BaseAction,
                    base_health   = character.BaseHealth,
                    base_mind     = character.BaseMind,
                    cash_credits  = character.CashCredits,
                    character_oid = character.ObjectId,
                    firstname     = character.FirstName,
                    surname       = character.SurName,
                };

                if (character.InventoryItemsList.Count > 0)
                {
                    charDetails.Inventory = character.InventoryItemsList
                                            .ToList()
                                            .ConvertAll <object>(cur => InventoryTransform.TransformInventoryItem(cur))
                                            .ToList();
                }

                if (character.StructuresList.Count > 0)
                {
                    charDetails.Structures = character.StructuresList.ToList()
                                             .ConvertAll <StructureItem>(cur => StructureTransform.TransformStructure(cur)).ToList();
                }

                if (character.HasBiography)
                {
                    charDetails.biography = character.Biography;
                }

                if (character.HasTitle)
                {
                    charDetails.title = character.Title;
                }

                if (character.HasRemainingPlots)
                {
                    charDetails.remaining_lots = character.RemainingPlots;
                }

                if (character.HasMaximumimPlots)
                {
                    charDetails.max_lots = character.MaximumimPlots;
                }

                if (character.HasAppearanceFile)
                {
                    charDetails.appearance_file = character.AppearanceFile;
                }

                characters.Add(charDetails);
            }
            return(characters);
        }