예제 #1
0
    public void AddStroyWithEventID(int id)
    {
        ChatEvent ct = FindEvetByID(id);

        if (ct.StoryName != null)
        {
            PlayerInfo.AddEvents(id);
            AddStroyName(ct);
        }
    }
예제 #2
0
    /// <summary>
    /// 用于检查是否触发事件,物品判断的条件不管使用哪个EventType都一样
    /// </summary>
    /// <param name="EventType"></param>
    /// <returns></returns>
    public bool CheckEventList(ChatEvent.EventTypeList EventType, bool ClearStoryList)
    {
        bool ishit = false;

        if (ClearStoryList)
        {
            StoryList = new ArrayList();
        }
        PlayerInfo.Info playerInfo = PlayerInfo.GetPlayerInfo();

        //筛选需要判断的事件
        ArrayList CheckList = new ArrayList();

        foreach (ChatEvent _event in ChatEventsList)
        {
            if (CompareEventType(_event.EventType, EventType))
            {
                CheckList.Add(_event);
            }
        }

        //事件判断
        foreach (ChatEvent _event in CheckList)
        {
            switch (_event.EventType)
            {
            //给物品相关的判断,统一处理
            case ChatEvent.EventTypeList.PutGoods:
            case ChatEvent.EventTypeList.SellGoods:
            case ChatEvent.EventTypeList.ComposeGoods:
            case ChatEvent.EventTypeList.CollectGoods:
            case ChatEvent.EventTypeList.ComposeProperty:
                if (_event.EventType == ChatEvent.EventTypeList.ComposeProperty)
                {
                    foreach (PlayerInfo.PropertysInfo pinfo in playerInfo.MaterialInfoList.Propertys)
                    {
                        if (pinfo.ID == _event.Parameter[0] && _event.Num <= pinfo.RecipeCount && !PlayerInfo.CheckEvents(_event.ID))
                        {
                            if (((_event.EventItem == null) || (_event.EventItem != null && CharBag.ContainsGoods(_event.EventItem[0], _event.EventItem[1]))) &&
                                (_event.NeedQuest == 0 || (_event.NeedQuest != 0 && PlayerInfo.CheckCompleteQuest(_event.NeedQuest))))
                            {
                                ishit = true;
                                PlayerInfo.AddEvents(_event.ID);
                                Debug.Log("hit event: " + _event.ID);
                                AddStroyName(_event);
                                break;
                            }
                        }
                    }
                }
                else
                {
                    if (_event.Parameter == null || _event.Parameter.Length <= 0)
                    {
                        Debug.LogWarning("事件配置表Parameter出错! eventID:" + _event.ID);
                    }
                    if (_event.Parameter[0] == 0)
                    {
                        foreach (PlayerInfo.ItemsInfo items in playerInfo.MaterialInfoList.Items)
                        {
                            if (items.ID == _event.Parameter[1] && _event.EventType == ChatEvent.EventTypeList.PutGoods && _event.Num <= items.PutCount && !PlayerInfo.CheckEvents(_event.ID))
                            {
                                if (((_event.EventItem == null) || (_event.EventItem != null && CharBag.ContainsGoods(_event.EventItem[0], _event.EventItem[1]))) &&
                                    (_event.NeedQuest == 0 || (_event.NeedQuest != 0 && PlayerInfo.CheckCompleteQuest(_event.NeedQuest))))
                                {
                                    ishit = true;
                                    PlayerInfo.AddEvents(_event.ID);
                                    Debug.Log("hit event: " + _event.ID);
                                    AddStroyName(_event);
                                    break;
                                }
                            }
                            else if (items.ID == _event.Parameter[1] && _event.EventType == ChatEvent.EventTypeList.SellGoods && _event.Num <= items.SellCount && !PlayerInfo.CheckEvents(_event.ID))
                            {
                                if (((_event.EventItem == null) || (_event.EventItem != null && CharBag.ContainsGoods(_event.EventItem[0], _event.EventItem[1]))) &&
                                    (_event.NeedQuest == 0 || (_event.NeedQuest != 0 && PlayerInfo.CheckCompleteQuest(_event.NeedQuest))))
                                {
                                    ishit = true;
                                    PlayerInfo.AddEvents(_event.ID);
                                    Debug.Log("hit event: " + _event.ID);
                                    AddStroyName(_event);
                                    break;
                                }
                            }
                            else if (items.ID == _event.Parameter[1] && _event.EventType == ChatEvent.EventTypeList.ComposeGoods && _event.Num <= items.RecipeCount && !PlayerInfo.CheckEvents(_event.ID))
                            {
                                if (((_event.EventItem == null) || (_event.EventItem != null && CharBag.ContainsGoods(_event.EventItem[0], _event.EventItem[1]))) &&
                                    (_event.NeedQuest == 0 || (_event.NeedQuest != 0 && PlayerInfo.CheckCompleteQuest(_event.NeedQuest))))
                                {
                                    ishit = true;
                                    PlayerInfo.AddEvents(_event.ID);
                                    Debug.Log("hit event: " + _event.ID);
                                    AddStroyName(_event);
                                    break;
                                }
                            }
                            else if (items.ID == _event.Parameter[1] && _event.EventType == ChatEvent.EventTypeList.CollectGoods && _event.Num <= items.CollectCount && !PlayerInfo.CheckEvents(_event.ID))
                            {
                                if (((_event.EventItem == null) || (_event.EventItem != null && CharBag.ContainsGoods(_event.EventItem[0], _event.EventItem[1]))) &&
                                    (_event.NeedQuest == 0 || (_event.NeedQuest != 0 && PlayerInfo.CheckCompleteQuest(_event.NeedQuest))))
                                {
                                    ishit = true;
                                    PlayerInfo.AddEvents(_event.ID);
                                    Debug.Log("hit event: " + _event.ID);
                                    AddStroyName(_event);
                                    break;
                                }
                            }
                        }
                    }       //item
                    else if (_event.Parameter[0] == 1)
                    {
                        foreach (PlayerInfo.MindsInfo minds in playerInfo.MaterialInfoList.Minds)
                        {
                            if (minds.ID == _event.Parameter[1] && _event.EventType == ChatEvent.EventTypeList.PutGoods && _event.Num <= minds.PutCount && !PlayerInfo.CheckEvents(_event.ID))
                            {
                                if (((_event.EventItem == null) || (_event.EventItem != null && CharBag.ContainsGoods(_event.EventItem[0], _event.EventItem[1]))) &&
                                    (_event.NeedQuest == 0 || (_event.NeedQuest != 0 && PlayerInfo.CheckCompleteQuest(_event.NeedQuest))))
                                {
                                    ishit = true;
                                    PlayerInfo.AddEvents(_event.ID);
                                    Debug.Log("hit event: " + _event.ID);
                                    AddStroyName(_event);
                                    break;
                                }
                            }
                            else if (minds.ID == _event.Parameter[1] && _event.EventType == ChatEvent.EventTypeList.SellGoods && _event.Num <= minds.SellCount && !PlayerInfo.CheckEvents(_event.ID))
                            {
                                if (((_event.EventItem == null) || (_event.EventItem != null && CharBag.ContainsGoods(_event.EventItem[0], _event.EventItem[1]))) &&
                                    (_event.NeedQuest == 0 || (_event.NeedQuest != 0 && PlayerInfo.CheckCompleteQuest(_event.NeedQuest))))
                                {
                                    ishit = true;
                                    PlayerInfo.AddEvents(_event.ID);
                                    Debug.Log("hit event: " + _event.ID);
                                    AddStroyName(_event);
                                    break;
                                }
                            }
                            else if (minds.ID == _event.Parameter[1] && _event.EventType == ChatEvent.EventTypeList.ComposeGoods && _event.Num <= minds.RecipeCount && !PlayerInfo.CheckEvents(_event.ID))
                            {
                                if (((_event.EventItem == null) || (_event.EventItem != null && CharBag.ContainsGoods(_event.EventItem[0], _event.EventItem[1]))) &&
                                    (_event.NeedQuest == 0 || (_event.NeedQuest != 0 && PlayerInfo.CheckCompleteQuest(_event.NeedQuest))))
                                {
                                    ishit = true;
                                    PlayerInfo.AddEvents(_event.ID);
                                    Debug.Log("hit event: " + _event.ID);
                                    AddStroyName(_event);
                                    break;
                                }
                            }
                            else if (minds.ID == _event.Parameter[1] && _event.EventType == ChatEvent.EventTypeList.CollectGoods && _event.Num <= minds.CollectCount && !PlayerInfo.CheckEvents(_event.ID))
                            {
                                if (((_event.EventItem == null) || (_event.EventItem != null && CharBag.ContainsGoods(_event.EventItem[0], _event.EventItem[1]))) &&
                                    (_event.NeedQuest == 0 || (_event.NeedQuest != 0 && PlayerInfo.CheckCompleteQuest(_event.NeedQuest))))
                                {
                                    ishit = true;
                                    PlayerInfo.AddEvents(_event.ID);
                                    Debug.Log("hit event: " + _event.ID);
                                    AddStroyName(_event);
                                    break;
                                }
                            }
                        }
                    }       //mind
                    else if (_event.Parameter[0] == 2)
                    {
                        foreach (PlayerInfo.SpecialItemsInfo spitems in playerInfo.MaterialInfoList.SpecialItems)
                        {
                            if (spitems.ID == _event.Parameter[1] && _event.EventType == ChatEvent.EventTypeList.PutGoods && _event.Num <= spitems.PutCount && !PlayerInfo.CheckEvents(_event.ID))
                            {
                                if (((_event.EventItem == null) || (_event.EventItem != null && CharBag.ContainsGoods(_event.EventItem[0], _event.EventItem[1]))) &&
                                    (_event.NeedQuest == 0 || (_event.NeedQuest != 0 && PlayerInfo.CheckCompleteQuest(_event.NeedQuest))))
                                {
                                    ishit = true;
                                    PlayerInfo.AddEvents(_event.ID);
                                    Debug.Log("hit event: " + _event.ID);
                                    AddStroyName(_event);
                                    break;
                                }
                            }
                            else if (spitems.ID == _event.Parameter[1] && _event.EventType == ChatEvent.EventTypeList.SellGoods && _event.Num <= spitems.SellCount && !PlayerInfo.CheckEvents(_event.ID))
                            {
                                if (((_event.EventItem == null) || (_event.EventItem != null && CharBag.ContainsGoods(_event.EventItem[0], _event.EventItem[1]))) &&
                                    (_event.NeedQuest == 0 || (_event.NeedQuest != 0 && PlayerInfo.CheckCompleteQuest(_event.NeedQuest))))
                                {
                                    ishit = true;
                                    PlayerInfo.AddEvents(_event.ID);
                                    Debug.Log("hit event: " + _event.ID);
                                    AddStroyName(_event);
                                    break;
                                }
                            }
                            else if (spitems.ID == _event.Parameter[1] && _event.EventType == ChatEvent.EventTypeList.ComposeGoods && _event.Num <= spitems.RecipeCount && !PlayerInfo.CheckEvents(_event.ID))
                            {
                                if (((_event.EventItem == null) || (_event.EventItem != null && CharBag.ContainsGoods(_event.EventItem[0], _event.EventItem[1]))) &&
                                    (_event.NeedQuest == 0 || (_event.NeedQuest != 0 && PlayerInfo.CheckCompleteQuest(_event.NeedQuest))))
                                {
                                    ishit = true;
                                    PlayerInfo.AddEvents(_event.ID);
                                    Debug.Log("hit event: " + _event.ID);
                                    AddStroyName(_event);
                                    break;
                                }
                            }
                            else if (spitems.ID == _event.Parameter[1] && _event.EventType == ChatEvent.EventTypeList.CollectGoods && _event.Num <= spitems.CollectCount && !PlayerInfo.CheckEvents(_event.ID))
                            {
                                if (((_event.EventItem == null) || (_event.EventItem != null && CharBag.ContainsGoods(_event.EventItem[0], _event.EventItem[1]))) &&
                                    (_event.NeedQuest == 0 || (_event.NeedQuest != 0 && PlayerInfo.CheckCompleteQuest(_event.NeedQuest))))
                                {
                                    ishit = true;
                                    PlayerInfo.AddEvents(_event.ID);
                                    Debug.Log("hit event: " + _event.ID);
                                    AddStroyName(_event);
                                    break;
                                }
                            }
                        }
                    }       //specail
                }
                break;

            case ChatEvent.EventTypeList.InShop:
                PlayerInfo.SenceInfo shop_senceinfo = (PlayerInfo.SenceInfo)playerInfo.SenceInfoList[0];
                if (_event.Num <= shop_senceinfo.InCount && !PlayerInfo.CheckEvents(_event.ID))
                {
                    if (((_event.EventItem == null) || (_event.EventItem != null && CharBag.ContainsGoods(_event.EventItem[0], _event.EventItem[1]))) &&
                        (_event.NeedQuest == 0 || (_event.NeedQuest != 0 && PlayerInfo.CheckCompleteQuest(_event.NeedQuest))))
                    {
                        ishit = true;
                        PlayerInfo.AddEvents(_event.ID);
                        Debug.Log("hit event: " + _event.ID);
                        AddStroyName(_event);
                    }
                }
                break;

            case ChatEvent.EventTypeList.InMap:
                PlayerInfo.SenceInfo map_senceinfo = (PlayerInfo.SenceInfo)playerInfo.SenceInfoList[1];
                if (_event.Num <= map_senceinfo.InCount && !PlayerInfo.CheckEvents(_event.ID))
                {
                    if (((_event.EventItem == null) || (_event.EventItem != null && CharBag.ContainsGoods(_event.EventItem[0], _event.EventItem[1]))) &&
                        (_event.NeedQuest == 0 || (_event.NeedQuest != 0 && PlayerInfo.CheckCompleteQuest(_event.NeedQuest))))
                    {
                        ishit = true;
                        PlayerInfo.AddEvents(_event.ID);
                        Debug.Log("hit event: " + _event.ID);
                        AddStroyName(_event);
                    }
                }
                break;

            case ChatEvent.EventTypeList.Arrive:
                foreach (PlayerInfo.MapInfo mapinfo in playerInfo.MapInfoList)
                {
                    if (mapinfo.ID == _event.Parameter[0] && _event.Num <= mapinfo.InCount && !PlayerInfo.CheckEvents(_event.ID))
                    {
                        if (((_event.EventItem == null) || (_event.EventItem != null && CharBag.ContainsGoods(_event.EventItem[0], _event.EventItem[1]))) &&
                            (_event.NeedQuest == 0 || (_event.NeedQuest != 0 && PlayerInfo.CheckCompleteQuest(_event.NeedQuest))))
                        {
                            ishit = true;
                            PlayerInfo.AddEvents(_event.ID);
                            Debug.Log("hit event: " + _event.ID);
                            AddStroyName(_event);
                        }
                        break;
                    }
                }
                break;

            case ChatEvent.EventTypeList.Mines:
                if (_event.Num <= playerInfo.MineCount && !PlayerInfo.CheckEvents(_event.ID))
                {
                    if (((_event.EventItem == null) || (_event.EventItem != null && CharBag.ContainsGoods(_event.EventItem[0], _event.EventItem[1]))) &&
                        (_event.NeedQuest == 0 || (_event.NeedQuest != 0 && PlayerInfo.CheckCompleteQuest(_event.NeedQuest))))
                    {
                        ishit = true;
                        PlayerInfo.AddEvents(_event.ID);
                        Debug.Log("hit event: " + _event.ID);
                        AddStroyName(_event);
                    }
                }
                break;

            case ChatEvent.EventTypeList.Golds:
                if (_event.Num <= playerInfo.Money && !PlayerInfo.CheckEvents(_event.ID))
                {
                    if (((_event.EventItem == null) || (_event.EventItem != null && CharBag.ContainsGoods(_event.EventItem[0], _event.EventItem[1]))) &&
                        (_event.NeedQuest == 0 || (_event.NeedQuest != 0 && PlayerInfo.CheckCompleteQuest(_event.NeedQuest))))
                    {
                        ishit = true;
                        PlayerInfo.AddEvents(_event.ID);
                        Debug.Log("hit event: " + _event.ID);
                        AddStroyName(_event);
                    }
                }
                break;

            default:
                Debug.LogWarning("Can't Check EventType:" + EventType + "!");
                ishit = false;
                break;
            }
        }
        return(ishit);
    }