Ejemplo n.º 1
0
        private void CheckGameEvents(EventVisitModel evVisit)
        {
            long        num = long.Parse(DateTime.Now.ToString("yyMMddHHmm"));
            PlayerEvent pE  = this.c._event;

            if (pE != null)
            {
                QuestModel runningEvent1 = EventQuestSyncer.getRunningEvent();
                if (runningEvent1 != null)
                {
                    long lastQuestDate   = (long)pE.LastQuestDate;
                    long lastQuestFinish = (long)pE.LastQuestFinish;
                    if (pE.LastQuestDate < runningEvent1.startDate)
                    {
                        pE.LastQuestDate   = 0U;
                        pE.LastQuestFinish = 0;
                        this.c.SendPacket((SendPacket) new SERVER_MESSAGE_EVENT_QUEST_PAK());
                    }
                    if (pE.LastQuestFinish == 0)
                    {
                        this.c._mission.mission4 = 13;
                        if (pE.LastQuestDate == 0U)
                        {
                            pE.LastQuestDate = (uint)num;
                        }
                    }
                    if ((long)pE.LastQuestDate != lastQuestDate || (long)pE.LastQuestFinish != lastQuestFinish)
                    {
                        EventQuestSyncer.ResetPlayerEvent(this.c.player_id, pE);
                    }
                }
                EventLoginModel runningEvent2 = EventLoginSyncer.getRunningEvent();
                if (runningEvent2 != null && (runningEvent2.startDate >= pE.LastLoginDate || pE.LastLoginDate >= runningEvent2.endDate))
                {
                    ItemsModel modelo = new ItemsModel(runningEvent2._rewardId, runningEvent2._category, "Login event", 1, (uint)runningEvent2._count, 0L);
                    PlayerManager.tryCreateItem(modelo, this.c._inventory, this.c.player_id);
                    this.c.SendPacket((SendPacket) new SERVER_MESSAGE_ITEM_RECEIVE_PAK(0U));
                    if (modelo._category == 1)
                    {
                        this.weapons.Add(modelo);
                    }
                    else if (modelo._category == 2)
                    {
                        this.charas.Add(modelo);
                    }
                    else if (modelo._category == 3)
                    {
                        this.cupons.Add(modelo);
                    }
                    ComDiv.updateDB("player_events", "last_login_date", (object)num, "player_id", (object)this.c.player_id);
                }
                if (evVisit != null && pE.LastVisitEventId != evVisit.id)
                {
                    pE.LastVisitEventId   = evVisit.id;
                    pE.LastVisitSequence1 = 0;
                    pE.LastVisitSequence2 = 0;
                    pE.NextVisitDate      = 0;
                    EventVisitSyncer.ResetPlayerEvent(this.c.player_id, evVisit.id);
                }
                EventXmasModel runningEvent3 = EventXmasSyncer.getRunningEvent();
                if (runningEvent3 != null)
                {
                    if (pE.LastXmasRewardDate < runningEvent3.startDate)
                    {
                        pE.LastXmasRewardDate = 0U;
                        ComDiv.updateDB("player_events", "last_xmas_reward_date", (object)0, "player_id", (object)this.c.player_id);
                    }
                    if (pE.LastXmasRewardDate <= runningEvent3.startDate || pE.LastXmasRewardDate > runningEvent3.endDate)
                    {
                        this._xmas = true;
                    }
                }
            }
            ComDiv.updateDB("accounts", "last_login", (object)num, "player_id", (object)this.c.player_id);
        }
        private void CheckGameEvents(EventVisitModel evVisit)
        {
            uint        dateNow = uint.Parse(DateTime.Now.ToString("yyMMddHHmm"));
            PlayerEvent pev     = c._event;

            if (pev != null)
            {
                QuestModel evQuest = EventQuestSyncer.getRunningEvent();
                if (evQuest != null)
                {
                    long date = pev.LastQuestDate, finish = pev.LastQuestFinish;
                    if (pev.LastQuestDate < evQuest.startDate)
                    {
                        pev.LastQuestDate   = 0;
                        pev.LastQuestFinish = 0;
                        c.SendPacket(new SERVER_MESSAGE_EVENT_QUEST_PAK());
                    }
                    if (pev.LastQuestFinish == 0)
                    {
                        c._mission.mission4 = 13; //MissionId
                        if (pev.LastQuestDate == 0)
                        {
                            pev.LastQuestDate = (uint)dateNow;
                        }
                    }
                    if (pev.LastQuestDate != date || pev.LastQuestFinish != finish)
                    {
                        EventQuestSyncer.ResetPlayerEvent(c.player_id, pev);
                    }
                }
                EventLoginModel evLogin = EventLoginSyncer.getRunningEvent();
                if (evLogin != null && !(evLogin.startDate < pev.LastLoginDate && pev.LastLoginDate < evLogin.endDate))
                {
                    ItemsModel item = new ItemsModel(evLogin._rewardId, evLogin._category, "Login event", 1, (uint)evLogin._count);
                    PlayerManager.tryCreateItem(item, c._inventory, c.player_id);
                    c.SendPacket(new SERVER_MESSAGE_ITEM_RECEIVE_PAK(0));
                    if (item._category == 1)
                    {
                        weapons.Add(item);
                    }
                    else if (item._category == 2)
                    {
                        charas.Add(item);
                    }
                    else if (item._category == 3)
                    {
                        cupons.Add(item);
                    }
                    ComDiv.updateDB("player_events", "last_login_date", dateNow, "player_id", c.player_id);
                }
                if (evVisit != null && pev.LastVisitEventId != evVisit.id)
                {
                    pev.LastVisitEventId   = evVisit.id;
                    pev.LastVisitSequence1 = 0;
                    pev.LastVisitSequence2 = 0;
                    pev.NextVisitDate      = 0;
                    EventVisitSyncer.ResetPlayerEvent(c.player_id, evVisit.id);
                }
                EventXmasModel evXmas = EventXmasSyncer.getRunningEvent();
                if (evXmas != null)
                {
                    if (pev.LastXmasRewardDate < evXmas.startDate)
                    {
                        pev.LastXmasRewardDate = 0;
                        ComDiv.updateDB("player_events", "last_xmas_reward_date", 0, "player_id", c.player_id);
                    }
                    if (!(pev.LastXmasRewardDate > evXmas.startDate && pev.LastXmasRewardDate <= evXmas.endDate))
                    {
                        _xmas = true;
                    }
                }
            }
            //ComDiv.updateDB("contas", "last_login", dateNow, "player_id", c.player_id);
        }