Ejemplo n.º 1
0
        public bool AddCopyScenes(GameClient client, CopyMap copyMap, SceneUIClasses sceneType)
        {
            bool result;

            if (copyMap.MapCode == this.RuntimeData.MapID)
            {
                int fuBenSeqId = copyMap.FuBenSeqID;
                int mapCode    = copyMap.MapCode;
                lock (this.RuntimeData.Mutex)
                {
                    WanMoXiaGuScene scene = null;
                    if (!this.SceneDict.TryGetValue(fuBenSeqId, out scene))
                    {
                        scene             = new WanMoXiaGuScene();
                        scene.CopyMapInfo = copyMap;
                        scene.CleanAllInfo();
                        scene.GameId               = Global.GetClientKuaFuServerLoginData(client).GameId;
                        scene.MapID                = mapCode;
                        scene.CopyMapID            = copyMap.CopyMapID;
                        scene.FuBenSeqId           = fuBenSeqId;
                        scene.PlayerCount          = 1;
                        scene.BossLifePercent      = 1.0;
                        this.SceneDict[fuBenSeqId] = scene;
                    }
                    else
                    {
                        scene.PlayerCount++;
                    }
                    client.ClientData.BattleWhichSide = 1;
                    client.SceneObject       = scene;
                    copyMap.IsKuaFuCopy      = true;
                    copyMap.CustomPassAwards = true;
                    copyMap.SetRemoveTicks(TimeUtil.NOW() + (long)(this.RuntimeData.TotalSecs * 1000));
                    GameManager.ClientMgr.BroadSpecialCopyMapMessage <WanMoXiaGuScoreData>(1266, scene.ScoreData, scene.CopyMapInfo);
                }
                result = true;
            }
            else
            {
                result = false;
            }
            return(result);
        }
Ejemplo n.º 2
0
        public void LeaveFuBen(GameClient client)
        {
            WanMoXiaGuScene scene = null;

            lock (this.RuntimeData.Mutex)
            {
                if (!this.SceneDict.TryGetValue(client.ClientData.FuBenSeqID, out scene))
                {
                    return;
                }
            }
            lock (this.RuntimeData.Mutex)
            {
                scene.PlayerCount--;
                if (scene.SceneStatus != GameSceneStatuses.STATUS_END && scene.SceneStatus != GameSceneStatuses.STATUS_AWARD && scene.SceneStatus != GameSceneStatuses.STATUS_CLEAR)
                {
                    KuaFuManager.getInstance().SetCannotJoinKuaFu_UseAutoEndTicks(client);
                }
            }
        }
Ejemplo n.º 3
0
        public void CreateMonster(WanMoXiaGuScene scene, object tag)
        {
            CopyMap copyMap = scene.CopyMapInfo;
            GameMap gameMap = null;

            if (GameManager.MapMgr.DictMaps.TryGetValue(scene.MapID, out gameMap))
            {
                WanMoXiaGuMonsterConfigInfo waveConfig = tag as WanMoXiaGuMonsterConfigInfo;
                if (waveConfig != null)
                {
                    for (int i = 0; i < waveConfig.MonstersNum; i++)
                    {
                        int monsterID = waveConfig.MonsterID[i];
                        int gridX     = waveConfig.Site[i * 2] / gameMap.MapGridWidth;
                        int gridY     = waveConfig.Site[i * 2 + 1] / gameMap.MapGridHeight;
                        GameManager.MonsterZoneMgr.AddDynamicMonsters(scene.MapID, monsterID, scene.CopyMapInfo.CopyMapID, 1, gridX, gridY, 0, 0, SceneUIClasses.WanMoXiaGu, waveConfig, null);
                    }
                    scene.ScoreData.MonsterCount = waveConfig.MonstersNum;
                    GameManager.ClientMgr.BroadSpecialCopyMapMessage <WanMoXiaGuScoreData>(1266, scene.ScoreData, scene.CopyMapInfo);
                }
            }
        }
Ejemplo n.º 4
0
 public void OnInjureMonster(GameClient client, Monster monster, long injure)
 {
     if (monster.VLife <= 0.0)
     {
     }
     lock (this.RuntimeData.Mutex)
     {
         WanMoXiaGuScene scene = client.SceneObject as WanMoXiaGuScene;
         if (scene != null && scene.SceneStatus == GameSceneStatuses.STATUS_BEGIN)
         {
             if (monster.GetMonsterData().ExtensionID == this.RuntimeData.BossMonsterID)
             {
                 scene.BossLifePercent = monster.VLife / monster.MonsterInfo.VLifeMax;
                 if (scene.BossLifePercent <= 0.0)
                 {
                     scene.Success     = 1;
                     scene.SceneStatus = GameSceneStatuses.STATUS_END;
                 }
                 if (scene.BossLifePercent <= 0.0 || Math.Round(scene.BossLifePercent, 2) != Math.Round(scene.ScoreData.BossLifePercent, 2))
                 {
                     scene.ScoreData.BossLifePercent = scene.BossLifePercent;
                     GameManager.ClientMgr.BroadSpecialCopyMapMessage <WanMoXiaGuScoreData>(1266, scene.ScoreData, scene.CopyMapInfo);
                 }
                 else
                 {
                     scene.ScoreData.BossLifePercent = scene.BossLifePercent;
                 }
             }
             else if (monster.VLife <= 0.0 && scene.AddKilledMonster(monster))
             {
                 scene.ScoreData.MonsterCount--;
                 scene.ScoreData.MonsterCount = ((scene.ScoreData.MonsterCount < 0) ? 0 : scene.ScoreData.MonsterCount);
                 GameManager.ClientMgr.BroadSpecialCopyMapMessage <WanMoXiaGuScoreData>(1266, scene.ScoreData, scene.CopyMapInfo);
             }
         }
     }
 }
Ejemplo n.º 5
0
 public void GiveAwards(WanMoXiaGuScene scene)
 {
     try
     {
         FuBenMapItem fuBenMapItem = FuBenManager.FindMapCodeByFuBenID(scene.CopyMapInfo.FubenMapID, scene.MapID);
         if (fuBenMapItem != null)
         {
             int usedSecs = (int)(scene.EndTime - scene.BeginTime);
             int zhanLi   = 0;
             List <GameClient> objsList = scene.CopyMapInfo.GetClientsList().Distinct <GameClient>().ToList <GameClient>();
             if (objsList != null && objsList.Count > 0)
             {
                 for (int i = 0; i < objsList.Count; i++)
                 {
                     GameClient client = objsList[i];
                     if (client != null && client == GameManager.ClientMgr.FindClient(client.ClientData.RoleID))
                     {
                         zhanLi += client.ClientData.CombatForce;
                         long nExp  = (long)fuBenMapItem.Experience;
                         int  money = fuBenMapItem.Money1;
                         int  idx   = this.RuntimeData.AwardList.Count - 1;
                         int  mul   = this.RuntimeData.AwardList[idx][1];
                         for (int j = 0; j <= idx; j++)
                         {
                             if (usedSecs <= this.RuntimeData.AwardList[j][0])
                             {
                                 mul = this.RuntimeData.AwardList[j][1];
                                 break;
                             }
                         }
                         if (nExp > 0L)
                         {
                             GameManager.ClientMgr.ProcessRoleExperience(client, nExp, false, true, false, "万魔峡谷通关奖励");
                         }
                         if (money > 0)
                         {
                             GameManager.ClientMgr.AddMoney1(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, money, "万魔峡谷通关奖励", true);
                         }
                         List <GoodsData> goodsList = new List <GoodsData>();
                         if (null != fuBenMapItem.GoodsDataList)
                         {
                             for (int k = 0; k < fuBenMapItem.GoodsDataList.Count; k++)
                             {
                                 GoodsData goodsData = new GoodsData(fuBenMapItem.GoodsDataList[k]);
                                 goodsData.GCount *= mul;
                                 goodsList.Add(goodsData);
                             }
                         }
                         if (goodsList.Count > 0)
                         {
                             if (Global.CanAddGoodsDataList(client, goodsList))
                             {
                                 foreach (GoodsData goodsData in goodsList)
                                 {
                                     GoodsUtil.AddGoodsDBCommand(client, goodsData, true, 1, "万魔峡谷通关奖励", true);
                                 }
                             }
                             else
                             {
                                 Global.UseMailGivePlayerAward2(client, goodsList, GLang.GetLang(4000, new object[0]), GLang.GetLang(4001, new object[0]), 0, 0, 0);
                             }
                         }
                         WanMoXiaGuAwardsData awardsData = new WanMoXiaGuAwardsData
                         {
                             Success     = scene.Success,
                             UsedSecs    = usedSecs,
                             Exp         = nExp,
                             Money       = money,
                             AwardsGoods = goodsList
                         };
                         client.sendCmd <WanMoXiaGuAwardsData>(1267, awardsData, false);
                         Global.UpdateFuBenDataForQuickPassTimer(client, scene.CopyMapInfo.FubenMapID, 0, 1);
                     }
                 }
             }
             if (objsList != null && objsList.Count > 0)
             {
                 int roleCount = objsList.Count;
                 zhanLi /= roleCount;
             }
         }
     }
     catch (Exception ex)
     {
         DataHelper.WriteExceptionLogEx(ex, "【万魔峡谷】清场调度异常");
     }
 }