Exemple #1
0
        public static string EncryptMD5Usk(string usk)
        {
            var decryptFunnyKey = CryptData.GetDecryptFunnyKey();
            var str             = decryptFunnyKey + usk;

            return(CryptData.EncryptMD5(str));
        }
Exemple #2
0
 public static void calc_usk(string uid, string usk_)
 {
     if (!usk.ContainsKey(uid))
     {
         usk.Add(uid, CryptData.EncryptMD5Usk(usk_));
     }
     else
     {
         usk[uid] = CryptData.EncryptMD5Usk(usk_);
     }
 }
        public static BattleInfo fgo_battlesetup(string uid, string questId, string questPhase, string deckId, string followerId, int followerClass)
        {
            var table = new Hashtable
            {
                { "activeDeckId", deckId },
                { "followerId", followerId },
                { "ac", "action" },
                { "key", "battlesetup" },
                { "deviceid", FgoMain.get_device_id() },
                { "os", FgoMain.get_os() },
                { "ptype", FgoMain.get_ptype() },
                { "usk", FgoMain.get_usk(uid) },
                { "umk", "" },
                { "rgsid", 1001 },
                { "rkchannel", FgoMain.get_rkchannel() },
                { "userId", uid },
                { "appVer", FgoMain.get_game_version() },
                { "dateVer", FgoMain.get_date_ver() },
                { "lastAccessTime", FgoMain.get_timestamp_fgo() },
                { "try", "" },
                { "developmentAuthCode", FgoMain.get_developmentAuthCode() },
                { "questId", questId },
                { "questPhase", questPhase },
                { "followerClassId", followerClass },
                { "battleMode", 1 },
                { "itemId", 0 },
                { "enemySelect", 1 },
                { "userAgent", 1 },
                { "dataVer", FgoMain.get_data_ver() }
            };
            var response = JObject.Parse(FgoMain.convert_response(NetworkAPI.CreatePostHttpResponse(FgoMain.get_main_address("ac"), table)));
            var resCode  = FgoMain.parse_rescode(response);
            var usk      = "";

            if (response["response"][0]["usk"] != null)
            {
                usk = response["response"][0]["usk"].ToString();
                FgoMain.calc_usk(uid, usk);
            }
            var bi = new BattleInfo();

            if (resCode != "00")
            {
                bi.battleResCode = resCode;
                bi.battleExtra   = response["response"][0]["fail"].ToString();
                return(bi);
            }
            bi.battleResCode = "00";
            bi.battleExtra   = "{}";
            var cache = JObject.Parse(CryptData.ResponseCacheDecrypt(response["cache"].ToString()));

            bi.battleId  = cache["replaced"]["battle"][0]["id"].ToString();
            bi.rewardExp = int.Parse(cache["replaced"]["battle"][0]["resultInfo"]["rewardExp"].ToString());
            bi.rewardQp  = int.Parse(cache["replaced"]["battle"][0]["resultInfo"]["rewardQp"].ToString());
            var drop      = new Dictionary <string, int>();
            var enemyDeck = (JArray)cache["replaced"]["battle"][0]["battleInfo"]["enemyDeck"];

            foreach (var jToken in enemyDeck)
            {
                var ed   = (JObject)jToken;
                var svts = (JArray)ed["svts"];
                foreach (var jToken1 in svts)
                {
                    var ed2       = (JObject)jToken1;
                    var dropInfos = (JArray)ed2["dropInfos"];
                    foreach (var jToken2 in dropInfos)
                    {
                        var dropJO = (JObject)jToken2;
                        var id     = dropJO["objectId"].ToString();
                        if (drop.ContainsKey(id))
                        {
                            drop[id] = int.Parse(drop[id].ToString()) + int.Parse(dropJO["num"].ToString());
                        }
                        else
                        {
                            drop.Add(id, int.Parse(dropJO["num"].ToString()));
                        }
                    }
                }
            }
            bi.dropInfo = drop;
            return(bi);
        }
Exemple #4
0
        public static string GetDecryptFunnyKey()
        {
            var str = "+eTq/PgKHhpvmMWboN+Flb3okskn3SD325tVSqPf5nCjqAtdR6BN7Q==";

            return(CryptData.FunnyKeyDecrypt(str));
        }