Beispiel #1
0
        public override string ToJson()
        {
            Serializer startedSerializer = base.GetStartedSerializer();

            startedSerializer.AddString("cmsVersion", this.replayData.CmsVersion);
            startedSerializer.AddString("battleVersion", this.replayData.BattleVersion);
            startedSerializer.AddString("battleId", this.battle.RecordID);
            startedSerializer.AddString("battleUid", this.battle.BattleUid);
            startedSerializer.AddDictionary <int>("seededTroopsDeployed", this.seededTroopsDeployed);
            startedSerializer.AddDictionary <int>("defendingUnitsKilled", this.defendingUnitsKilled);
            startedSerializer.AddDictionary <int>("attackingUnitsKilled", this.attackingUnitsKilled);
            startedSerializer.AddDictionary <int>("defenderGuildTroopsSpent", this.defenderGuildUnitsSpent);
            startedSerializer.AddDictionary <int>("attackerGuildTroopsSpent", this.attackerGuildUnitsSpent);
            startedSerializer.AddDictionary <int>("loot", this.lootEarned);
            startedSerializer.AddDictionary <int>("damagedBuildings", this.buildingHealthMap);
            if (this.buildingUids != null)
            {
                startedSerializer.AddDictionary <string>("buildingUids", this.buildingUids);
            }
            startedSerializer.AddArrayOfPrimitives <string>("unarmedTraps", this.unarmedTraps);
            startedSerializer.AddObject <BattleRecord>("replayData", this.replayData);
            startedSerializer.Add <int>("baseDamagePercent", this.battle.DamagePercent);
            startedSerializer.AddDictionary <int>("numVisitors", this.battle.NumVisitors);
            startedSerializer.Add <int>("stars", this.battle.EarnedStars);
            startedSerializer.AddBool("isUserEnded", this.battle.Canceled);
            startedSerializer.AddString("planetId", this.planetId);
            return(startedSerializer.End().ToString());
        }
Beispiel #2
0
        public override string ToJson()
        {
            Serializer serializer = Serializer.Start();

            serializer.AddString("playerId", base.PlayerId);
            serializer.AddDictionary <int>("amount", this.deployables);
            return(serializer.End().ToString());
        }
Beispiel #3
0
        public override string ToJson()
        {
            Serializer serializer = Serializer.Start();

            serializer.AddString("playerId", base.PlayerId);
            serializer.AddString("recipientId", this.RecipientId);
            serializer.AddString("requestId", this.RequestId);
            serializer.AddDictionary <int>("troopsDonated", this.Donations);
            return(serializer.End().ToString());
        }
Beispiel #4
0
        public string ToJson()
        {
            Serializer serializer = Serializer.Start();

            if (this.TroopData != null)
            {
                serializer.AddDictionary <int>("troop", this.TroopData);
            }
            if (this.TroopDataList != null)
            {
                serializer.AddArray <DeploymentRecord>("troopList", this.TroopDataList);
            }
            if (this.SpecialAttackData != null)
            {
                serializer.AddDictionary <int>("specialAttack", this.SpecialAttackData);
            }
            if (this.SpecialAttackDataList != null)
            {
                serializer.AddArray <DeploymentRecord>("specialAttackList", this.SpecialAttackDataList);
            }
            if (this.HeroData != null)
            {
                serializer.AddDictionary <int>("hero", this.HeroData);
            }
            if (this.HeroDataList != null)
            {
                serializer.AddArray <DeploymentRecord>("heroList", this.HeroDataList);
            }
            if (this.ChampionData != null)
            {
                serializer.AddDictionary <int>("champion", this.ChampionData);
            }
            if (this.ChampionDataList != null)
            {
                serializer.AddArray <DeploymentRecord>("championList", this.ChampionDataList);
            }
            return(serializer.End().ToString());
        }
Beispiel #5
0
        public override string ToJson()
        {
            Serializer serializer = Serializer.Start();

            serializer.AddString("playerId", base.PlayerId);
            serializer.AddString("receipt", this.Receipt);
            serializer.AddString("vendorKey", this.VendorKey);
            if (this.ExtraParams != null)
            {
                serializer.AddDictionary <string>("extraParams", this.ExtraParams);
            }
            serializer.End();
            return(serializer.ToString());
        }
        public override string ToJson()
        {
            Serializer serializer = Serializer.Start();

            serializer.AddString("playerId", Service.Get <CurrentPlayer>().PlayerId);
            serializer.AddDictionary <string>("sharedPrefs", new Dictionary <string, string>
            {
                {
                    this.key,
                    this.value
                }
            });
            return(serializer.End().ToString());
        }
Beispiel #7
0
        public BILogData CreateWWWDataFromBILog(BILog log)
        {
            uint serverTime = Service.ServerAPI.ServerTime;

            this.paramDict = log.GetParamDict();
            string     text       = (!this.paramDict.ContainsKey("tag")) ? "u" : WWW.UnEscapeURL(this.paramDict["tag"]);
            string     empty      = string.Empty;
            string     tier       = string.Empty;
            string     tier2      = string.Empty;
            string     tier3      = string.Empty;
            string     tier4      = string.Empty;
            string     tier5      = string.Empty;
            Serializer serializer = Serializer.Start();

            if (text != null)
            {
                if (Event2LogCreator.< > f__switch$map3 == null)
                {
                    Event2LogCreator.< > f__switch$map3 = new Dictionary <string, int>(11)
                    {
                        {
                            "authorization",
                            0
                        },
                        {
                            "clicked_link",
                            1
                        },
                        {
                            "user_info",
                            2
                        },
                        {
                            "player_info",
                            3
                        },
                        {
                            "device_info",
                            4
                        },
                        {
                            "game_action",
                            5
                        },
                        {
                            "step_timing",
                            6
                        },
                        {
                            "geo",
                            7
                        },
                        {
                            "performance",
                            8
                        },
                        {
                            "error",
                            9
                        },
                        {
                            "send_message",
                            10
                        }
                    };
                }
                int num;
                if (Event2LogCreator.< > f__switch$map3.TryGetValue(text, out num))
                {
                    string val;
                    switch (num)
                    {
                    case 0:
                        val = "action";
                        this.SetStandardDataForAction(out empty, out tier, out tier5);
                        tier2 = "authorization";
                        tier3 = this.GetValueFromLog(log, "type");
                        tier4 = this.GetValueFromLog(log, "step");
                        this.SerializeActionEventProperties(serializer, empty, tier, tier2, tier3, tier4, tier5);
                        break;

                    case 1:
                        val = "action";
                        this.SetStandardDataForAction(out empty, out tier, out tier5);
                        tier  = this.GetValueFromLog(log, "app");
                        tier2 = "clicked_link";
                        tier3 = this.GetValueFromLog(log, "is_new_user");
                        tier4 = this.GetValueFromLog(log, "log_app");
                        tier5 = this.GetValueFromLog(log, "tracking_code");
                        this.SerializeActionEventProperties(serializer, empty, tier, tier2, tier3, tier4, tier5);
                        break;

                    case 2:
                        this.LogIgnoredEvent("user_info");
                        return(null);

                    case 3:
                        this.LogIgnoredEvent("player_info");
                        return(null);

                    case 4:
                        this.LogIgnoredEvent("device_info");
                        return(null);

                    case 5:
                        val = "action";
                        this.SetStandardDataForAction(out empty, out tier, out tier5);
                        tier2 = this.GetValueFromLog(log, "context");
                        tier3 = this.GetValueFromLog(log, "action");
                        tier4 = this.GetValueFromLog(log, "message");
                        this.SerializeActionEventProperties(serializer, empty, tier, tier2, tier3, tier4, tier5);
                        break;

                    case 6:
                    {
                        val = "timing";
                        string valueFromLog = this.GetValueFromLog(log, "context");
                        serializer.AddString("c", valueFromLog);
                        string valueFromLog2 = this.GetValueFromLog(log, "location");
                        serializer.AddString("l", valueFromLog2);
                        string text2 = this.GetValueFromLog(log, "path_name");
                        if (string.IsNullOrEmpty(text2))
                        {
                            text2 = "u";
                        }
                        serializer.AddString("pn", text2);
                        string valueFromLog3 = this.GetValueFromLog(log, "elapsed_time_ms");
                        int    num2          = 0;
                        int.TryParse(valueFromLog3, out num2);
                        if (num2 < 1)
                        {
                            this.LogIgnoredEvent("step_timing Ignoring Step timing event with no elapsed time.");
                            return(null);
                        }
                        serializer.Add <int>("etms", num2);
                        serializer.Add <int>("r", 1);
                        break;
                    }

                    case 7:
                        this.LogIgnoredEvent("geo");
                        return(null);

                    case 8:
                        val = "action";
                        this.SetStandardDataForAction(out empty, out tier, out tier5);
                        tier  = this.GetValueFromLog(log, "time_since_start");
                        tier2 = "performance";
                        tier3 = this.GetValueFromLog(log, "fps");
                        tier4 = this.GetValueFromLog(log, "memory_used");
                        tier5 = this.GetValueFromLog(log, "display_state");
                        this.SerializeActionEventProperties(serializer, empty, tier, tier2, tier3, tier4, tier5);
                        break;

                    case 9:
                        val = "action";
                        this.SetStandardDataForAction(out empty, out tier, out tier5);
                        tier2 = "error";
                        tier3 = this.GetValueFromLog(log, "context");
                        tier4 = this.GetValueFromLog(log, "reason");
                        tier5 = this.GetValueFromLog(log, "message");
                        this.SerializeActionEventProperties(serializer, empty, tier, tier2, tier3, tier4, tier5);
                        break;

                    case 10:
                        val = "action";
                        this.SetStandardDataForAction(out empty, out tier, out tier5);
                        tier  = this.GetValueFromLog(log, "tracking_code");
                        tier2 = "send_message";
                        tier3 = this.GetValueFromLog(log, "send_timestamp");
                        tier4 = this.GetValueFromLog(log, "target_user_id");
                        tier5 = this.GetValueFromLog(log, "num_sent");
                        this.SerializeActionEventProperties(serializer, empty, tier, tier2, tier3, tier4, tier5);
                        break;

                    case 11:
                        goto IL_4AC;

                    default:
                        goto IL_4AC;
                    }
                    if (this.app == null)
                    {
                        this.SetupSantardizedData();
                    }
                    Serializer serializer2 = Serializer.Start();
                    serializer2.AddDictionary <string>("app", this.app);
                    serializer2.AddDictionary <string>("session", this.session);
                    serializer2.Add <string>("guest", this.guest.ToString());
                    serializer2.AddDictionary <string>("device", this.device);
                    Serializer serializer3 = Serializer.Start();
                    Serializer serializer4 = Serializer.Start();
                    serializer4.Add <string>("event_prop", serializer.End().ToString());
                    serializer4.AddString("s", "mc");
                    serializer4.AddString("of", "1");
                    serializer4.Add <uint>("lts", serverTime);
                    serializer4.Add <uint>("ts", serverTime);
                    serializer4.AddString("id", Guid.NewGuid().ToString());
                    serializer4.Add <int>("sn", this.logSequenceNumber);
                    this.logSequenceNumber++;
                    serializer4.AddString("n", val);
                    serializer3.Add <string>("event", serializer4.End().ToString());
                    string val2 = "[" + serializer3.End().ToString() + "]";
                    serializer2.Add <string>("events", val2);
                    serializer2.End();
                    byte[] bytes = Encoding.UTF8.GetBytes(serializer2.ToString());
                    string url   = (!log.UseSecondaryUrl) ? this.primaryURL : this.secondaryNoProxyURL;
                    return(new BILogData
                    {
                        url = url,
                        postData = bytes,
                        headers = this.headers
                    });
                }
            }
IL_4AC:
            this.LogIgnoredEvent(text);
            return(null);
        }
Beispiel #8
0
        public string ToJson()
        {
            Serializer serializer = Serializer.Start();

            serializer.AddObject <CombatEncounter>("combatEncounter", this.CombatEncounter);
            serializer.AddArray <IBattleAction>("battleActions", this.battleActions);
            serializer.AddObject <BattleDeploymentData>("attackerDeploymentData", this.AttackerDeploymentData);
            serializer.AddObject <BattleDeploymentData>("defenderDeploymentData", this.DefenderDeploymentData);
            serializer.Add <int>("lootCreditsAvailable", this.LootCreditsAvailable);
            serializer.Add <int>("lootMaterialsAvailable", this.LootMaterialsAvailable);
            serializer.Add <int>("lootContrabandAvailable", this.LootContrabandAvailable);
            if (this.BuildingLootCreditsMap != null)
            {
                serializer.AddDictionary <int>("lootBuildingCreditsMap", this.BuildingLootCreditsMap);
            }
            if (this.BuildingLootMaterialsMap != null)
            {
                serializer.AddDictionary <int>("lootBuildingMaterialsMap", this.BuildingLootMaterialsMap);
            }
            if (this.BuildingLootContrabandMap != null)
            {
                serializer.AddDictionary <int>("lootBuildingContrabandMap", this.BuildingLootContrabandMap);
            }
            serializer.AddString("battleType", this.BattleType.ToString());
            serializer.Add <int>("battleLength", this.BattleLength);
            serializer.Add <int>("lowFPS", (int)this.LowestFPS);
            serializer.Add <int>("lowFPSTime", (int)this.LowestFPSTime);
            serializer.AddString("battleVersion", this.BattleVersion);
            serializer.AddString("planetId", this.PlanetId);
            serializer.AddString("manifestVersion", this.CmsVersion);
            serializer.AddObject <BattleAttributes>("battleAttributes", this.BattleAttributes);
            if (this.victoryConditionsUids != null)
            {
                serializer.AddArrayOfPrimitives <string>("victoryConditions", this.victoryConditionsUids);
            }
            serializer.AddString("failureCondition", this.failureConditionUid);
            if (this.DefenderGuildTroops != null)
            {
                serializer.AddDictionary <int>("donatedTroops", this.DefenderGuildTroops);
            }
            if (this.AttackerGuildTroops != null)
            {
                serializer.AddDictionary <int>("donatedTroopsAttacker", this.AttackerGuildTroops);
            }
            if (this.DefenderChampions != null)
            {
                serializer.AddDictionary <int>("champions", this.DefenderChampions);
            }
            if (!string.IsNullOrEmpty(this.DefenseEncounterProfile))
            {
                serializer.AddString("defenseEncounterProfile", this.DefenseEncounterProfile);
            }
            if (!string.IsNullOrEmpty(this.BattleScript))
            {
                serializer.AddString("battleScript", this.BattleScript);
            }
            if (this.DisabledBuildings != null)
            {
                serializer.AddArrayOfPrimitives <string>("disabledBuildings", this.DisabledBuildings);
            }
            serializer.Add <uint>("simSeedA", this.SimSeed.SimSeedA);
            serializer.Add <uint>("simSeedB", this.SimSeed.SimSeedB);
            serializer.Add <float>("viewTimePreBattle", this.ViewTimePassedPreBattle);
            if (this.AttackerWarBuffs != null)
            {
                serializer.AddArrayOfPrimitives <string>("attackerWarBuffs", this.AttackerWarBuffs);
            }
            if (this.DefenderWarBuffs != null)
            {
                serializer.AddArrayOfPrimitives <string>("defenderWarBuffs", this.DefenderWarBuffs);
            }
            if (this.AttackerEquipment != null)
            {
                serializer.AddArrayOfPrimitives <string>("attackerEquipment", this.AttackerEquipment);
            }
            if (this.DefenderEquipment != null)
            {
                serializer.AddArrayOfPrimitives <string>("defenderEquipment", this.DefenderEquipment);
            }
            return(serializer.End().ToString());
        }
Beispiel #9
0
        public BILogData CreateWWWDataFromBILog(BILog log)
        {
            uint serverTime = Service.Get <ServerAPI>().ServerTime;

            this.paramDict = log.GetParamDict();
            string     text       = this.paramDict.ContainsKey("tag") ? WWW.UnEscapeURL(this.paramDict["tag"]) : "u";
            string     empty      = string.Empty;
            string     tier       = string.Empty;
            string     tier2      = string.Empty;
            string     tier3      = string.Empty;
            string     tier4      = string.Empty;
            string     tier5      = string.Empty;
            Serializer serializer = Serializer.Start();
            uint       num        = < PrivateImplementationDetails >.ComputeStringHash(text);
            string     val;

            if (num <= 2139057587u)
            {
                if (num <= 1264827581u)
                {
                    if (num != 168538109u)
                    {
                        if (num != 563185489u)
                        {
                            if (num == 1264827581u)
                            {
                                if (text == "network_mapping_info")
                                {
                                    val = "action";
                                    this.SetStandardDataForAction(out empty, out tier, out tier5);
                                    tier2 = "network_mapping_info";
                                    tier3 = this.GetValueFromLog(log, "secondary_user_id");
                                    tier4 = this.GetValueFromLog(log, "action");
                                    tier5 = this.GetValueFromLog(log, "secondary_network");
                                    this.SerializeActionEventProperties(serializer, empty, tier, tier2, tier3, tier4, tier5);
                                    goto IL_5BC;
                                }
                            }
                        }
                        else if (text == "error")
                        {
                            val = "action";
                            this.SetStandardDataForAction(out empty, out tier, out tier5);
                            tier2 = "error";
                            tier3 = this.GetValueFromLog(log, "context");
                            tier4 = this.GetValueFromLog(log, "reason");
                            tier5 = this.GetValueFromLog(log, "message");
                            this.SerializeActionEventProperties(serializer, empty, tier, tier2, tier3, tier4, tier5);
                            goto IL_5BC;
                        }
                    }
                    else if (text == "player_info")
                    {
                        this.LogIgnoredEvent("player_info");
                        return(null);
                    }
                }
                else if (num != 1561113986u)
                {
                    if (num != 1807269074u)
                    {
                        if (num == 2139057587u)
                        {
                            if (text == "user_info")
                            {
                                this.LogIgnoredEvent("user_info");
                                return(null);
                            }
                        }
                    }
                    else if (text == "game_action")
                    {
                        val = "action";
                        this.SetStandardDataForAction(out empty, out tier, out tier5);
                        tier2 = this.GetValueFromLog(log, "context");
                        tier3 = this.GetValueFromLog(log, "action");
                        tier4 = this.GetValueFromLog(log, "message");
                        this.SerializeActionEventProperties(serializer, empty, tier, tier2, tier3, tier4, tier5);
                        goto IL_5BC;
                    }
                }
                else if (text == "geo")
                {
                    this.LogIgnoredEvent("geo");
                    return(null);
                }
            }
            else if (num <= 2630488359u)
            {
                if (num != 2199459864u)
                {
                    if (num != 2436257726u)
                    {
                        if (num == 2630488359u)
                        {
                            if (text == "clicked_link")
                            {
                                val = "action";
                                this.SetStandardDataForAction(out empty, out tier, out tier5);
                                tier  = this.GetValueFromLog(log, "app");
                                tier2 = "clicked_link";
                                tier3 = this.GetValueFromLog(log, "is_new_user");
                                tier4 = this.GetValueFromLog(log, "log_app");
                                tier5 = this.GetValueFromLog(log, "tracking_code");
                                this.SerializeActionEventProperties(serializer, empty, tier, tier2, tier3, tier4, tier5);
                                goto IL_5BC;
                            }
                        }
                    }
                    else if (text == "authorization")
                    {
                        val = "action";
                        this.SetStandardDataForAction(out empty, out tier, out tier5);
                        tier2 = "authorization";
                        tier3 = this.GetValueFromLog(log, "type");
                        tier4 = this.GetValueFromLog(log, "step");
                        this.SerializeActionEventProperties(serializer, empty, tier, tier2, tier3, tier4, tier5);
                        goto IL_5BC;
                    }
                }
                else if (text == "device_info")
                {
                    this.LogIgnoredEvent("device_info");
                    return(null);
                }
            }
            else if (num != 2932772005u)
            {
                if (num != 3320562554u)
                {
                    if (num == 3968383111u)
                    {
                        if (text == "send_message")
                        {
                            val = "action";
                            this.SetStandardDataForAction(out empty, out tier, out tier5);
                            tier  = this.GetValueFromLog(log, "tracking_code");
                            tier2 = "send_message";
                            tier3 = this.GetValueFromLog(log, "send_timestamp");
                            tier4 = this.GetValueFromLog(log, "target_user_id");
                            tier5 = this.GetValueFromLog(log, "num_sent");
                            this.SerializeActionEventProperties(serializer, empty, tier, tier2, tier3, tier4, tier5);
                            goto IL_5BC;
                        }
                    }
                }
                else if (text == "step_timing")
                {
                    val = "timing";
                    string valueFromLog = this.GetValueFromLog(log, "context");
                    serializer.AddString("c", valueFromLog);
                    string valueFromLog2 = this.GetValueFromLog(log, "location");
                    serializer.AddString("l", valueFromLog2);
                    string text2 = this.GetValueFromLog(log, "path_name");
                    if (string.IsNullOrEmpty(text2))
                    {
                        text2 = "u";
                    }
                    serializer.AddString("pn", text2);
                    string valueFromLog3 = this.GetValueFromLog(log, "elapsed_time_ms");
                    int    num2          = 0;
                    int.TryParse(valueFromLog3, ref num2);
                    if (num2 < 1)
                    {
                        this.LogIgnoredEvent("step_timing Ignoring Step timing event with no elapsed time.");
                        return(null);
                    }
                    serializer.Add <int>("etms", num2);
                    serializer.Add <int>("r", 1);
                    goto IL_5BC;
                }
            }
            else if (text == "performance")
            {
                val = "action";
                this.SetStandardDataForAction(out empty, out tier, out tier5);
                tier  = this.GetValueFromLog(log, "time_since_start");
                tier2 = "performance";
                tier3 = this.GetValueFromLog(log, "fps");
                tier4 = this.GetValueFromLog(log, "memory_used");
                tier5 = this.GetValueFromLog(log, "display_state");
                this.SerializeActionEventProperties(serializer, empty, tier, tier2, tier3, tier4, tier5);
                goto IL_5BC;
            }
            this.LogIgnoredEvent(text);
            return(null);

IL_5BC:
            if (this.app == null)
            {
                this.SetupSantardizedData();
            }
            Serializer serializer2 = Serializer.Start();

            serializer2.AddDictionary <string>("app", this.app);
            serializer2.AddDictionary <string>("session", this.session);
            serializer2.Add <string>("guest", this.guest.ToString());
            serializer2.AddDictionary <string>("device", this.device);
            Serializer serializer3 = Serializer.Start();
            Serializer serializer4 = Serializer.Start();

            serializer4.Add <string>("event_prop", serializer.End().ToString());
            serializer4.AddString("s", "mc");
            serializer4.AddString("of", "1");
            serializer4.Add <uint>("lts", serverTime);
            serializer4.Add <uint>("ts", serverTime);
            serializer4.AddString("id", Guid.NewGuid().ToString());
            serializer4.Add <int>("sn", this.logSequenceNumber);
            this.logSequenceNumber++;
            serializer4.AddString("n", val);
            serializer3.Add <string>("event", serializer4.End().ToString());
            string val2 = "[" + serializer3.End().ToString() + "]";

            serializer2.Add <string>("events", val2);
            serializer2.End();
            byte[] bytes = Encoding.UTF8.GetBytes(serializer2.ToString());
            string url   = log.UseSecondaryUrl ? this.secondaryNoProxyURL : this.primaryURL;

            return(new BILogData
            {
                url = url,
                postData = bytes,
                headers = this.headers
            });
        }