Пример #1
0
    public static PacketWriter UpdateBannerUrl(Player player, UGC ugc)
    {
        PacketWriter pWriter = PacketWriter.Of(SendOp.Guild);

        pWriter.Write(GuildPacketMode.UpdateBannerUrl);
        pWriter.WriteLong(player.CharacterId);
        pWriter.WriteUnicodeString(player.Name);
        pWriter.WriteInt(ugc.GuildPosterId);
        pWriter.WriteUnicodeString(ugc.Url);
        return(pWriter);
    }
Пример #2
0
    public static PacketWriter CreateUGC(UGC ugc)
    {
        PacketWriter pWriter = PacketWriter.Of(SendOp.UGC);

        pWriter.Write(UGCMode.CreateUgc);
        pWriter.Write(ugc.Type);
        pWriter.WriteLong(ugc.Uid);
        pWriter.WriteUnicodeString(ugc.Guid.ToString());

        return(pWriter);
    }
Пример #3
0
    public static PacketWriter SetUGCUrl(UGC ugc)
    {
        PacketWriter pWriter = PacketWriter.Of(SendOp.UGC);

        pWriter.Write(UGCMode.SetUGCUrl);
        pWriter.Write(ugc.Type);
        pWriter.WriteLong(ugc.Uid);
        pWriter.WriteUnicodeString(ugc.Url);

        return(pWriter);
    }
Пример #4
0
    public BannerSlot(long id, long dateInUnixSeconds, long bannerId, bool active, UGC ugc)
    {
        Id           = id;
        ActivateTime = DateTimeOffset.FromUnixTimeSeconds(dateInUnixSeconds);

        Date = int.Parse(ActivateTime.ToString("yyyyMMdd"));
        Hour = ActivateTime.Hour;

        BannerId = bannerId;
        Active   = active;
        UGC      = ugc;
    }
Пример #5
0
 // Make a copy of item
 public Item(Item other)
 {
     Id                     = other.Id;
     Name                   = other.Name;
     Level                  = other.Level;
     Gender                 = other.Gender;
     InventoryTab           = other.InventoryTab;
     ItemSlot               = other.ItemSlot;
     GemSlot                = other.GemSlot;
     Rarity                 = other.Rarity;
     StackLimit             = other.StackLimit;
     EnableBreak            = other.EnableBreak;
     IsTwoHand              = other.IsTwoHand;
     IsDress                = other.IsDress;
     IsTemplate             = other.IsTemplate;
     IsCustomScore          = other.IsCustomScore;
     PlayCount              = other.PlayCount;
     FileName               = other.FileName;
     Function               = other.Function;
     Uid                    = other.Uid;
     Slot                   = other.Slot;
     Amount                 = other.Amount;
     CreationTime           = other.CreationTime;
     ExpiryTime             = other.ExpiryTime;
     TimesAttributesChanged = other.TimesAttributesChanged;
     IsLocked               = other.IsLocked;
     UnlockTime             = other.UnlockTime;
     RemainingGlamorForges  = other.RemainingGlamorForges;
     GachaDismantleId       = other.GachaDismantleId;
     Enchants               = other.Enchants;
     EnchantExp             = other.EnchantExp;
     RepackageCount         = other.RepackageCount;
     Charges                = other.Charges;
     TransferFlag           = other.TransferFlag;
     RemainingTrades        = other.RemainingTrades;
     PairedCharacterId      = other.PairedCharacterId;
     PairedCharacterName    = other.PairedCharacterName;
     PetSkinBadgeId         = other.PetSkinBadgeId;
     RecommendJobs          = other.RecommendJobs;
     OwnerCharacterId       = other.OwnerCharacterId;
     OwnerCharacterName     = other.OwnerCharacterName;
     InventoryId            = other.InventoryId;
     BankInventoryId        = other.BankInventoryId;
     BlackMarketCategory    = other.BlackMarketCategory;
     Category               = other.Category;
     HomeId                 = other.HomeId;
     Color                  = other.Color;
     HairData               = other.HairData;
     HatData                = other.HatData;
     Score                  = new();
     Stats                  = new(other.Stats);
     UGC                    = other.UGC;
 }
Пример #6
0
        public static void Shutdown()
        {
            if (!steamInitialized)
            {
                return;
            }

            UGC.Dispose();

            Debug.Log("Shutting down the Steam API.");
            NativeMethods.ShutdownSteam();
        }
Пример #7
0
 public void Update(UGC ugc)
 {
     QueryFactory.Query(TableName).Where("uid", ugc.Uid).Update(new
     {
         name           = ugc.Name,
         url            = ugc.Url,
         character_id   = ugc.CharacterId,
         character_name = ugc.CharacterName,
         account_id     = ugc.AccountId,
         creation_time  = ugc.CreationTime
     });
 }
Пример #8
0
 // Writes UGC template data
 private static void WriteTemplate(this PacketWriter pWriter, UGC ugc)
 {
     pWriter.WriteClass(ugc);
     pWriter.WriteLong();
     pWriter.WriteInt();
     pWriter.WriteInt();
     pWriter.WriteInt();
     pWriter.WriteLong();
     pWriter.WriteInt();
     pWriter.WriteLong();
     pWriter.WriteLong();
     pWriter.WriteUnicodeString();
 }
Пример #9
0
 public static void WriteUgcTemplate(this PacketWriter pWriter, UGC ugc)
 {
     pWriter.WriteLong(ugc?.Uid ?? 0);
     pWriter.WriteUnicodeString(ugc?.Guid.ToString() ?? ""); // UUID (filename)
     pWriter.WriteUnicodeString(ugc?.Name ?? "");            // Name (itemname)
     pWriter.WriteByte(1);
     pWriter.WriteInt(1);
     pWriter.WriteLong(ugc?.AccountId ?? 0);               // AccountId
     pWriter.WriteLong(ugc?.CharacterId ?? 0);             // CharacterId
     pWriter.WriteUnicodeString(ugc?.CharacterName ?? ""); // CharacterName
     pWriter.WriteLong(ugc?.CreationTime ?? 0);            // CreationTime
     pWriter.WriteUnicodeString(ugc?.Url ?? "");           // URL (no domain)
     pWriter.WriteByte();
 }
Пример #10
0
    private static void HandleUpload(GameSession session, PacketReader packet)
    {
        packet.ReadLong();
        UGCType type = (UGCType)packet.ReadByte();

        packet.ReadByte();
        packet.ReadByte();
        packet.ReadInt();
        long accountId   = packet.ReadLong();
        long characterId = packet.ReadLong();

        packet.ReadLong();
        packet.ReadInt();
        packet.ReadShort();
        packet.ReadShort();

        UGC newUGC = null;

        switch (type)
        {
        case UGCType.Furniture or UGCType.Item or UGCType.Mount:
            newUGC = HandleCreateUGCItem(packet, session, characterId, accountId, type);
            break;

        case UGCType.GuildEmblem:
            newUGC = new($"{session.Player.Guild.Name} Emblem", characterId, session.Player.Name, accountId, 0, type);
            break;

        case UGCType.GuildBanner:
            packet.ReadLong();     // guild id
            int bannerId = packet.ReadInt();
            newUGC = new($"{session.Player.Guild.Name} Banner", characterId, session.Player.Name, accountId, 0, type, bannerId);
            break;

        case UGCType.Banner:
            newUGC = HandleCreateUGCBanner(session, packet);
            break;

        default:
            Logger.Warning("Unknown UGC type {0}", type);
            break;
        }

        if (newUGC is null)
        {
            return;
        }

        session.Send(UGCPacket.CreateUGC(newUGC));
    }
Пример #11
0
    // Writes UGC template data
    private static PacketWriter WriteTemplate(this PacketWriter pWriter, UGC ugc)
    {
        pWriter.WriteUgcTemplate(ugc);
        pWriter.WriteLong();
        pWriter.WriteInt();
        pWriter.WriteInt();
        pWriter.WriteInt();
        pWriter.WriteLong();
        pWriter.WriteInt();
        pWriter.WriteLong();
        pWriter.WriteLong();
        pWriter.WriteUnicodeString();

        return(pWriter);
    }
Пример #12
0
 public void Update(UGC ugc)
 {
     QueryFactory.Query(TableName).Where("uid", ugc.Uid).Update(new
     {
         guid           = ugc.Guid,
         name           = ugc.Name,
         url            = ugc.Url,
         character_id   = ugc.CharacterId,
         character_name = ugc.CharacterName,
         account_id     = ugc.AccountId,
         sale_price     = ugc.SalePrice,
         type           = ugc.Type,
         creation_time  = ugc.CreationTime
     });
 }
Пример #13
0
 public long Insert(UGC ugc)
 {
     return(QueryFactory.Query(TableName).InsertGetId <long>(new
     {
         uid = ugc.Uid,
         guid = ugc.Guid.ToString(),
         name = ugc.Name,
         url = ugc.Url,
         character_id = ugc.CharacterId,
         character_name = ugc.CharacterName,
         account_id = ugc.AccountId,
         creation_time = ugc.CreationTime,
         sale_price = ugc.SalePrice,
     }));
 }
Пример #14
0
    public static PacketWriter SetItemUrl(UGC ugc)
    {
        PacketWriter pWriter = PacketWriter.Of(SendOp.UGC);

        pWriter.Write(UgcMode.SetItemURL);
        pWriter.WriteBool(ugc is not null);
        if (ugc is null)
        {
            return(pWriter);
        }

        pWriter.WriteLong(ugc.Uid);
        pWriter.WriteUnicodeString(ugc.Url);

        return(pWriter);
    }
Пример #15
0
    public static PacketWriter CreateUGC(bool success, UGC ugc)
    {
        PacketWriter pWriter = PacketWriter.Of(SendOp.UGC);

        pWriter.Write(UgcMode.CreateUGC);
        pWriter.WriteBool(success);
        if (!success)
        {
            return(pWriter);
        }

        pWriter.WriteLong(ugc.Uid);
        pWriter.WriteUnicodeString(ugc.Guid.ToString());

        return(pWriter);
    }
        public static UGC_SelectorView SV_Update(UGC currentUgc, string modPath)
        {
            UGC_SelectorView usv = new UGC_SelectorView(currentUgc, modPath);

            var bi = new BitmapImage();

            bi.BeginInit();

            bi.UriSource         = new Uri(currentUgc.Preview);
            bi.DecodePixelHeight = 180;
            bi.CacheOption       = BitmapCacheOption.OnLoad;

            bi.EndInit();

            usv.iconImage.Source = bi;

            return(usv);
        }
        private void Startup()
        {
            if (NativeHelpers.Services_GetSteamLoadStatus() == LoadStatus.NotLoaded)
            {
                // Only startup the native parts if they are not loaded yet
                if (!NativeMethods.Services_Startup(Constants.VersionInfo.InterfaceID))
                {
                    // Setup failed!
                    Instance = null;
                    ErrorCodes error = NativeHelpers.Services_GetErrorCode();
                    if (error == ErrorCodes.InvalidInterfaceVersion)
                    {
                        Error.ThrowError(ErrorCodes.InvalidInterfaceVersion,
                                         NativeMethods.Services_GetInterfaceVersion(), Constants.VersionInfo.InterfaceID);
                    }
                    else
                    {
                        Error.ThrowError(error);
                    }
                }
            }

            AppID = new SteamTypes.AppID(NativeMethods.Services_GetAppID());

            serviceJobs = new JobManager();
            serviceJobs.AddJob(new DelegateJob(() => RegisterManagedCallback(), () => RemoveManagedCallback()));
            serviceJobs.AddJob(new DelegateJob(() => cloud              = new Cloud(), () => cloud.ReleaseManagedResources()));
            serviceJobs.AddJob(new DelegateJob(() => stats              = new Stats(), () => stats.ReleaseManagedResources()));
            serviceJobs.AddJob(new DelegateJob(() => user               = new User(), () => user.ReleaseManagedResources()));
            serviceJobs.AddJob(new DelegateJob(() => friends            = new Friends(), () => friends.ReleaseManagedResources()));
            serviceJobs.AddJob(new DelegateJob(() => matchmaking        = new MatchMaking(), () => matchmaking.ReleaseManagedResources()));
            serviceJobs.AddJob(new DelegateJob(() => matchmakingServers = new MatchmakingServers(), () => matchmakingServers.ReleaseManagedResources()));
            serviceJobs.AddJob(new DelegateJob(() => networking         = new Networking(), () => networking.ReleaseManagedResources()));
            serviceJobs.AddJob(new DelegateJob(() => utils              = new Utils(), () => utils.ReleaseManagedResources()));
            serviceJobs.AddJob(new DelegateJob(() => apps               = new Apps(), () => apps.ReleaseManagedResources()));
            serviceJobs.AddJob(new DelegateJob(() => http               = new HTTP(), () => http.ReleaseManagedResources()));
            serviceJobs.AddJob(new DelegateJob(() => screenshots        = new Screenshots(), () => screenshots.ReleaseManagedResources()));
            serviceJobs.AddJob(new DelegateJob(() => ugc             = new UGC(), () => ugc.ReleaseManagedResources()));
            serviceJobs.AddJob(new DelegateJob(() => steamcontroller = new SteamController(), () => steamcontroller.ReleaseManagedResources()));

            hmd = new Hmd();

            serviceJobs.RunCreateJobs();
        }
        private UGC_SelectorView(UGC ugc, string modPath)
        {
            InitializeComponent();

            this.modPath = modPath;
            this.fileID  = ugc.FileID;

            allowNullImagePath = true;
            allowNullName      = true;

            visibilityComboBox.SelectedIndex = ugc.Visibility;

            string keepAsBeen = LocalizationManager.Current.Interface["UGC_AsUploaded"];

            MahApps.Metro.Controls.TextBoxHelper.SetWatermark(nameTextBox, keepAsBeen);
            MahApps.Metro.Controls.TextBoxHelper.SetWatermark(descTextBox, keepAsBeen);

            CommonCtor();
        }
Пример #19
0
    private static void HandleConfirmationPacket(GameSession session, PacketReader packet)
    {
        UGCType type = (UGCType)packet.ReadByte();

        packet.ReadByte();
        packet.ReadByte();
        packet.ReadInt();
        long accountId   = packet.ReadLong();
        long characterId = packet.ReadLong();

        packet.ReadInt();
        long   ugcUid  = packet.ReadLong();
        string ugcGuid = packet.ReadUnicodeString();

        Player player = session.Player;

        if (accountId != player.Account.Id || characterId != player.CharacterId || ugcUid == 0)
        {
            return;
        }

        UGC ugc = DatabaseManager.UGC.FindByUid(ugcUid);

        if (ugc is null || ugc.Guid != Guid.Parse(ugcGuid))
        {
            return;
        }

        session.Send(UGCPacket.SetUGCUrl(ugc));

        switch (type)
        {
        case UGCType.Furniture or UGCType.Item or UGCType.Mount:
            Item item = DatabaseManager.Items.FindByUgcUid(ugcUid);
            if (item is null)
            {
                return;
            }

            item.SetMetadataValues();

            player.Inventory.AddItem(session, item, true);
            switch (item.Ugc.Type)
            {
            case UGCType.Furniture:
                session.Send(UGCPacket.UpdateUGCFurnishing(player.FieldPlayer, item));
                break;

            case UGCType.Item:
                session.Send(UGCPacket.UpdateUGCItem(player.FieldPlayer, item));
                break;

            case UGCType.Mount:
                session.Send(UGCPacket.UpdateUGCMount(player.FieldPlayer, item));
                break;
            }

            break;

        case UGCType.GuildEmblem:
        {
            Guild guild = GameServer.GuildManager.GetGuildById(player.Guild.Id);

            guild.Emblem = ugc.Url;
            DatabaseManager.Guilds.UpdateEmblem(guild.Id, ugc.Url);

            guild.BroadcastPacketGuild(GuildPacket.ChangeEmblemUrl(ugc.Url));
            guild.BroadcastPacketGuild(GuildPacket.GuildNoticeEmblemChange(player.Name, ugc.Url));
            break;
        }

        case UGCType.GuildBanner:
        {
            Guild guild = GameServer.GuildManager.GetGuildById(player.Guild.Id);

            UGC oldUGCBanner = guild.Banners.FirstOrDefault(x => x.GuildPosterId == ugc.GuildPosterId);
            if (oldUGCBanner is not null)
            {
                guild.Banners.Remove(oldUGCBanner);
                DatabaseManager.UGC.Delete(oldUGCBanner.Uid);
            }

            guild.Banners.Add(ugc);
            DatabaseManager.Guilds.UpdateBanners(guild.Id, guild.Banners);

            guild.BroadcastPacketGuild(GuildPacket.UpdateBannerUrl(player, ugc));
            break;
        }

        case UGCType.Banner:
            UGCBanner ugcBanner = GameServer.UGCBannerManager.UpdateBannerSlots(ugc);
            if (ugcBanner is null)
            {
                return;
            }

            session.Send(UGCPacket.UpdateUGCBanner(ugcBanner));
            // TrophyManager.OnReserveBanner();
            break;
        }
    }