Esempio n. 1
0
        public static int TransferItem(string itemName, string className, string transferToVault)
        {
            string itemHash  = GetItemHash(itemName);
            string itemId    = null;
            string classType = null;

            switch (className)
            {
            case "Titan":
                classType = TITAN;
                break;

            case "Hunter":
                classType = HUNTER;
                break;

            case "Warlock":
                classType = WARLOCK;
                break;

            default:
                break;
            }

            if (transferToVault == "true")
            {
                itemId = GetItemId(itemHash, classType);
            }
            else if (transferToVault == "false")
            {
                itemId = GetItemId(itemHash);
            }

            if (itemHash != null && itemId != null)
            {
                var content = new Dictionary <string, string>
                {
                    { "itemReferenceHash", itemHash },
                    { "stackSize", "1" },
                    { "transferToVault", transferToVault },
                    { "itemId", itemId },
                    { "characterId", characters[classType] },
                    { "membershipType", membershipType }
                };
                var response = Oauth.AccessResourcePost("/Destiny2/Actions/Items/TransferItem/", content);
                if ((int)response["ErrorCode"] == 1)
                {
                    return(ErrorCodes.TRANSFERSUCCESS);
                }
            }

            return(ErrorCodes.TRANSFERFAIL);
        }
Esempio n. 2
0
        public static int EquipItem(string itemName, string classType)
        {
            string itemId = GetItemId(GetItemHash(itemName), classType);

            if (itemId != null)
            {
                var content = new Dictionary <string, string>
                {
                    { "itemId", itemId },
                    { "characterId", characters[classType] },
                    { "membershipType", membershipType }
                };

                var response = Oauth.AccessResourcePost("/Destiny2/Actions/Items/EquipItem/", content);
                if ((int)response["ErrorCode"] == 1)
                {
                    return(ErrorCodes.EQUIPSUCCESS);
                }
            }

            return(ErrorCodes.EQUIPFAIL);
        }