コード例 #1
0
        /// <summary>
        /// 处理探索信息封包
        /// </summary>
        /// <param name="pack">封包数据结构体</param>
        /// <returns>处理结果标志</returns>
        private static int ProcessPlayerSearchInfo(PacketInfo pack)
        {
            JObject json = pack.data;

            DataUtil.Game.CalcPlayerGamePoint(GameInfo.PlayerPointType.AP, json["stamina"], json["staminaTime"]);
            DataUtil.Game.CalcPlayerGamePoint(GameInfo.PlayerPointType.BP, json["battlePoint"], json["battlePointTime"]);
            DataUtil.Game.CalcPlayerGamePoint(GameInfo.PlayerPointType.SP, json["searchQuestPoint"], json["searchQuestPointTime"]);
            JArray items = (JArray)json["masterSearchQuestList"];
            int    gold = 0, ap = 0, gp = 0;

            foreach (JObject item in items)
            {
                switch (item["searchQuestGivingItemId"].ToString())
                {
                case "1":     //金币
                    DataUtil.Game.player.money += int.Parse(item["value"].ToString());
                    gold += int.Parse(item["value"].ToString());
                    break;

                case "1002":     //体力
                    ap += int.Parse(item["value"].ToString());
                    break;

                case "3":     //种子
                    gp += int.Parse(item["value"].ToString());
                    break;
                }
            }
            UpdateTimeLeft();
            string log = string.Format("探索完成,获得体力{0:D},金币{1:D},种子{2:D}", ap, gold, gp);

            MiscHelper.AddLog(log, MiscHelper.LogType.Search);
            return(E_SUCCESS);
        }
コード例 #2
0
        /// <summary>
        /// 处理礼品箱物品取出全部物品信息封包
        /// </summary>
        /// <param name="pack">封包数据结构体</param>
        /// <returns>处理结果标志</returns>
        private static int ProcessPresentReceivedAll(PacketInfo pack)
        {
            JObject json = pack.data;

            DataUtil.Game.player.money += json["givingGameMoney"] != null?int.Parse(json["givingGameMoney"].ToString()) : 0;

            DataUtil.Game.player.stone += json["givingChargeMoney"] != null?int.Parse(json["givingChargeMoney"].ToString()) : 0;

            string log = "取出礼品箱内物品,获得";

            log += json["givingGameMoney"] != null && json["givingGameMoney"].ToString() != "0" ? "金币" + json["givingGameMoney"].ToString() + "," : "";
            log += json["givingChargeMoney"] != null && json["givingChargeMoney"].ToString() != "0" ? "华灵石" + json["givingChargeMoney"].ToString() + "," : "";
            log += json["givingGachaPoint"] != null && json["givingGachaPoint"].ToString() != "0" ? "种子" + json["givingGachaPoint"].ToString() + "," : "";
            log += json["givingRaidBossGachaPoint"] != null && json["givingRaidBossGachaPoint"].ToString() != "0" ? "初级装备种子" + json["givingRaidBossGachaPoint"].ToString() + "," : "";
            log += (json["givingUserCharacterList"] as JArray).Count > 0 ? "角色" + (json["givingUserCharacterList"] as JArray).Count.ToString() + "," : "";
            log += (json["givingUserCharacterEquipmentList"] as JArray).Count > 0 ? "装备" + (json["givingUserCharacterEquipmentList"] as JArray).Count.ToString() + "," : "";
            log += (json["givingUserGiftList"] as JArray).Count > 0 ? "赠物" + (json["givingUserGiftList"] as JArray).Count.ToString() + "," : "";
            JArray items = (JArray)json["givingUserPointItemList"];

            foreach (JObject item in items)
            {
                log += MiscHelper.ProcessUserPointItem(item);
            }
            log += (json["givingUserEventItemList"] as JArray).Count > 0 ? "活动物品" + (json["givingUserEventItemList"] as JArray).Count.ToString() + "," : "";
            log += (json["givingUserGachaTicketList"] as JArray).Count > 0 ? "扭蛋券" + (json["givingUserGachaTicketList"] as JArray).Count.ToString() + "," : "";
            log += (json["givingUserGardenMakeoverItemList"] as JArray).Count > 0 ? "庭院物品" + (json["givingUserGardenMakeoverItemList"] as JArray).Count.ToString() + "," : "";
            MiscHelper.AddLog(log.Substring(0, log.Length - 1), MiscHelper.LogType.Mailbox);
            return(E_SUCCESS);
        }
コード例 #3
0
        /// <summary>
        /// 处理游戏登录信息封包
        /// </summary>
        /// <param name="pack">封包数据结构体</param>
        /// <returns>处理结果标志</returns>
        private static int ProcessPlayerLoginInfo(PacketInfo pack)
        {
            JObject json = pack.data;

            if (json["user"] == null)
            {
                return(E_FAILED);
            }
            DataUtil.Game.isOnline  = true;
            DataUtil.Game.player.lv = json["user"]["levelId"].ToString() != null?int.Parse(json["user"]["levelId"].ToString()) : 1;

            DataUtil.Game.player.friendId = json["user"]["searchUserId"] != null ? json["user"]["searchUserId"].ToString() : "-";
            DataUtil.Game.CalcPlayerMaxAPExp();
            DataUtil.Game.player.maxBP = GameInfo.PLAYER_MAX_BP;
            DataUtil.Game.player.maxSP = GameInfo.PLAYER_MAX_SP;
            DataUtil.Game.CalcPlayerGamePoint(GameInfo.PlayerPointType.AP, json["user"]["stamina"], json["user"]["staminaTime"]);
            DataUtil.Game.CalcPlayerGamePoint(GameInfo.PlayerPointType.BP, json["user"]["battlePoint"], json["user"]["battlePointTime"]);
            DataUtil.Game.CalcPlayerGamePoint(GameInfo.PlayerPointType.SP, json["userSearchQuest"]["searchQuestPoint"], json["userSearchQuest"]["searchQuestPointTime"]);
            DataUtil.Game.player.money = json["user"]["gameMoney"] != null?int.Parse(json["user"]["gameMoney"].ToString()) : 0;

            DataUtil.Game.player.stone = json["user"]["chargeMoney"] != null?int.Parse(json["user"]["chargeMoney"].ToString()) : 0;

            DataUtil.Game.player.exp = json["user"]["levelExperience"] != null?int.Parse(json["user"]["levelExperience"].ToString()) : 0;

            DataUtil.Game.notifyRecord.lastAP = DataUtil.Game.player.AP;
            DataUtil.Game.notifyRecord.lastBP = DataUtil.Game.player.BP;
            DataUtil.Game.notifyRecord.lastSP = DataUtil.Game.player.SP;
            UpdateTimeLeft();
            MiscHelper.AddLog("已经成功登录游戏", MiscHelper.LogType.System);
            return(E_SUCCESS);
        }
コード例 #4
0
        /// <summary>
        /// 处理主页BOSS战结果封包
        /// </summary>
        /// <param name="pack">封包数据结构体</param>
        /// <returns>处理结果标志</returns>
        private static int ProcessRaidBossFinish(PacketInfo pack)
        {
            JObject json = pack.data;

            DataUtil.Game.CalcPlayerGamePoint(GameInfo.PlayerPointType.BP, json["battlePoint"], json["battlePointTime"]);
            UpdateTimeLeft();
            MiscHelper.AddLog("首页BOSS战完成,剩余战点:" + DataUtil.Game.player.BP.ToString(), MiscHelper.LogType.Boss);
            return(E_SUCCESS);
        }
コード例 #5
0
        /// <summary>
        /// 处理进副本封包
        /// </summary>
        /// <param name="pack">封包数据结构体</param>
        /// <returns>处理结果标志</returns>
        private static int ProcessDungeonStageStart(PacketInfo pack)
        {
            JObject json = pack.data;

            DataUtil.Game.CalcPlayerGamePoint(GameInfo.PlayerPointType.AP, json["stamina"], json["staminaTime"]);
            string dungeonType = "普通";

            switch (pack.funcApi)
            {
            case "/dungeon/saveEventStageStart":
                dungeonType = "活动";
                break;

            case "/dungeon/saveEncounterStageStart":
                dungeonType = "隐藏";
                break;

            case "/dungeon/saveWhaleStageStart":
                dungeonType = "鲸鱼";
                break;
            }
            if (json["bossList"] != null && json["bossList"].ToString() != "")
            {
                DataUtil.Game.bossList = new ObservableCollection <GameInfo.BossInfo>();
                try
                {
                    JArray bossList = (JArray)json["bossList"];
                    foreach (JObject boss in bossList)
                    {
                        GameInfo.BossInfo bossInfo = new GameInfo.BossInfo();
                        bossInfo.group = int.Parse(boss["bossGroupId"].ToString());
                        bossInfo.name  = boss["name"].ToString();
                        bossInfo.hp    = int.Parse(boss["hitPoint"].ToString());
                        bossInfo.atk   = int.Parse(boss["attack"].ToString());
                        bossInfo.def   = int.Parse(boss["defense"].ToString());
                        bossInfo.skill = boss["bossSkillName"].ToString();
                        bossInfo.money = int.Parse(boss["dropGameMoney"].ToString());
                        bossInfo.gp    = int.Parse(boss["dropGachaPoint"].ToString());
                        DataUtil.Game.bossList.Add(bossInfo);
                    }
                }
                catch { }
            }
            UpdateTimeLeft();
            MiscHelper.AddLog("成功进入" + dungeonType + "副本,剩余体力:" + DataUtil.Game.player.AP.ToString(), MiscHelper.LogType.Stage);
            DataUtil.Game.canAuto = true;
            MiscHelper.ShowMapInfoButton();
            if (DataUtil.Config.sysConfig.autoGoInMaps)
            {
                mainWindow.btnAuto_Click(mainWindow, new System.Windows.RoutedEventArgs());
            }
            return(E_SUCCESS);
        }
コード例 #6
0
        /// <summary>
        /// 处理副本放弃封包
        /// </summary>
        /// <param name="pack">封包数据结构体</param>
        /// <returns>处理结果标志</returns>
        private static int ProcessDungeonStageFailed(PacketInfo pack)
        {
            JObject json = pack.data;

            DataUtil.Game.player.money += json["givingGameMoney"] != null?int.Parse(json["givingGameMoney"].ToString()) : 0;

            DataUtil.Game.player.stone += json["givingChargeMoney"] != null?int.Parse(json["givingChargeMoney"].ToString()) : 0;

            DataUtil.Game.IncreasePlayerExp(json["givingExperience"]);
            string dungeonType = "普通";

            switch (pack.funcApi)
            {
            case "/dungeon/saveEventStageFailed":
                dungeonType = "活动";
                break;

            case "/dungeon/saveEncounterStageFailed":
                dungeonType = "隐藏";
                break;

            case "/dungeon/saveWhaleStageFailed":
                dungeonType = "鲸鱼";
                break;
            }
            string log = "你已退出" + dungeonType + "副本,获得";

            log += json["givingGameMoney"] != null && json["givingGameMoney"].ToString() != "0" ? "金币" + json["givingGameMoney"].ToString() + "," : "";
            log += json["givingGachaPoint"] != null && json["givingGachaPoint"].ToString() != "0" ? "种子" + json["givingGachaPoint"].ToString() + "," : "";
            log += json["givingExperience"] != null && json["givingExperience"].ToString() != "0" ? "经验值" + json["givingExperience"].ToString() + "," : "";
            log += json["givingChargeMoney"] != null && json["givingChargeMoney"].ToString() != "0" ? "华灵石" + json["givingChargeMoney"].ToString() + "," : "";
            log += json["givingEventItemPoint"] != null && json["givingEventItemPoint"].ToString() != "0" ? "活动点数" + json["givingEventItemPoint"].ToString() + "," : "";
            log += (json["givingUserCharacterList"] as JArray).Count > 0 ? "角色" + (json["givingUserCharacterList"] as JArray).Count.ToString() + "," : "";
            log += (json["givingUserCharacterEquipmentList"] as JArray).Count > 0 ? "装备" + (json["givingUserCharacterEquipmentList"] as JArray).Count.ToString() + "," : "";
            JArray items = (JArray)json["givingUserPointItemList"];

            foreach (JObject item in items)
            {
                log += MiscHelper.ProcessUserPointItem(item);
            }
            items = (JArray)json["givingUserEventItemList"];
            foreach (JObject item in items)
            {
                log += "活动物品" + item["amount"].ToString() + ",";
            }
            MiscHelper.AddLog(log.Substring(0, log.Length - 1), MiscHelper.LogType.Stage);
            DataUtil.Game.canAuto = false;
            MiscHelper.ShowMapInfoButton(false);
            MiscHelper.SetAutoGo(false);
            UpdateTimeLeft();
            return(E_SUCCESS);
        }
コード例 #7
0
        /// <summary>
        /// 处理游戏收获花盆封包
        /// </summary>
        /// <param name="pack">封包数据结构体</param>
        /// <returns>处理结果标志</returns>
        private static int ProcessGardenPlantHarvest(PacketInfo pack)
        {
            JObject json  = pack.data;
            string  log   = "收获花盆,获得:";
            JArray  items = (JArray)json["gardenHarvestItemList"];
            int     gold  = 0;
            int     coin  = 0;
            int     ap    = 0;

            foreach (JObject item in items)
            {
                if (item["itemId"].ToString() == "1")
                {
                    gold += int.Parse(item["amount"].ToString());
                }
                if (item["itemId2"].ToString() == "274")
                {
                    coin += int.Parse(item["amount2"].ToString());
                }
                if (item["staminaRecoveryNum"] != null)
                {
                    ap += int.Parse(item["staminaRecoveryNum"].ToString());
                }
            }
            log += "金币" + gold.ToString() + ",庭院币" + coin.ToString();
            JArray plants = (JArray)json["userGardenPlantPotList"];

            foreach (JObject plant in plants)
            {
                if (plant["floweringTime"] != null)
                {
                    DateTime pTime = Convert.ToDateTime(plant["floweringTime"].ToString());
                    if (DataUtil.Game.player.plantTime < pTime)
                    {
                        DataUtil.Game.player.plantTime = pTime;
                    }
                }
            }
            if (json["staminaRevoceryNum"] != null && json["staminaRevoceryNum"].ToString() != "0")
            {
                log += ",体力" + json["staminaRevoceryNum"].ToString();
            }
            else if (ap > 0)
            {
                log += ",体力" + ap.ToString();
            }
            DataUtil.Game.CalcPlayerGamePoint(GameInfo.PlayerPointType.AP, json["stamina"], json["staminaTime"]);
            UpdateTimeLeft();
            MiscHelper.AddLog(log, MiscHelper.LogType.Search);
            return(E_SUCCESS);
        }
コード例 #8
0
        /// <summary>
        /// 处理主页BOSS战开始封包
        /// </summary>
        /// <param name="pack">封包数据结构体</param>
        /// <returns>处理结果标志</returns>
        private static int ProcessRaidBossStart(PacketInfo pack)
        {
            JObject json = pack.data;

            if (json["masterRaidBoss"].ToString() != "null")
            {
                string name = json["masterRaidBoss"]["name"].ToString();
                string hp   = json["masterRaidBoss"]["hitPoint"].ToString();
                string mhp  = json["masterRaidBoss"]["maxHitPoint"].ToString();
                string lv   = json["masterRaidBoss"]["raidBossLevelNum"].ToString();
                string atk  = json["masterRaidBoss"]["attack"].ToString();
                string def  = json["masterRaidBoss"]["defense"].ToString();
                MiscHelper.AddLog("开始首页BOSS战,BOSS:" + name + ",Lv:" + lv + ",HP:" + hp + "/" + mhp + ",攻击:" + atk + ",防御:" + def, MiscHelper.LogType.Boss);
            }
            return(E_SUCCESS);
        }
コード例 #9
0
 /// <summary>
 /// 处理召唤BOSS战开始信息封包
 /// </summary>
 /// <param name="pack">封包数据结构体</param>
 /// <returns>处理结果标志</returns>
 private static int ProcessSummonBossStart(PacketInfo pack)
 {
     if (pack.data["masterSummonBoss"] != null)
     {
         JToken json = pack.data["masterSummonBoss"];
         string name = json["name"] != null ? json["name"].ToString() : "[未知]";
         string lv   = json["level"] != null ? json["level"].ToString() : "0";
         string hp   = json["hitPoint"] != null ? json["hitPoint"].ToString() : "0";
         string mhp  = json["maxHitPoint"] != null ? json["maxHitPoint"].ToString() : "0";
         string atk  = json["attack"] != null ? json["attack"].ToString() : "0";
         string def  = json["defense"] != null ? json["defense"].ToString() : "0";
         MiscHelper.AddLog("开始召唤BOSS战,BOSS:" + name + ",Lv:" + lv + ",HP:" + hp + "/" + mhp + ",攻击:" + atk + ",防御:" + def, MiscHelper.LogType.Boss);
     }
     else
     {
         MiscHelper.AddLog("开始召唤BOSS战", MiscHelper.LogType.Boss);
     }
     return(E_SUCCESS);
 }
コード例 #10
0
        /// <summary>
        /// 处理出售角色/装备信息封包
        /// </summary>
        /// <param name="pack">封包数据结构体</param>
        /// <returns>处理结果标志</returns>
        private static int ProcessSellSave(PacketInfo pack)
        {
            JObject json = pack.data;
            string  type = "角色";

            if (pack.funcApi == "/character/saveSaleEquipment")
            {
                type = "装备";
            }
            if (json["totalGameMoney"] != null)
            {
                DataUtil.Game.player.money = int.Parse(json["totalGameMoney"].ToString());
            }
            if (json["totalGameMoney"] != null)
            {
                MiscHelper.AddLog("出售了一些" + type + ",当前金币:" + json["totalGameMoney"].ToString(), MiscHelper.LogType.Sell);
            }
            return(E_SUCCESS);
        }
コード例 #11
0
        private static int ProcessDungeonStageDestroyed(PacketInfo pack)
        {
            string dungeonType = "普通";

            switch (pack.funcApi)
            {
            case "/dungeon/saveEventStageDestroyed":
                dungeonType = "活动";
                break;

            case "/dungeon/saveEncounterStageDestroyed":
                dungeonType = "隐藏";
                break;

            case "/dungeon/saveWhaleStageDestroyed":
                dungeonType = "鲸鱼";
                break;
            }
            MiscHelper.AddLog("很遗憾," + dungeonType + "副本进击失败了!", MiscHelper.LogType.Stage);
            DataUtil.Game.canAuto = false;
            return(E_SUCCESS);
        }
コード例 #12
0
        /// <summary>
        /// 处理副本成功完成封包
        /// </summary>
        /// <param name="pack">封包数据结构体</param>
        /// <returns>处理结果标志</returns>
        private static int ProcessDungeonStageSuccess(PacketInfo pack)
        {
            JObject json = pack.data;

            DataUtil.Game.player.money += json["givingGameMoney"] != null?int.Parse(json["givingGameMoney"].ToString()) : 0;

            DataUtil.Game.player.stone += json["givingChargeMoney"] != null?int.Parse(json["givingChargeMoney"].ToString()) : 0;

            DataUtil.Game.IncreasePlayerExp(json["givingExperience"]);
            string dungeonType = "普通";

            switch (pack.funcApi)
            {
            case "/dungeon/saveEventStageSuccess":
                dungeonType = "活动";
                break;

            case "/dungeon/saveEncounterStageSuccess":
                dungeonType = "隐藏";
                break;

            case "/dungeon/saveWhaleStageSuccess":
                dungeonType = "鲸鱼";
                break;
            }
            string log = "成功通关" + dungeonType + "副本,获得";

            log += json["givingGameMoney"] != null && json["givingGameMoney"].ToString() != "0" ? "金币" + json["givingGameMoney"].ToString() + "," : "";
            log += json["givingGachaPoint"] != null && json["givingGachaPoint"].ToString() != "0" ? "种子" + json["givingGachaPoint"].ToString() + "," : "";
            log += json["givingExperience"] != null && json["givingExperience"].ToString() != "0" ? "经验值" + json["givingExperience"].ToString() + "," : "";
            log += json["givingChargeMoney"] != null && json["givingChargeMoney"].ToString() != "0" ? "华灵石" + json["givingChargeMoney"].ToString() + "," : "";
            log += json["givingEventItemPoint"] != null && json["givingEventItemPoint"].ToString() != "0" ? "活动点数" + json["givingEventItemPoint"].ToString() + "," : "";
            log += (json["givingUserCharacterList"] as JArray).Count > 0 ? "角色" + (json["givingUserCharacterList"] as JArray).Count.ToString() + "," : "";
            log += (json["givingUserCharacterEquipmentList"] as JArray).Count > 0 ? "装备" + (json["givingUserCharacterEquipmentList"] as JArray).Count.ToString() + "," : "";
            JArray items = (JArray)json["givingUserPointItemList"];

            foreach (JObject item in items)
            {
                log += MiscHelper.ProcessUserPointItem(item);
            }
            items = (JArray)json["givingUserEventItemList"];
            int itemAmount = 0;

            foreach (JObject item in items)
            {
                itemAmount += int.Parse(item["amount"].ToString());
            }
            if (itemAmount > 0)
            {
                log += "活动物品" + itemAmount.ToString() + ",";
            }
            if (json["encounterStageName"] != null && json["encounterStageName"].ToString() != "")
            {
                log += "出现隐藏副本:" + json["encounterStageName"].ToString() + "(需要体力:" + json["encounterStageUseStamina"].ToString() + "),";
                if (DataUtil.Config.sysConfig.foundStageNotify)
                {
                    MiscHelper.ShowRemind(10, DataUtil.Game.player.name + " - 隐藏副本出现通知", "出现隐藏副本:" + json["encounterStageName"].ToString()
                                          + ",需要体力:" + json["encounterStageUseStamina"].ToString(), System.Windows.Forms.ToolTipIcon.Info);
                }
            }
            if (json["masterRaidBoss"] != null && json["masterRaidBoss"].ToString() != "")
            {
                log += "出现主页BOSS:" + json["masterRaidBoss"]["name"].ToString() + "(Lv:" + json["masterRaidBoss"]["raidBossLevelNum"].ToString() + "),";
                if (DataUtil.Config.sysConfig.foundBossNotify)
                {
                    MiscHelper.ShowRemind(10, DataUtil.Game.player.name + " - 主页BOSS出现通知", "出现主页BOSS:" + json["masterRaidBoss"]["name"].ToString()
                                          + ",Lv:" + json["masterRaidBoss"]["raidBossLevelNum"].ToString(), System.Windows.Forms.ToolTipIcon.Info);
                }
            }
            MiscHelper.AddLog(log.Substring(0, log.Length - 1), MiscHelper.LogType.Stage);
            DataUtil.Game.canAuto = false;
            MiscHelper.ShowMapInfoButton(false);
            MiscHelper.SetAutoGo(false);
            UpdateTimeLeft();
            return(E_SUCCESS);
        }
コード例 #13
0
 /// <summary>
 /// 处理召唤BOSS战完成信息封包
 /// </summary>
 /// <param name="pack">封包数据结构体</param>
 /// <returns>处理结果标志</returns>
 private static int ProcessSummonBossFinish(PacketInfo pack)
 {
     MiscHelper.AddLog("召唤BOSS战完成", MiscHelper.LogType.Boss);
     return(E_SUCCESS);
 }