public void Deserialize(IoBuffer input, ISerializationContext context)
        {
            var length = input.GetInt32();

            Outfits = new VMGLOutfit[length];
            for (var i = 0; i < length; i++)
            {
                Outfits[i] = new VMGLOutfit();
                Outfits[i].Deserialize(input, context);
            }
        }
Example #2
0
        private void PutOnNow(VMGLOutfit outfit, VMEODClient client)
        {
            var slot = GetSuitSlot(false);

            client.vm.SendCommand(new VMNetSetOutfitCmd
            {
                UID    = client.Avatar.PersistID,
                Scope  = slot,
                Outfit = outfit.asset_id
            });
            client.SendOBJEvent(new VMEODEvent((short)VMEODRackEvent.PutOnNow, (short)RackType));
        }
        public void StockOutfit(VM vm, VMGLOutfit outfit, VMAsyncStockOutfitCallback callback)
        {
            Host.InBackground(() =>
            {
                if (outfit.owner_id == 0)
                {
                    callback(false, 0);
                    return;
                }

                using (var db = DAFactory.Get)
                {
                    try
                    {
                        var model = new Database.DA.Outfits.DbOutfit
                        {
                            asset_id       = outfit.asset_id,
                            purchase_price = outfit.purchase_price,
                            sale_price     = outfit.sale_price,
                            outfit_type    = outfit.outfit_type,
                            outfit_source  = outfit.outfit_source == VMGLOutfitSource.cas ? Database.DA.Outfits.DbOutfitSource.cas : Database.DA.Outfits.DbOutfitSource.rack
                        };

                        if (outfit.owner_type == VMGLOutfitOwner.AVATAR)
                        {
                            model.avatar_owner = outfit.owner_id;
                        }
                        else if (outfit.owner_type == VMGLOutfitOwner.OBJECT)
                        {
                            model.object_owner = outfit.owner_id;
                        }

                        var result = db.Outfits.Create(model);
                        callback(result != 0, result);
                    }
                    catch (Exception ex)
                    {
                        callback(false, 0);
                    }
                }
            });
        }
        public void GetOutfits(VM vm, VMGLOutfitOwner owner, uint ownerPID, VMAsyncGetOutfitsCallback callback)
        {
            Host.InBackground(() =>
            {
                using (var db = DAFactory.Get)
                {
                    var outfits = owner == VMGLOutfitOwner.OBJECT ? db.Outfits.GetByObjectId(ownerPID) : db.Outfits.GetByAvatarId(ownerPID);
                    callback(
                        outfits.Select(x =>
                    {
                        var outfit = new VMGLOutfit()
                        {
                            asset_id       = x.asset_id,
                            outfit_id      = x.outfit_id,
                            sale_price     = x.sale_price,
                            purchase_price = x.purchase_price,
                            outfit_type    = x.outfit_type,
                            outfit_source  = x.outfit_source == Database.DA.Outfits.DbOutfitSource.cas ? VMGLOutfitSource.cas : VMGLOutfitSource.rack
                        };

                        if (x.avatar_owner != null && x.avatar_owner.HasValue)
                        {
                            outfit.owner_type = VMGLOutfitOwner.AVATAR;
                            outfit.owner_id   = x.avatar_owner.Value;
                        }
                        else if (x.object_owner != null && x.object_owner.HasValue)
                        {
                            outfit.owner_type = VMGLOutfitOwner.OBJECT;
                            outfit.owner_id   = x.object_owner.Value;
                        }

                        return(outfit);
                    }).ToArray()
                        );
                }
            });
        }
Example #5
0
 public void StockOutfit(VM vm, VMGLOutfit outfit, VMAsyncStockOutfitCallback callback)
 {
     //todo: local stub?
 }