예제 #1
0
 public void RemoveBattleSceneBuffForRole(KarenBattleScene scene, GameClient client)
 {
     lock (this.RuntimeData.Mutex)
     {
         if (scene.SceneBuffDict.Count != 0)
         {
             List <KarenBattleSceneBuff> sceneBuffDeleteList = new List <KarenBattleSceneBuff>();
             foreach (KarenBattleSceneBuff contextData in scene.SceneBuffDict.Values)
             {
                 if (contextData.RoleID == client.ClientData.RoleID)
                 {
                     sceneBuffDeleteList.Add(contextData);
                 }
             }
             if (sceneBuffDeleteList.Count != 0)
             {
                 foreach (KarenBattleSceneBuff contextData in sceneBuffDeleteList)
                 {
                     if (contextData.RoleID != 0)
                     {
                         this.UpdateBuff4GameClient(client, contextData.BuffID, contextData.tagInfo, false);
                     }
                     KarenBattleQiZhiConfig_East CrystalItem = contextData.tagInfo as KarenBattleQiZhiConfig_East;
                     if (null != CrystalItem)
                     {
                         this.AddDelayCreateMonster(scene, TimeUtil.NOW() + (long)(CrystalItem.RefreshCD * 1000), contextData.tagInfo);
                     }
                 }
             }
         }
     }
 }
예제 #2
0
 public void CheckCreateDynamicMonster(KarenBattleScene scene, long nowMs)
 {
     lock (this.RuntimeData.Mutex)
     {
         while (scene.CreateMonsterQueue.Count > 0)
         {
             KeyValuePair <long, List <object> > pair = scene.CreateMonsterQueue.First <KeyValuePair <long, List <object> > >();
             if (nowMs < pair.Key)
             {
                 break;
             }
             try
             {
                 foreach (object obj in pair.Value)
                 {
                     if (obj is KarenBattleQiZhiConfig_East)
                     {
                         KarenBattleQiZhiConfig_East item = obj as KarenBattleQiZhiConfig_East;
                         GameManager.MonsterZoneMgr.AddDynamicMonsters(scene.m_nMapCode, item.MonsterID, scene.CopyMapId, 1, item.PosX / scene.MapGridWidth, item.PosY / scene.MapGridHeight, 0, 0, SceneUIClasses.KarenEast, item, null);
                     }
                 }
             }
             finally
             {
                 scene.CreateMonsterQueue.RemoveAt(0);
             }
         }
     }
 }
예제 #3
0
        public int GetCaiJiMonsterTime(GameClient client, Monster monster)
        {
            KarenBattleQiZhiConfig_East tag = (monster != null) ? (monster.Tag as KarenBattleQiZhiConfig_East) : null;
            int result;

            if (tag == null)
            {
                result = -200;
            }
            else
            {
                result = tag.CollectTime;
            }
            return(result);
        }
예제 #4
0
        public void SubmitCrystalBuff(GameClient client, int areaLuaID)
        {
            KarenBattleQiZhiConfig_East crystalItem = client.SceneContextData as KarenBattleQiZhiConfig_East;

            if (null != crystalItem)
            {
                lock (this.RuntimeData.Mutex)
                {
                    KarenBattleScene scene;
                    if (this.SceneDict.TryGetValue(client.ClientData.FuBenSeqID, out scene))
                    {
                        KarenCenterConfig center = null;
                        if (scene.KarenCenterConfigDict.TryGetValue(areaLuaID, out center))
                        {
                            if (center.BattleWhichSide == client.ClientData.BattleWhichSide)
                            {
                                KarenBattleClientContextData contextData = client.SceneContextData2 as KarenBattleClientContextData;
                                if (contextData != null && scene.m_eStatus == GameSceneStatuses.STATUS_BEGIN)
                                {
                                    int addScore = crystalItem.HandInNum;
                                    scene.ScoreData[client.ClientData.BattleWhichSide - 1].Score += addScore;
                                    scene.ScoreData[client.ClientData.BattleWhichSide - 1].ticks  = TimeUtil.NOW();
                                    if (addScore > 0)
                                    {
                                        this.NotifyTimeStateInfoAndScoreInfo(client, false, true);
                                    }
                                }
                                SystemXmlItem systemNPC = null;
                                if (GameManager.SystemNPCsMgr.SystemXmlItemDict.TryGetValue(center.NPCID, out systemNPC))
                                {
                                    string param  = client.ClientData.JunTuanName;
                                    string param2 = systemNPC.GetStringValue("SName");
                                    KarenBattleManager.getInstance().NtfKarenNotifyMsg(scene, KarenNotifyMsgType.Submit, client.ClientData.JunTuanId, param, param2);
                                }
                                this.UpdateBuff4GameClient(client, crystalItem.BuffGoodsID, crystalItem, false);
                                this.AddDelayCreateMonster(scene, TimeUtil.NOW() + (long)(crystalItem.RefreshCD * 1000), crystalItem);
                            }
                        }
                    }
                }
            }
        }
예제 #5
0
        private void CheckSceneBufferTime(KarenBattleScene karenBattleScene, long nowTicks)
        {
            List <KarenBattleSceneBuff> sceneBuffDeleteList = new List <KarenBattleSceneBuff>();

            lock (this.RuntimeData.Mutex)
            {
                if (karenBattleScene.m_eStatus == GameSceneStatuses.STATUS_BEGIN)
                {
                    if (karenBattleScene.SceneBuffDict.Count != 0)
                    {
                        foreach (KarenBattleSceneBuff contextData in karenBattleScene.SceneBuffDict.Values)
                        {
                            if (contextData.EndTicks < nowTicks)
                            {
                                sceneBuffDeleteList.Add(contextData);
                            }
                        }
                        if (sceneBuffDeleteList.Count != 0)
                        {
                            foreach (KarenBattleSceneBuff contextData in sceneBuffDeleteList)
                            {
                                if (contextData.RoleID != 0)
                                {
                                    GameClient client = GameManager.ClientMgr.FindClient(contextData.RoleID);
                                    if (null != client)
                                    {
                                        this.UpdateBuff4GameClient(client, contextData.BuffID, contextData.tagInfo, false);
                                    }
                                }
                                KarenBattleQiZhiConfig_East CrystalItem = contextData.tagInfo as KarenBattleQiZhiConfig_East;
                                if (null != CrystalItem)
                                {
                                    this.AddDelayCreateMonster(karenBattleScene, TimeUtil.NOW() + (long)(CrystalItem.RefreshCD * 1000), contextData.tagInfo);
                                }
                            }
                        }
                    }
                }
            }
        }
예제 #6
0
 public void OnCaiJiFinish(GameClient client, Monster monster)
 {
     lock (this.RuntimeData.Mutex)
     {
         KarenBattleScene scene;
         if (this.SceneDict.TryGetValue(client.ClientData.FuBenSeqID, out scene))
         {
             if (scene.m_eStatus == GameSceneStatuses.STATUS_BEGIN)
             {
                 KarenBattleQiZhiConfig_East monsterItem = monster.Tag as KarenBattleQiZhiConfig_East;
                 if (monsterItem != null)
                 {
                     KarenBattleQiZhiConfig_East crystalItem = client.SceneContextData as KarenBattleQiZhiConfig_East;
                     if (null != crystalItem)
                     {
                         this.AddDelayCreateMonster(scene, TimeUtil.NOW() + (long)(crystalItem.RefreshCD * 1000), crystalItem);
                     }
                     this.UpdateBuff4GameClient(client, monsterItem.BuffGoodsID, monsterItem, true);
                 }
             }
         }
     }
 }
예제 #7
0
 private void UpdateBuff4GameClient(GameClient client, int bufferGoodsID, object tagInfo, bool add)
 {
     try
     {
         KarenBattleQiZhiConfig_East CrystalItem = tagInfo as KarenBattleQiZhiConfig_East;
         if (null != CrystalItem)
         {
             int             BuffTime     = 0;
             BufferItemTypes buffItemType = BufferItemTypes.None;
             if (null != CrystalItem)
             {
                 BuffTime     = CrystalItem.HoldTme;
                 buffItemType = BufferItemTypes.KarenEastCrystal;
             }
             KarenBattleScene scene;
             if (this.SceneDict.TryGetValue(client.ClientData.FuBenSeqID, out scene))
             {
                 EquipPropItem item = GameManager.EquipPropsMgr.FindEquipPropItem(bufferGoodsID);
                 if (null != item)
                 {
                     if (add)
                     {
                         double[] actionParams = new double[]
                         {
                             (double)BuffTime,
                             (double)bufferGoodsID
                         };
                         Global.UpdateBufferData(client, buffItemType, actionParams, 1, true);
                         client.ClientData.PropsCacheManager.SetExtProps(new object[]
                         {
                             PropsSystemTypes.BufferByGoodsProps,
                             bufferGoodsID,
                             item.ExtProps
                         });
                         string Key = this.BuildSceneBuffKey(client, bufferGoodsID);
                         scene.SceneBuffDict[Key] = new KarenBattleSceneBuff
                         {
                             RoleID   = client.ClientData.RoleID,
                             BuffID   = bufferGoodsID,
                             EndTicks = TimeUtil.NOW() + (long)(BuffTime * 1000),
                             tagInfo  = tagInfo
                         };
                         if (buffItemType == BufferItemTypes.KarenEastCrystal)
                         {
                             client.SceneContextData = tagInfo;
                         }
                     }
                     else
                     {
                         double[] array        = new double[2];
                         double[] actionParams = array;
                         Global.UpdateBufferData(client, buffItemType, actionParams, 1, true);
                         client.ClientData.PropsCacheManager.SetExtProps(new object[]
                         {
                             PropsSystemTypes.BufferByGoodsProps,
                             bufferGoodsID,
                             PropsCacheManager.ConstExtProps
                         });
                         Global.RemoveBufferData(client, (int)buffItemType);
                         string Key = this.BuildSceneBuffKey(client, bufferGoodsID);
                         scene.SceneBuffDict.Remove(Key);
                         if (buffItemType == BufferItemTypes.KarenEastCrystal)
                         {
                             client.SceneContextData = null;
                         }
                     }
                     GameManager.ClientMgr.NotifyUpdateEquipProps(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteException(ex.ToString());
     }
 }
예제 #8
0
        public bool InitConfig()
        {
            bool   success  = true;
            string fileName = "";

            lock (this.RuntimeData.Mutex)
            {
                try
                {
                    this.RuntimeData.MapBirthPointDict.Clear();
                    fileName = "Config/LegionsEastBirthPoint.xml";
                    string   fullPathFileName = Global.GameResPath(fileName);
                    XElement xml = XElement.Load(fullPathFileName);
                    IEnumerable <XElement> nodes = xml.Elements();
                    foreach (XElement node in nodes)
                    {
                        KarenBattleBirthPoint item = new KarenBattleBirthPoint();
                        item.ID          = (int)Global.GetSafeAttributeLong(node, "ID");
                        item.PosX        = (int)Global.GetSafeAttributeLong(node, "PosX");
                        item.PosY        = (int)Global.GetSafeAttributeLong(node, "PosY");
                        item.BirthRadius = (int)Global.GetSafeAttributeLong(node, "BirthRadius");
                        this.RuntimeData.MapBirthPointDict[item.ID] = item;
                    }
                    this.RuntimeData.KarenCenterConfigDict.Clear();
                    fileName         = "Config/LegionsEast.xml";
                    fullPathFileName = Global.GameResPath(fileName);
                    xml   = XElement.Load(fullPathFileName);
                    nodes = xml.Elements();
                    foreach (XElement node in nodes)
                    {
                        KarenCenterConfig item2 = new KarenCenterConfig();
                        item2.ID    = (int)Global.GetSafeAttributeLong(node, "ID");
                        item2.NPCID = (int)Global.GetSafeAttributeLong(node, "NPCID");
                        string   SiteString = Global.GetSafeAttributeStr(node, "NPCSite");
                        string[] SiteFields = SiteString.Split(new char[]
                        {
                            '|'
                        });
                        if (3 == SiteFields.Length)
                        {
                            item2.PosX   = Global.SafeConvertToInt32(SiteFields[0]);
                            item2.PosY   = Global.SafeConvertToInt32(SiteFields[1]);
                            item2.Radius = Global.SafeConvertToInt32(SiteFields[2]);
                        }
                        item2.ProduceTime = (int)Global.GetSafeAttributeLong(node, "ProduceTime");
                        item2.ProduceNum  = (int)Global.GetSafeAttributeLong(node, "ProduceNum");
                        item2.OccupyTime  = (int)Global.GetSafeAttributeLong(node, "OccupyTime");
                        this.RuntimeData.KarenCenterConfigDict[item2.ID] = item2;
                    }
                    this.RuntimeData.NPCID2QiZhiConfigDict.Clear();
                    fileName         = "Config/LegionsEastFlag.xml";
                    fullPathFileName = Global.GameResPath(fileName);
                    xml   = XElement.Load(fullPathFileName);
                    nodes = xml.Elements();
                    foreach (XElement node in nodes)
                    {
                        KarenBattleQiZhiConfig_East item3 = new KarenBattleQiZhiConfig_East();
                        item3.ID        = (int)Global.GetSafeAttributeLong(node, "ID");
                        item3.MonsterID = (int)Global.GetSafeAttributeLong(node, "MonsterID");
                        string   SiteString = Global.GetSafeAttributeStr(node, "Site");
                        string[] SiteFields = SiteString.Split(new char[]
                        {
                            '|'
                        });
                        if (2 == SiteFields.Length)
                        {
                            item3.PosX = Global.SafeConvertToInt32(SiteFields[0]);
                            item3.PosY = Global.SafeConvertToInt32(SiteFields[1]);
                        }
                        item3.BeginTime   = (int)Global.GetSafeAttributeLong(node, "BeginTime");
                        item3.RefreshCD   = (int)Global.GetSafeAttributeLong(node, "RefreshCD");
                        item3.CollectTime = (int)Global.GetSafeAttributeLong(node, "CollectTime");
                        item3.HandInNum   = (int)Global.GetSafeAttributeLong(node, "HandInNum");
                        item3.HoldTme     = (int)Global.GetSafeAttributeLong(node, "HoldTme");
                        item3.BuffGoodsID = (int)Global.GetSafeAttributeLong(node, "Icon");
                        this.RuntimeData.NPCID2QiZhiConfigDict[item3.MonsterID] = item3;
                    }
                }
                catch (Exception ex)
                {
                    success = false;
                    LogManager.WriteLog(LogTypes.Fatal, string.Format("加载xml配置文件:{0}, 失败。", fileName), ex, true);
                }
            }
            return(success);
        }