public static void LoadAll()
 {
     EventVisitSyncer.GenerateList();
     EventLoginSyncer.GenerateList();
     EventQuestSyncer.GenerateList();
     EventXmasSyncer.GenerateList();
 }
Example #2
0
 public static void ReloadEvent(int index)
 {
     if (index == 0)
     {
         EventVisitSyncer.ReGenerateList();
     }
     else if (index == 1)
     {
         EventLoginSyncer.ReGenerateList();
     }
     else if (index == 2)
     {
         EventMapSyncer.ReGenerateList();
     }
     else if (index == 3)
     {
         EventPlayTimeSyncer.ReGenerateList();
     }
     else if (index == 4)
     {
         EventQuestSyncer.ReGenerateList();
     }
     else if (index == 5)
     {
         EventRankUpSyncer.ReGenerateList();
     }
     else if (index == 6)
     {
         EventXmasSyncer.ReGenerateList();
     }
 }
Example #3
0
        private void EnableQuestMission(Account player)
        {
            PlayerEvent playerEvent = player._event;

            if (playerEvent == null || playerEvent.LastQuestFinish != 0 || EventQuestSyncer.getRunningEvent() == null)
            {
                return;
            }
            player._mission.mission4 = 13;
        }
Example #4
0
 public static void LoadAll()
 {
     EventVisitSyncer.Load();
     EventLoginSyncer.Load();
     EventMapSyncer.Load();
     EventPlayTimeSyncer.Load();
     EventQuestSyncer.Load();
     EventRankUpSyncer.Load();
     EventXmasSyncer.Load();
 }
        private void EnableQuestMission(Account player)
        {
            PlayerEvent ev = player._event;

            if (ev == null)
            {
                return;
            }
            if (ev.LastQuestFinish == 0 && EventQuestSyncer.getRunningEvent() != null)
            {
                player._mission.mission4 = 13;
            }
        }
        public static void ReloadEvent(int index)
        {
            switch (index)
            {
            case 2:
                EventVisitSyncer.ReGenList();
                break;

            case 3:
                EventLoginSyncer.ReGenList();
                break;

            case 4:
                EventQuestSyncer.ReGenList();
                break;

            case 5:
                EventXmasSyncer.ReGenList();
                break;
            }
        }
Example #7
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);
        }
Example #8
0
        private void CheckGameEvents(EventVisitModel eventVisit)
        {
            PlayerEvent playerEvent = player.events;

            if (playerEvent != null)
            {
                QuestModel eventQuest = EventQuestSyncer.GetRunningEvent();
                if (eventQuest != null)
                {
                    long lastDate = playerEvent.LastQuestDate;
                    int  finish   = playerEvent.LastQuestFinish;
                    if (playerEvent.LastQuestDate < eventQuest.startDate)
                    {
                        playerEvent.LastQuestDate   = 0;
                        playerEvent.LastQuestFinish = 0;
                        player.SendCompletePacket(PackageDataManager.SERVER_MESSAGE_EVENT_QUEST_PAK);
                    }
                    if (playerEvent.LastQuestFinish == 0)
                    {
                        player.missions.mission4 = 13; //13 = MissionId Event
                        if (playerEvent.LastQuestDate == 0)
                        {
                            playerEvent.LastQuestDate = date;
                        }
                    }
                    if (playerEvent.LastQuestDate != lastDate || playerEvent.LastQuestFinish != finish)
                    {
                        player.ExecuteQuery($"UPDATE player_events SET last_quest_date='{playerEvent.LastQuestDate}', last_quest_finish='{playerEvent.LastQuestFinish}' WHERE player_id='{player.playerId}'");
                    }
                }
                EventLoginModel eventLogin = EventLoginSyncer.GetRunningEvent();
                if (eventLogin != null && !(eventLogin.startDate < playerEvent.LastLoginDate && playerEvent.LastLoginDate < eventLogin.endDate))
                {
                    ItemsModel item = new ItemsModel(eventLogin.rewardId, eventLogin.category, "Login event", 1, eventLogin.count);
                    player.TryCreateItem(item);
                    player.SendCompletePacket(PackageDataManager.AUTH_SERVER_MESSAGE_ITEM_RECEIVE_PAK);
                    if (item.category == 1)
                    {
                        weapons.Add(item);
                    }
                    else if (item.category == 2)
                    {
                        charas.Add(item);
                    }
                    else if (item.category == 3)
                    {
                        cupons.Add(item);
                    }
                    long dateNow = long.Parse(DateTime.Now.ToString("yyMMddHHmm"));
                    player.ExecuteQuery($"UPDATE player_events SET last_login_date='{dateNow}' WHERE player_id='{player.playerId}'");
                }
                if (eventVisit != null && playerEvent.LastVisitEventId != eventVisit.id)
                {
                    playerEvent.LastVisitEventId   = eventVisit.id;
                    playerEvent.LastVisitSequence1 = 0;
                    playerEvent.LastVisitSequence2 = 0;
                    playerEvent.NextVisitDate      = 0;
                    player.ExecuteQuery($"UPDATE player_events SET last_visit_event_id='{eventVisit.id}', last_visit_sequence1='0', last_visit_sequence2='0', next_visit_date='0' WHERE player_id='{player.playerId}'");
                }
                EventXmasModel eventXMAS = EventXmasSyncer.GetRunningEvent();
                if (eventXMAS != null)
                {
                    if (playerEvent.LastXmasRewardDate < eventXMAS.startDate)
                    {
                        playerEvent.LastXmasRewardDate = 0;
                        player.ExecuteQuery($"UPDATE player_events SET last_xmas_reward_date='0' WHERE player_id='{player.playerId}'");
                    }
                    if (!(playerEvent.LastXmasRewardDate > eventXMAS.startDate && playerEvent.LastXmasRewardDate <= eventXMAS.endDate))
                    {
                        xmas = true;
                    }
                }
            }
        }
        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);
        }