public void GetXmasReward(Account player) { EventXmasModel eventRunning = EventXmasSyncer.GetRunningEvent(); if (eventRunning != null) { PlayerEvent playerEvents = player.events; int date = int.Parse(DateTime.Now.ToString("yyMMddHHmm")); if (playerEvents != null && !(playerEvents.LastXmasRewardDate > eventRunning.startDate && playerEvents.LastXmasRewardDate <= eventRunning.endDate) && player.ExecuteQuery($"UPDATE player_events SET last_xmas_reward_date='{(int)date}' WHERE player_id='{player.playerId}'")) { playerEvents.LastXmasRewardDate = date; player.SendPacket(new PROTOCOL_INVENTORY_ITEM_CREATE_ACK(1, player, new ItemsModel(702001024, 1, "Alcaçuz (Evento XMAS)", 1, 100))); } } }
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; } } } }