public static void LoadAll()
 {
     EventVisitSyncer.GenerateList();
     EventLoginSyncer.GenerateList();
     EventQuestSyncer.GenerateList();
     EventXmasSyncer.GenerateList();
 }
Ejemplo n.º 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();
     }
 }
Ejemplo n.º 3
0
 public static void LoadAll()
 {
     EventVisitSyncer.Load();
     EventLoginSyncer.Load();
     EventMapSyncer.Load();
     EventPlayTimeSyncer.Load();
     EventQuestSyncer.Load();
     EventRankUpSyncer.Load();
     EventXmasSyncer.Load();
 }
        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;
            }
        }
Ejemplo n.º 5
0
 public override void run()
 {
     try
     {
         if (this._client == null)
         {
             return;
         }
         Account player = this._client._player;
         if (player == null || player.player_name.Length == 0 || this.type > 1)
         {
             this.erro = EventErrorEnum.VisitEvent_UserFail;
         }
         else if (player._event != null)
         {
             if (player._event.LastVisitSequence1 == player._event.LastVisitSequence2)
             {
                 this.erro = EventErrorEnum.VisitEvent_AlreadyCheck;
             }
             else
             {
                 EventVisitModel eventVisitModel = EventVisitSyncer.getEvent(this.eventId);
                 if (eventVisitModel == null)
                 {
                     this.erro = EventErrorEnum.VisitEvent_Unknown;
                 }
                 else if (eventVisitModel.EventIsEnabled())
                 {
                     VisitItem reward = eventVisitModel.getReward(player._event.LastVisitSequence2, this.type);
                     if (reward != null)
                     {
                         GoodItem good = ShopManager.getGood(reward.good_id);
                         if (good != null)
                         {
                             PlayerEvent playerEvent = player._event;
                             DateTime    dateTime    = DateTime.Now;
                             dateTime = dateTime.AddDays(1.0);
                             int num = int.Parse(dateTime.ToString("yyMMdd"));
                             playerEvent.NextVisitDate = num;
                             ComDiv.updateDB("player_events", "player_id", (object)player.player_id, new string[2]
                             {
                                 "next_visit_date",
                                 "last_visit_sequence2"
                             }, (object)player._event.NextVisitDate, (object)++player._event.LastVisitSequence2);
                             this._client.SendPacket((SendPacket) new INVENTORY_ITEM_CREATE_PAK(1, player, new ItemsModel(good._item._id, good._item._category, good._item._name, good._item._equip, (uint)reward.count, 0L)));
                         }
                         else
                         {
                             this.erro = EventErrorEnum.VisitEvent_NotEnough;
                         }
                     }
                     else
                     {
                         this.erro = EventErrorEnum.VisitEvent_Unknown;
                     }
                 }
                 else
                 {
                     this.erro = EventErrorEnum.VisitEvent_WrongVersion;
                 }
             }
         }
         else
         {
             this.erro = EventErrorEnum.VisitEvent_Unknown;
         }
         this._client.SendPacket((SendPacket) new EVENT_VISIT_REWARD_PAK(this.erro));
     }
     catch (Exception ex)
     {
         Logger.info("[EVENT_VERIFICATION_REWARD_REC] " + ex.ToString());
     }
 }
Ejemplo n.º 6
0
 public override void RunImplement()
 {
     try
     {
         Account player = client.SessionPlayer;
         if (player == null || player.events == null || string.IsNullOrEmpty(player.nickname) || player.nickname.Length == 0 || player.checkEventVisitConfirm)
         {
             client.SendCompletePacket(PackageDataManager.EVENT_VISIT_CONFIRM_0x80001500_PAK);
         }
         else
         {
             int dateNow = int.Parse(DateTime.Now.ToString("yyMMdd"));
             if (player.events.NextVisitDate <= dateNow)
             {
                 EventVisitModel eventVisit = EventVisitSyncer.GetEvent(eventId);
                 if (eventVisit != null)
                 {
                     if (eventVisit.EventIsEnabled())
                     {
                         player.events.NextVisitDate = int.Parse(DateTime.Now.AddDays(1).ToString("yyMMdd"));
                         if (player.ExecuteQuery($"UPDATE player_events SET next_visit_date='{player.events.NextVisitDate}', last_visit_sequence1='{player.events.LastVisitSequence1++}' WHERE player_id='{player.playerId}'"))
                         {
                             bool IsReward = false;
                             try
                             {
                                 IsReward = eventVisit.box[player.events.LastVisitSequence2].reward1.IsReward;
                             }
                             catch
                             {
                             }
                             if (!IsReward)
                             {
                                 player.ExecuteQuery($"UPDATE player_events SET last_visit_sequence2='{player.events.LastVisitSequence2++}' WHERE player_id='{player.playerId}'");
                             }
                             client.SendPacket(new EVENT_VISIT_CONFIRM_PAK(EventErrorEnum.VisitEvent_Success, eventVisit, player.events));
                         }
                         else
                         {
                             client.SendCompletePacket(PackageDataManager.EVENT_VISIT_CONFIRM_0x80001505_PAK);
                         }
                     }
                     else
                     {
                         client.SendCompletePacket(PackageDataManager.EVENT_VISIT_CONFIRM_0x80001503_PAK);
                     }
                 }
                 else
                 {
                     client.SendCompletePacket(PackageDataManager.EVENT_VISIT_CONFIRM_0x80001505_PAK);
                 }
             }
             else
             {
                 client.SendCompletePacket(PackageDataManager.EVENT_VISIT_CONFIRM_0x80001502_PAK);
             }
             player.checkEventVisitConfirm = true;
         }
     }
     catch (Exception ex)
     {
         PacketLog(ex);
     }
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 8
0
        public override void write()
        {
            this.writeH((short)2566);
            this.writeD(this._erro);
            if (this._erro != 0U)
            {
                return;
            }
            ServerConfig    config       = LoginManager.Config;
            EventVisitModel runningEvent = EventVisitSyncer.getRunningEvent();

            this.writeC((byte)0);
            this.writeS(this.c.player_name, 33);
            this.writeD(this.c._exp);
            this.writeD(this.c._rank);
            this.writeD(this.c._rank);
            this.writeD(this.c._gp);
            this.writeD(this.c._money);
            this.writeD(this.clan._id);
            this.writeD(this.c.clanAccess);
            this.writeQ(0L);
            this.writeC((byte)this.c.pc_cafe);
            this.writeC((byte)this.c.tourneyLevel);
            this.writeC((byte)this.c.name_color);
            this.writeS(this.clan._name, 17);
            this.writeC((byte)this.clan._rank);
            this.writeC((byte)this.clan.getClanUnit());
            this.writeD(this.clan._logo);
            this.writeC((byte)this.clan._name_color);
            this.writeD(10000);
            this.writeC((byte)0);
            this.writeD(0);
            this.writeD(this.c.LastRankUpDate);
            this.writeD(this.c._statistic.fights);
            this.writeD(this.c._statistic.fights_win);
            this.writeD(this.c._statistic.fights_lost);
            this.writeD(this.c._statistic.fights_draw);
            this.writeD(this.c._statistic.kills_count);
            this.writeD(this.c._statistic.headshots_count);
            this.writeD(this.c._statistic.deaths_count);
            this.writeD(this.c._statistic.totalfights_count);
            this.writeD(this.c._statistic.totalkills_count);
            this.writeD(this.c._statistic.escapes);
            this.writeD(this.c._statistic.fights);
            this.writeD(this.c._statistic.fights_win);
            this.writeD(this.c._statistic.fights_lost);
            this.writeD(this.c._statistic.fights_draw);
            this.writeD(this.c._statistic.kills_count);
            this.writeD(this.c._statistic.headshots_count);
            this.writeD(this.c._statistic.deaths_count);
            this.writeD(this.c._statistic.totalfights_count);
            this.writeD(this.c._statistic.totalkills_count);
            this.writeD(this.c._statistic.escapes);
            this.writeD(this.c._equip._red);
            this.writeD(this.c._equip._blue);
            this.writeD(this.c._equip._helmet);
            this.writeD(this.c._equip._beret);
            this.writeD(this.c._equip._dino);
            this.writeD(this.c._equip._primary);
            this.writeD(this.c._equip._secondary);
            this.writeD(this.c._equip._melee);
            this.writeD(this.c._equip._grenade);
            this.writeD(this.c._equip._special);
            this.writeH((short)0);
            this.writeD(this.c._bonus.fakeRank);
            this.writeD(this.c._bonus.fakeRank);
            this.writeS(this.c._bonus.fakeNick, 33);
            this.writeH((short)this.c._bonus.sightColor);
            this.writeC((byte)31);
            this.CheckGameEvents(runningEvent);
            if (config.ClientVersion == "1.15.37")
            {
                this.writeC((byte)1);
                this.writeD(this.charas.Count);
                this.writeD(this.weapons.Count);
                this.writeD(this.cupons.Count);
                this.writeD(0);
                for (int index = 0; index < this.charas.Count; ++index)
                {
                    ItemsModel chara = this.charas[index];
                    this.writeQ(chara._objId);
                    this.writeD(chara._id);
                    this.writeC((byte)chara._equip);
                    this.writeD(chara._count);
                }
                for (int index = 0; index < this.weapons.Count; ++index)
                {
                    ItemsModel weapon = this.weapons[index];
                    this.writeQ(weapon._objId);
                    this.writeD(weapon._id);
                    this.writeC((byte)weapon._equip);
                    this.writeD(weapon._count);
                }
                for (int index = 0; index < this.cupons.Count; ++index)
                {
                    ItemsModel cupon = this.cupons[index];
                    this.writeQ(cupon._objId);
                    this.writeD(cupon._id);
                    this.writeC((byte)cupon._equip);
                    this.writeD(cupon._count);
                }
            }
            this.writeC(ConfigGA.Outpost);
            this.writeD(this.c.brooch);
            this.writeD(this.c.insignia);
            this.writeD(this.c.medal);
            this.writeD(this.c.blue_order);
            this.writeC((byte)this.c._mission.actualMission);
            this.writeC((byte)this.c._mission.card1);
            this.writeC((byte)this.c._mission.card2);
            this.writeC((byte)this.c._mission.card3);
            this.writeC((byte)this.c._mission.card4);
            this.writeB(ComDiv.getCardFlags(this.c._mission.mission1, this.c._mission.list1));
            this.writeB(ComDiv.getCardFlags(this.c._mission.mission2, this.c._mission.list2));
            this.writeB(ComDiv.getCardFlags(this.c._mission.mission3, this.c._mission.list3));
            this.writeB(ComDiv.getCardFlags(this.c._mission.mission4, this.c._mission.list4));
            this.writeC((byte)this.c._mission.mission1);
            this.writeC((byte)this.c._mission.mission2);
            this.writeC((byte)this.c._mission.mission3);
            this.writeC((byte)this.c._mission.mission4);
            this.writeB(this.c._mission.list1);
            this.writeB(this.c._mission.list2);
            this.writeB(this.c._mission.list3);
            this.writeB(this.c._mission.list4);
            this.writeQ(this.c._titles.Flags);
            this.writeC((byte)this.c._titles.Equiped1);
            this.writeC((byte)this.c._titles.Equiped2);
            this.writeC((byte)this.c._titles.Equiped3);
            this.writeD(this.c._titles.Slots);
            this.writeD(ConfigMaps.Tutorial);
            this.writeD(ConfigMaps.Deathmatch);
            this.writeD(ConfigMaps.Destruction);
            this.writeD(ConfigMaps.Sabotage);
            this.writeD(ConfigMaps.Supression);
            this.writeD(ConfigMaps.Defense);
            this.writeD(ConfigMaps.Challenge);
            this.writeD(ConfigMaps.Dinosaur);
            this.writeD(ConfigMaps.Sniper);
            this.writeD(ConfigMaps.Shotgun);
            this.writeD(ConfigMaps.HeadHunter);
            this.writeD(ConfigMaps.Knuckle);
            this.writeD(ConfigMaps.CrossCounter);
            this.writeD(ConfigMaps.Chaos);
            if (config.ClientVersion == "1.15.38" || config.ClientVersion == "1.15.39" || (config.ClientVersion == "1.15.41" || config.ClientVersion == "1.15.42"))
            {
                this.writeD(0);
            }
            this.writeC((byte)MapsXML.ModeList.Count);
            this.writeC((byte)4);
            this.writeD(MapsXML.maps1);
            this.writeD(MapsXML.maps2);
            this.writeD(MapsXML.maps3);
            this.writeD(MapsXML.maps4);
            foreach (ushort mode in MapsXML.ModeList)
            {
                this.writeH(mode);
            }
            this.writeB(MapsXML.TagList.ToArray());
            this.writeC(config.missions);
            this.writeD(MissionsXML._missionPage1);
            this.writeD(50);
            this.writeD(75);
            this.writeC((byte)1);
            this.writeH((short)20);
            this.writeB(new byte[20]
            {
                (byte)112,
                (byte)12,
                (byte)148,
                (byte)45,
                (byte)72,
                (byte)8,
                (byte)221,
                (byte)30,
                (byte)176,
                (byte)171,
                (byte)26,
                (byte)0,
                (byte)153,
                (byte)123,
                (byte)66,
                (byte)0,
                (byte)112,
                (byte)12,
                (byte)148,
                (byte)45
            });
            this.writeD(this.c.IsGM());
            this.writeD(this._xmas);
            this.writeC((byte)1);
            this.WriteVisitEvent(runningEvent);
            if (config.ClientVersion == "1.15.39" || config.ClientVersion == "1.15.41" || config.ClientVersion == "1.15.42")
            {
                this.writeB(new byte[9]);
            }
            this.writeD(uint.Parse(DateTime.Now.ToString("yyMMddHHmm")));
            this.writeS("10.120.1.44", 256);
            this.writeD(8085);
            this.writeC(config.GiftSystem);
            this.writeH((short)0);
            this.writeC((byte)1);
            this.writeC((byte)0);
            this.writeC((byte)1);
            this.writeC((byte)6);
            this.writeC((byte)4);
            this.writeC((byte)0);
            this.writeC((byte)1);
            this.writeC((byte)2);
            this.writeC((byte)5);
            this.writeC((byte)3);
        }
        public override void run()
        {
            try
            {
                if (_client == null)
                {
                    return;
                }
                Account p = _client._player;
                if (p == null || p.player_name.Length == 0 || type > 1)
                {
                    erro = EventErrorEnum.VisitEvent_UserFail;
                }
                else if (p._event != null)
                {
                    if (p._event.LastVisitSequence1 == p._event.LastVisitSequence2)
                    {
                        erro = EventErrorEnum.VisitEvent_AlreadyCheck;
                    }
                    else
                    {
                        EventVisitModel eventv = EventVisitSyncer.getEvent(eventId);
                        if (eventv == null)
                        {
                            erro = EventErrorEnum.VisitEvent_Unknown;
                            goto Result;
                        }

                        if (eventv.EventIsEnabled())
                        {
                            VisitItem chI = eventv.getReward(p._event.LastVisitSequence2, type);
                            if (chI != null)
                            {
                                GoodItem good = ShopManager.getGood(chI.good_id);
                                if (good != null)
                                {
                                    p._event.NextVisitDate = int.Parse(DateTime.Now.AddDays(1).ToString("yyMMdd"));
                                    ComDiv.updateDB("player_events", "player_id", p.player_id, new string[] { "next_visit_date", "last_visit_sequence2" }, p._event.NextVisitDate, ++p._event.LastVisitSequence2);

                                    _client.SendPacket(new INVENTORY_ITEM_CREATE_PAK(1, p, new ItemsModel(good._item._id, good._item._category, good._item._name, good._item._equip, (uint)chI.count)));
                                }
                                else
                                {
                                    erro = EventErrorEnum.VisitEvent_NotEnough;
                                }
                            }
                            else
                            {
                                erro = EventErrorEnum.VisitEvent_Unknown;
                            }
                        }
                        else
                        {
                            erro = EventErrorEnum.VisitEvent_WrongVersion;
                        }
                    }
                }
                else
                {
                    erro = EventErrorEnum.VisitEvent_Unknown;
                }
Result:
                _client.SendPacket(new EVENT_VISIT_REWARD_PAK(erro));
            }
            catch (Exception ex)
            {
                SaveLog.fatal(ex.ToString());
                Printf.b_danger("[EVENT_VISIT_REWARD_REC.run] Erro fatal!");
            }
        }
Ejemplo n.º 10
0
 public override void run()
 {
     try
     {
         if (this._client == null)
         {
             return;
         }
         Account player = this._client._player;
         if (player == null || string.IsNullOrEmpty(player.player_name))
         {
             this.erro = EventErrorEnum.VisitEvent_UserFail;
         }
         else if (player._event != null)
         {
             DateTime dateTime = DateTime.Now;
             int      num1     = int.Parse(dateTime.ToString("yyMMdd"));
             if (player._event.NextVisitDate <= num1)
             {
                 this.eventv = EventVisitSyncer.getEvent(this.eventId);
                 if (this.eventv == null)
                 {
                     this.erro = EventErrorEnum.VisitEvent_Unknown;
                 }
                 else if (this.eventv.EventIsEnabled())
                 {
                     PlayerEvent playerEvent = player._event;
                     dateTime = DateTime.Now;
                     dateTime = dateTime.AddDays(1.0);
                     int num2 = int.Parse(dateTime.ToString("yyMMdd"));
                     playerEvent.NextVisitDate = num2;
                     ComDiv.updateDB("player_events", "player_id", (object)player.player_id, new string[2]
                     {
                         "next_visit_date",
                         "last_visit_sequence1"
                     }, (object)player._event.NextVisitDate, (object)++player._event.LastVisitSequence1);
                     bool flag = false;
                     try
                     {
                         flag = this.eventv.box[player._event.LastVisitSequence2].reward1.IsReward;
                     }
                     catch
                     {
                     }
                     if (!flag)
                     {
                         ComDiv.updateDB("player_events", "last_visit_sequence2", (object)++player._event.LastVisitSequence2, "player_id", (object)player.player_id);
                     }
                 }
                 else
                 {
                     this.erro = EventErrorEnum.VisitEvent_WrongVersion;
                 }
             }
             else
             {
                 this.erro = EventErrorEnum.VisitEvent_AlreadyCheck;
             }
         }
         else
         {
             this.erro = EventErrorEnum.VisitEvent_Unknown;
         }
         this._client.SendPacket((SendPacket) new EVENT_VISIT_CONFIRM_PAK(this.erro, this.eventv, player._event));
     }
     catch (Exception ex)
     {
         Logger.info("EVENT_VERIFICATION_CHECK_REC] " + ex.ToString());
     }
 }
Ejemplo n.º 11
0
 public override void RunImplement()
 {
     try
     {
         Account player = client.SessionPlayer;
         if (player == null || player.nickname.Length == 0 || player.checkEventVisitReward || type > 1)
         {
             client.SendCompletePacket(PackageDataManager.EVENT_VISIT_REWARD_ERROR_USERFAIL_PAK);
         }
         else if (player.events != null)
         {
             if (player.events.LastVisitSequence1 == player.events.LastVisitSequence2)
             {
                 client.SendCompletePacket(PackageDataManager.EVENT_VISIT_REWARD_ERROR_ALREADYCHECK_PAK);
             }
             else
             {
                 EventVisitModel eventv = EventVisitSyncer.GetEvent(eventId);
                 if (eventv == null)
                 {
                     client.SendCompletePacket(PackageDataManager.EVENT_VISIT_REWARD_ERROR_UNKNOWN_PAK);
                     return;
                 }
                 if (eventv.EventIsEnabled())
                 {
                     VisitItem chI = eventv.GetReward(player.events.LastVisitSequence2, type);
                     if (chI != null)
                     {
                         GoodItem good = ShopManager.GetGood(chI.goodId);
                         if (good != null)
                         {
                             player.events.NextVisitDate = int.Parse(DateTime.Now.AddDays(1).ToString("yyMMdd"));
                             if (player.ExecuteQuery($"UPDATE player_events SET next_visit_date='{player.events.NextVisitDate}', last_visit_sequence2='{player.events.LastVisitSequence2++}' WHERE player_id='{player.playerId}'"))
                             {
                                 client.SendPacket(new PROTOCOL_INVENTORY_ITEM_CREATE_ACK(1, player, new ItemsModel(good.item.id, good.item.category, good.item.name, good.item.equip, chI.count)));
                                 client.SendCompletePacket(PackageDataManager.EVENT_VISIT_REWARD_SUCCESS_PAK);
                             }
                             else
                             {
                                 client.SendCompletePacket(PackageDataManager.EVENT_VISIT_REWARD_ERROR_UNKNOWN_PAK);
                             }
                         }
                         else
                         {
                             client.SendCompletePacket(PackageDataManager.EVENT_VISIT_REWARD_ERROR_NOTENOUGH_PAK);
                         }
                     }
                     else
                     {
                         client.SendCompletePacket(PackageDataManager.EVENT_VISIT_REWARD_ERROR_UNKNOWN_PAK);
                     }
                 }
                 else
                 {
                     client.SendCompletePacket(PackageDataManager.EVENT_VISIT_REWARD_ERROR_WRONGVERSION_PAK);
                 }
             }
             player.checkEventVisitReward = true;
         }
         else
         {
             client.SendCompletePacket(PackageDataManager.EVENT_VISIT_REWARD_ERROR_UNKNOWN_PAK);
         }
     }
     catch (Exception ex)
     {
         PacketLog(ex);
     }
 }
Ejemplo n.º 12
0
        public override void Write()
        {
            WriteH(2566);
            WriteD(error);
            if (error != 0)
            {
                return;
            }
            EventVisitModel eventVisit = EventVisitSyncer.GetRunningEvent();

            WriteC(player.age);
            WriteS(player.nickname, 33);
            WriteD(player.exp);
            WriteD(player.rankId);
            WriteD(player.rankId);
            WriteD(player.gold);
            WriteD(player.cash);
            WriteD(clan.id);
            WriteD((int)player.clanAuthority);
            WriteD(player.nickname == "" ? 1 : 0);
            WriteD(0);
            WriteC(player.pccafe);
            WriteC(player.tourneyLevel);
            WriteC(player.nickcolor);
            WriteS(clan.name, 17);
            WriteC(clan.rank);
            WriteC(clan.GetClanUnit());
            WriteD(clan.logo);
            WriteC(clan.nameColor);
            WriteD(10000);
            WriteC(0);
            WriteD(0);
            WriteD(player.lastRankUpDate); //109 BYTES
            WriteD(player.statistics.fights);
            WriteD(player.statistics.fightsWin);
            WriteD(player.statistics.fightsLost);
            WriteD(player.statistics.fightsDraw);
            WriteD(player.statistics.kills);
            WriteD(player.statistics.headshots);
            WriteD(player.statistics.deaths);
            WriteD(player.statistics.totalfights);
            WriteD(player.statistics.totalkills);
            WriteD(player.statistics.escapes);
            WriteD(player.statistics.fights);
            WriteD(player.statistics.fightsWin);
            WriteD(player.statistics.fightsLost);
            WriteD(player.statistics.fightsDraw);
            WriteD(player.statistics.kills);
            WriteD(player.statistics.headshots);
            WriteD(player.statistics.deaths);
            WriteD(player.statistics.totalfights);
            WriteD(player.statistics.totalkills);
            WriteD(player.statistics.escapes);
            WriteD(player.equipments.red);
            WriteD(player.equipments.blue);
            WriteD(player.equipments.helmet);
            WriteD(player.equipments.beret);
            WriteD(player.equipments.dino);
            WriteD(player.equipments.primary);
            WriteD(player.equipments.secondary);
            WriteD(player.equipments.melee);
            WriteD(player.equipments.grenade);
            WriteD(player.equipments.special);
            WriteH(0); //Auxiliar de cor da mira
            WriteD(player.bonus.fakeRank);
            WriteD(player.bonus.fakeRank);
            WriteS(player.bonus.fakeNick, 33);
            WriteH(player.bonus.sightColor);
            WriteC(player.country);
            CheckGameEvents(eventVisit);
            if (Settings.ClientVersion == "1.15.23" || Settings.ClientVersion == "1.15.37")
            {
                GetInventoryInfo();
                WriteC(Settings.InventoryActive);
                WriteD(charas.Count);
                WriteD(weapons.Count);
                WriteD(cupons.Count);
                WriteD(0);
                for (int i = 0; i < charas.Count; i++)
                {
                    ItemsModel item = charas[i];
                    WriteQ(item.objectId);
                    WriteD(item.id);
                    WriteC(item.equip);
                    WriteD(item.count);
                }
                for (int i = 0; i < weapons.Count; i++)
                {
                    ItemsModel item = weapons[i];
                    WriteQ(item.objectId);
                    WriteD(item.id);
                    WriteC(item.equip);
                    WriteD(item.count);
                }
                for (int i = 0; i < cupons.Count; i++)
                {
                    ItemsModel item = cupons[i];
                    WriteQ(item.objectId);
                    WriteD(item.id);
                    WriteC(item.equip);
                    WriteD(item.count);
                }
            }
            WriteC(Settings.OutpostActive);
            WriteD(player.brooch);
            WriteD(player.insignia);
            WriteD(player.medal);
            WriteD(player.blueorder);
            WriteC(player.missions.actualMission);
            WriteC(player.missions.card1);
            WriteC(player.missions.card2);
            WriteC(player.missions.card3);
            WriteC(player.missions.card4);
            WriteB(player.GetCardFlags(player.missions.mission1, player.missions.list1));
            WriteB(player.GetCardFlags(player.missions.mission2, player.missions.list2));
            WriteB(player.GetCardFlags(player.missions.mission3, player.missions.list3));
            WriteB(player.GetCardFlags(player.missions.mission4, player.missions.list4));
            WriteC(player.missions.mission1);
            WriteC(player.missions.mission2);
            WriteC(player.missions.mission3);
            WriteC(player.missions.mission4);
            WriteB(player.missions.list1);
            WriteB(player.missions.list2);
            WriteB(player.missions.list3);
            WriteB(player.missions.list4);
            WriteQ(player.titles.Flags);
            WriteC(player.titles.Equiped1);
            WriteC(player.titles.Equiped2);
            WriteC(player.titles.Equiped3);
            WriteD(player.titles.Slots);
            WriteD(44); //Tutorial
            WriteD(1);  //Deathmatch
            WriteD(25); //Destruction
            WriteD(35); //Sabotage
            WriteD(11); //Supression
            WriteD(39); //Defense
            WriteD(1);  //Challenge
            WriteD(40); //Dinosaur
            WriteD(1);  //Sniper
            WriteD(1);  //Shotgun
            WriteD(0);  //HeadHunter
            WriteD(0);  //Knuckle
            WriteD(54); //CrossCounter
            WriteD(1);  //Chaos
            if (Settings.ClientVersion == "1.15.38" || Settings.ClientVersion == "1.15.39" || Settings.ClientVersion == "1.15.41" || Settings.ClientVersion == "1.15.42")
            {
                WriteD(1);                        //TheifMode
            }
            WriteC((byte)MapsXML.ModeList.Count); //124 maps ver 42

            WriteC(4);                            //(Flag pages | 4 bytes)
            WriteD(MapsXML.maps1);
            WriteD(MapsXML.maps2);
            WriteD(MapsXML.maps3);
            WriteD(MapsXML.maps4);
            WriteB(MapsXML.ModeBytes);
            WriteB(MapsXML.TagBytes);

            WriteC(Settings.MissionActive); //Pages Count
            WriteD(MissionsXML.missionPage1);
            WriteD(0);                      //Multiplicado por 100?
            WriteD(0);                      //Multiplicado por 100?
            WriteC(0);
            WriteH(20);                     //length de algo.
            //WriteB(new byte[20] { 0x70, 0x0C, 0x94, 0x2D, 0x48, 0x08, 0xDD, 0x1E, 0xB0, 0xAB, 0x1A, 0x00, 0x99, 0x7B, 0x42, 0x00, 0x70, 0x0C, 0x94, 0x2D });
            WriteB(new byte[20]);
            WriteD(player.IsGM() || player.HaveAcessLevel());
            WriteD(xmas);
            WriteC(1); //Repair?

            WriteVisitEvent(eventVisit);

            //WriteD(int.Parse(DateTime.Now.ToString("yyMMddHHmm"))); //DataNow By Server

            //WriteS("10.120.1.44", 256);
            //WriteH(0); //8085
            //WriteH(0);

            //WriteC(0); //Presentes
            //WriteH(1); //1
            //WriteC(0);

            //WriteC(1);
            //WriteC(7); //6

            //WriteC(4); //Vip
            //WriteC(1); //Posição do item VIP na loja
            //WriteC(1);
            //WriteC(2);
            //WriteC(5);
            //WriteC(3);
            //WriteC(6);

            WriteD(uint.Parse(DateTime.Now.ToString("yyMMddHHmm"))); //DataNow By Server
            //writeB(new byte[256]);
            WriteS("10.120.1.44", 256);                              //?
            WriteH(8085);                                            //8085

            WriteC(1);                                               //gift system

            WriteH(0);
            WriteH(1);
            WriteC(0);

            WriteH(1);
            WriteC(1);
            WriteC(6);
            WriteH(4);
            WriteC(2);
            WriteC(1);
            WriteC(5);
            WriteC(3);

            charas  = null;
            weapons = null;
            cupons  = null;
        }
Ejemplo n.º 13
0
        public override void run()
        {
            try
            {
                if (_client == null)
                {
                    return;
                }
                Account p = _client._player;
                if (p == null || string.IsNullOrEmpty(p.player_name))
                {
                    erro = EventErrorEnum.VisitEvent_UserFail;
                }
                else if (p._event != null)
                {
                    int dateNow = int.Parse(DateTime.Now.ToString("yyMMdd"));
                    if (p._event.NextVisitDate <= dateNow)
                    {
                        eventv = EventVisitSyncer.getEvent(eventId);
                        if (eventv == null)
                        {
                            erro = EventErrorEnum.VisitEvent_Unknown;
                            goto Result;
                        }

                        if (eventv.EventIsEnabled())
                        {
                            p._event.NextVisitDate = int.Parse(DateTime.Now.AddDays(1).ToString("yyMMdd"));
                            //ComDiv.updateDB("player_events", "player_id", p.player_id, new string[] { "next_visit_date", "last_visit_sequence1" }, p._event.NextVisitDate, ++p._event.LastVisitSequence1);
                            bool IsReward = false;
                            try
                            {
                                IsReward = eventv.box[p._event.LastVisitSequence2].reward1.IsReward;
                            }
                            catch { }
                            //if (!IsReward)
                            //    ComDiv.updateDB("player_events", "last_visit_sequence2", ++p._event.LastVisitSequence2, "player_id", p.player_id);
                        }
                        else
                        {
                            erro = EventErrorEnum.VisitEvent_WrongVersion;
                        }
                    }
                    else
                    {
                        erro = EventErrorEnum.VisitEvent_AlreadyCheck;
                    }
                }
                else
                {
                    erro = EventErrorEnum.VisitEvent_Unknown;
                }
Result:
                _client.SendPacket(new EVENT_VISIT_CONFIRM_PAK(erro, eventv, p._event));
            }
            catch (Exception ex)
            {
                SaveLog.fatal(ex.ToString());
                Printf.b_danger("[EVENT_VERIFICATION_CHECK_REC.run] Erro fatal!");
            }
        }
        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);
        }
        public override void write()
        {
            writeH(2566);
            writeD(_erro);
            if (_erro != 0)
            {
                return;
            }
            EventVisitModel evVisit = EventVisitSyncer.getRunningEvent();

            writeC(0);
            writeS(c.player_name, 33);
            writeD(c._exp);
            writeD(c._rank);
            writeD(c._rank);
            writeD(c._gp);
            writeD(c._money);
            writeD(clan._id);
            writeD(c.clanAccess);
            writeQ(0);
            writeC((byte)c.pc_cafe);
            writeC((byte)c.tourneyLevel);
            writeC((byte)c.name_color); // 0-9
            writeS(clan._name, 17);
            writeC((byte)clan._rank);
            writeC((byte)clan.getClanUnit());
            writeD(clan._logo);
            writeC((byte)clan._name_color);

            writeD(10000);
            writeC(0);
            writeD(0);
            writeD(0); // Subistitudo do LastRankUpDate

            writeD(c._statistic.fights);
            writeD(c._statistic.fights_win);
            writeD(c._statistic.fights_lost);
            writeD(c._statistic.fights_draw);
            writeD(c._statistic.kills_count);
            writeD(c._statistic.headshots_count);
            writeD(c._statistic.deaths_count);
            writeD(c._statistic.totalfights_count);
            writeD(c._statistic.totalkills_count);
            writeD(c._statistic.escapes);
            writeD(c._statistic.fights);
            writeD(c._statistic.fights_win);
            writeD(c._statistic.fights_lost);
            writeD(c._statistic.fights_draw);
            writeD(c._statistic.kills_count);
            writeD(c._statistic.headshots_count);
            writeD(c._statistic.deaths_count);
            writeD(c._statistic.totalfights_count);
            writeD(c._statistic.totalkills_count);
            writeD(c._statistic.escapes);
            writeD(c._equip._red);
            writeD(c._equip._blue);
            writeD(c._equip._helmet);
            writeD(c._equip._beret);
            writeD(c._equip._dino);
            writeD(c._equip._primary);
            writeD(c._equip._secondary);
            writeD(c._equip._melee);
            writeD(c._equip._grenade);
            writeD(c._equip._special);
            writeH(0);
            writeD(c._bonus.fakeRank);
            writeD(c._bonus.fakeRank);
            writeS(c._bonus.fakeNick, 33);
            writeH((short)c._bonus.sightColor); // crosshair
            writeC(31);                         //pais?
            CheckGameEvents(evVisit);
            if (ServerConfig.ClientVersion == "1.15.37")
            {
                writeC(1); //inventário?
                writeD(charas.Count);
                writeD(weapons.Count);
                writeD(cupons.Count);
                writeD(0);
                for (int i = 0; i < charas.Count; i++)
                {
                    ItemsModel item = charas[i];
                    writeQ(item._objId);
                    writeD(item._id);
                    writeC((byte)item._equip);
                    writeD(item._count);
                }
                for (int i = 0; i < weapons.Count; i++)
                {
                    ItemsModel item = weapons[i];
                    writeQ(item._objId);
                    writeD(item._id);
                    writeC((byte)item._equip);
                    writeD(item._count);
                }
                for (int i = 0; i < cupons.Count; i++)
                {
                    ItemsModel item = cupons[i];
                    writeQ(item._objId);
                    writeD(item._id);
                    writeC((byte)item._equip);
                    writeD(item._count);
                }
            }
            writeC(ConfigGA.Outpost);
            writeD(c.brooch);
            writeD(c.insignia);
            writeD(c.medal);
            writeD(c.blue_order);
            writeC((byte)c._mission.actualMission);
            writeC((byte)c._mission.card1);
            writeC((byte)c._mission.card2);
            writeC((byte)c._mission.card3);
            writeC((byte)c._mission.card4);
            writeB(ComDiv.getCardFlags(c._mission.mission1, c._mission.list1));
            writeB(ComDiv.getCardFlags(c._mission.mission2, c._mission.list2));
            writeB(ComDiv.getCardFlags(c._mission.mission3, c._mission.list3));
            writeB(ComDiv.getCardFlags(c._mission.mission4, c._mission.list4));
            writeC((byte)c._mission.mission1);
            writeC((byte)c._mission.mission2);
            writeC((byte)c._mission.mission3);
            writeC((byte)c._mission.mission4);
            writeB(c._mission.list1);
            writeB(c._mission.list2);
            writeB(c._mission.list3);
            writeB(c._mission.list4);
            writeQ(c._titles.Flags);
            writeC((byte)c._titles.Equiped1);
            writeC((byte)c._titles.Equiped2);
            writeC((byte)c._titles.Equiped3);
            writeD(c._titles.Slots);
            writeD(ConfigMaps.Tutorial);
            writeD(ConfigMaps.Deathmatch);
            writeD(ConfigMaps.Destruction);
            writeD(ConfigMaps.Sabotage);
            writeD(ConfigMaps.Supression);
            writeD(ConfigMaps.Defense);
            writeD(ConfigMaps.Challenge);
            writeD(ConfigMaps.Dinosaur);
            writeD(ConfigMaps.Sniper);
            writeD(ConfigMaps.Shotgun);
            writeD(ConfigMaps.HeadHunter);
            writeD(ConfigMaps.Knuckle);
            writeD(ConfigMaps.CrossCounter);
            writeD(ConfigMaps.Chaos);
            if (ServerConfig.ClientVersion == "1.15.38" || ServerConfig.ClientVersion == "1.15.39" || ServerConfig.ClientVersion == "1.15.41" || ServerConfig.ClientVersion == "1.15.42")
            {
                writeD(ConfigMaps.TheifMode);
            }

            writeC((byte)MapsXML.ModeList.Count); //124 maps ver 42

            writeC(4);                            //(Flag pages | 4 bytes)
            writeD(MapsXML.maps1);
            writeD(MapsXML.maps2);
            writeD(MapsXML.maps3);
            writeD(MapsXML.maps4);
            foreach (ushort mode in MapsXML.ModeList)
            {
                writeH(mode);// 2 byts por cartão
            }
            writeB(MapsXML.TagList.ToArray());

            writeC(ServerConfig.missions); //Pages Count
            writeD(MissionsXML._missionPage1);
            writeD(0);                     //Multiplicado por 100?
            writeD(0);                     //Multiplicado por 100?
            writeC(0);
            writeH(20);                    //length de algo.
            writeB(new byte[20] {
                0x70, 0x0C, 0x94, 0x2D, 0x48, 0x08, 0xDD, 0x1E, 0xB0, 0xAB, 0x1A, 0x00, 0x99, 0x7B, 0x42, 0x00, 0x70, 0x0C, 0x94, 0x2D
            });
            writeD(c.IsGM() || c.HaveAcessLevel());
            writeD(_xmas);
            writeC(1); //Repair?

            WriteVisitEvent(evVisit);

            if (ServerConfig.ClientVersion == "1.15.39" || ServerConfig.ClientVersion == "1.15.41" || ServerConfig.ClientVersion == "1.15.42")
            {
                writeB(new byte[9]);
            }

            writeD(uint.Parse(DateTime.Now.ToString("yyMMddHHmm"))); //DataNow By Server
            //writeB(new byte[256]);
            writeS("10.120.1.44", 256);                              //?
            writeD(8085);                                            //0
            writeC(ServerConfig.GiftSystem);                         //Ativar presentes (0 = Não | 1 = Sim)

            writeH(1);                                               //Lê algo se for positivo, Quantidade sequêncial (1byte)
            writeC(0);
            writeC(1);                                               //1

            writeC(7);                                               //7

            writeC(4);                                               //4 víp 1//Length dos write abaixo
            writeC(1);                                               // vip2 Relevancia da itens tag VIP - 0 - Por Goods | 1 - Topo da lista | 2 - Fim da Lista | 3 - VIP Topo, New Good
            writeC(1);                                               //1 new
            writeC(2);                                               //2 hot
            writeC(5);                                               //5 sale
            writeC(3);                                               //3 event
            writeC(6);                                               //6*/
        }