private async Task <bool> GetTrophyList() { var trophyManager = new TrophyManager(); TrophyCollection = new InfiniteScrollingCollection { UserAccountEntity = App.UserAccountEntity, TrophyList = new ObservableCollection <TrophyEntity.TrophyTitle>(), Offset = 64 }; var items = await trophyManager.GetTrophyList(App.SelectedUser.OnlineId, 0, App.UserAccountEntity); if (items == null) { return(false); } foreach (TrophyEntity.TrophyTitle item in items.TrophyTitles) { TrophyCollection.TrophyList.Add(item); } if (!items.TrophyTitles.Any()) { NoTrophyTextBlock.Visibility = Visibility.Visible; TrophyHeaderGrid.Visibility = Visibility.Collapsed; } TrophyList.ItemRealized += trophyList_ItemRealized; TrophyList.DataContext = TrophyCollection; ComparedUserNameBlock.Text = App.UserAccountEntity.GetUserEntity().OnlineId.Equals(App.SelectedUser.OnlineId) ? string.Empty : App.SelectedUser.OnlineId; FromUserNameBlock.Text = App.UserAccountEntity.GetUserEntity().OnlineId; return(true); }
public void SetAchievement(int boxId, string type, string trophySet) { List <IFieldActor <Player> > players = Field.State.Players.Values.ToList(); if (boxId != 0) { MapTriggerBox box = MapEntityStorage.GetTriggerBox(Field.MapId, boxId); List <IFieldActor <Player> > boxedPlayers = new(); foreach (IFieldActor <Player> player in players) { if (FieldManager.IsPlayerInBox(box, player)) { boxedPlayers.Add(player); } } players = boxedPlayers; } foreach (IFieldObject <Player> player in players) { if (type == "trigger") { TrophyManager.OnTrigger(player.Value, trophySet); } } }
public bool LevelUp() { if (!ExpMetadataStorage.LevelExist((short)(Level + 1))) { return(false); } Level++; Player.Stats.AddBaseStats(Player); Player.FieldPlayer.RecoverHp(FieldPlayer.Stats[StatId.Hp].Bonus); Session.FieldManager.BroadcastPacket(RevivalConfirmPacket.Send(FieldPlayer.ObjectId, 0)); Session.FieldManager.BroadcastPacket(LevelUpPacket.LevelUp(FieldPlayer.ObjectId, Level)); Session.FieldManager.BroadcastPacket(FieldObjectPacket.UpdateCharacterLevel(Player)); Session.FieldManager.BroadcastPacket(JobPacket.SendJob(FieldPlayer)); Session.Send(StatPacket.SetStats(FieldPlayer)); Session.FieldManager.BroadcastPacket(StatPacket.UpdateFieldStats(FieldPlayer), Session); Session.Send(KeyTablePacket.SendFullOptions(Player.GameOptions)); TrophyManager.OnLevelUp(Player); QuestHelper.GetNewQuests(Player); return(true); }
public async Task <bool> LoadTrophies(string username) { Offset = Offset + MaxCount; IsLoading = true; var trophyManager = new TrophyManager(); TrophyEntity trophyList = await trophyManager.GetTrophyList(username, Offset, UserAccountEntity); if (trophyList == null) { //HasMoreItems = false; return(false); } foreach (TrophyEntity.TrophyTitle trophy in trophyList.TrophyTitles) { Add(trophy); } if (trophyList.TrophyTitles.Any()) { HasMoreItems = true; MaxCount += 64; } else { HasMoreItems = false; } IsLoading = false; return(true); }
void Start() { DontDestroyOnLoad(transform.gameObject); this.Client = GameObject.Find("Network").GetComponent <Client>(); this.Client.MessageScoreUpdateEvent += Client_MessageScoreUpdateEvent; this.Client.MessageBuildingConstructionEvent += Client_MessageBuildingConstructionEvent; this.Client.MessageBuildingDestructionEvent += Client_MessageBuildingDestructionEvent; //this.Client.MessageTrophyWonEvent += Client_MessageTrophyWonEvent; this.Client.MessageChallengeFinalSuccessRateEvent += Client_MessageChallengeFinalSuccessRateEvent; this.TrophyManager = GameObject.Find("Trophies").GetComponent <TrophyManager>(); this.TrophyManager.TrophyObtained += TrophyManager_TrophyObtained; this.ScoreCount = 0; this.filePath = ConstantsLoader.getConstant(TypeConstant.fileScores); this.scores = new List <Tuple <int, string, int, int, int, float> >(); this.ChallengeSuccessRate = new List <float>(); for (int i = 0; i < 4; i++) { this.ChallengeSuccessRate.Add(0); } loadPreviousScores(); this.BuildingCount = 0; this.MedalCount = 0; }
// Use this for initialization void Start() { GameObject ogo = GameObject.Find ("GUI Text"); gui = ogo.GetComponent<GUITextBehaviour> (); ogo = GameObject.Find ("Deamon"); trophyManager = ogo.GetComponent<TrophyManager> (); }
public override void Hide() { base.Hide(); if (TrophyManager.GetInstance().alertTrophyDatas.Count != 0) { LayerManager.GetInstance().AddPopUpView <TrophyAlertBar>(TrophyManager.GetInstance().alertTrophyDatas.Dequeue()); } }
public PSNService() { _authManager = new AuthenticationManager(); _recentActivityManager = new RecentActivityManager(); _friendManager = new FriendManager(); _messageManager = new MessageManager(); _userManager = new UserManager(); _trophyManager = new TrophyManager(); _trophyDetailManager = new TrophyDetailManager(); }
void Awake() { // hence we Should only have one shop instance at all time if (instance != null) { Destroy(instance); } instance = this; }
public override void Handle(GameSession session, PacketReader packet) { packet.ReadInt(); // ? // Liftable: 00 00 00 00 00 // SendBreakable // Self Player player = session.Player; Account account = player.Account; session.EnterField(player); session.Send(StatPacket.SetStats(player.FieldPlayer)); session.Send(StatPointPacket.WriteTotalStatPoints(player)); session.Send(StatPointPacket.WriteTotalStatPoints(player)); // This packet is sent twice on GMS, not sure why session.Send(StatPointPacket.WriteStatPointDistribution(player)); if (account.IsVip()) { session.Send(BuffPacket.SendBuff(0, new(100000014, player.FieldPlayer.ObjectId, player.FieldPlayer.ObjectId, 1, (int)account.VIPExpiration, 1))); session.Send(PremiumClubPacket.ActivatePremium(player.FieldPlayer, account.VIPExpiration)); } session.Send(EmotePacket.LoadEmotes(player)); session.Send(ChatStickerPacket.LoadChatSticker(player)); session.Send(HomeCommandPacket.LoadHome(player)); session.Send(ResponseCubePacket.DecorationScore(account.Home)); session.Send(ResponseCubePacket.LoadHome(player.FieldPlayer.ObjectId, player.Account.Home)); session.Send(ResponseCubePacket.ReturnMap(player.ReturnMapId)); session.Send(LapenshardPacket.Load(player.Inventory.LapenshardStorage)); IEnumerable <Cube> cubes = session.FieldManager.State.Cubes.Values .Where(x => x.Value.PlotNumber == 1 && x.Value.Item.HousingCategory is ItemHousingCategory.Farming or ItemHousingCategory.Ranching) .Select(x => x.Value); foreach (Cube cube in cubes) { session.Send(FunctionCubePacket.UpdateFunctionCube(cube.CoordF.ToByte(), 2, 1)); } if (player.Party is not null) { session.Send(PartyPacket.UpdatePlayer(player)); } session.Send(KeyTablePacket.SendHotbars(player.GameOptions)); List <GameEvent> gameEvents = DatabaseManager.Events.FindAll(); session.Send(GameEventPacket.Load(gameEvents)); TrophyManager.OnMapEntered(player, player.MapId); }
public async Task <bool> LoadTrophies(string username) { Offset = Offset + MaxCount; IsLoading = true; await Shell.Instance.ViewModel.UpdateTokens(); var trophyManager = new TrophyManager(); var trophyResultList = await trophyManager.GetTrophyList(username, CompareUsername, Offset, Shell.Instance.ViewModel.CurrentTokens, Shell.Instance.ViewModel.CurrentUser.Region, Shell.Instance.ViewModel.CurrentUser.Language); await AccountAuthHelpers.UpdateTokens(Shell.Instance.ViewModel.CurrentUser, trophyResultList); var result = await ResultChecker.CheckSuccess(trophyResultList, false); if (!result) { HasMoreItems = false; if (Count <= 0) { IsEmpty = true; } IsLoading = false; return(false); } var trophyList = JsonConvert.DeserializeObject <TrophyDetailResponse>(trophyResultList.ResultJson); if (trophyList == null) { //HasMoreItems = false; IsEmpty = true; IsLoading = false; return(false); } foreach (var trophy in trophyList.TrophyTitles) { Add(trophy); } if (trophyList.TrophyTitles.Any()) { HasMoreItems = true; MaxCount += 64; } else { if (Count <= 0) { IsEmpty = true; } HasMoreItems = false; } IsLoading = false; return(true); }
private void Start() { if (Instance != null) { Destroy(gameObject); //Debug.Log("Duplicate Deleted:: SceneLoader - There can only be one. Ignore this if the same scene was loaded."); } else { _instance = this; DontDestroyOnLoad(gameObject); } }
private static void HandleAcceptQuest(GameSession session, PacketReader packet) { int questId = packet.ReadInt(); int objectId = packet.ReadInt(); if (!session.Player.QuestData.TryGetValue(questId, out QuestStatus questStatus)) { return; } questStatus.State = QuestState.Started; questStatus.StartTimestamp = TimeInfo.Now(); DatabaseManager.Quests.Update(questStatus); session.Send(QuestPacket.AcceptQuest(questId)); TrophyManager.OnAcceptQuest(session.Player, questId); }
public Game(string team) { this.TeamName = team; this.State = GameState.Sleeping; this.Trophies = new TrophyManager(); this.Scores = new ScoreManager(); this.Sounds = new SoundManager(this); this.ActionHistory = new ActionHistoryManager(); this.ResourceManager = new ResourceManager(); this.ActionManager = new ActionManager(); this.Scores.saveScores(); //Managing time================================================================================================= //this.Timer = new Timer(this, 0, 15, 0); this.Timer = new Timer(this, 0, 0, 15); }
private static void HandleInviteResponse(GameSession session, PacketReader packet) { long guildId = packet.ReadLong(); string guildName = packet.ReadUnicodeString(); packet.ReadShort(); string inviterName = packet.ReadUnicodeString(); string inviteeName = packet.ReadUnicodeString(); byte response = packet.ReadByte(); // 01 accept Guild guild = GameServer.GuildManager.GetGuildById(guildId); if (guild == null) { return; } Player inviter = GameServer.PlayerManager.GetPlayerByName(inviterName); if (inviter == null) { return; } if (response == 00) { inviter.Session.Send(GuildPacket.InviteNotification(inviteeName, 256)); session.Send(GuildPacket.InviteResponseConfirm(inviter, session.Player, guild, response)); return; } guild.AddMember(session.Player); GuildMember member = guild.Members.FirstOrDefault(x => x.Player == session.Player); if (member == null) { return; } inviter.Session.Send(GuildPacket.InviteNotification(inviteeName, response)); session.Send(GuildPacket.InviteResponseConfirm(inviter, session.Player, guild, response)); session.FieldManager.BroadcastPacket(GuildPacket.UpdateGuildTag2(session.Player, guildName)); guild.BroadcastPacketGuild(GuildPacket.MemberBroadcastJoinNotice(member, inviterName, true)); guild.BroadcastPacketGuild(GuildPacket.MemberJoin(session.Player), session); session.Send(GuildPacket.UpdateGuild(guild)); TrophyManager.OnGuildJoin(session.Player); }
public bool LevelUp() { if (!ExpMetadataStorage.LevelExist((short)(Level + 1))) { return(false); } Level++; Player.Stats.AddBaseStats(Player); Player.FieldPlayer.RecoverHp(FieldPlayer.Stats[StatAttribute.Hp].Bonus); Player.UpdateSocials(); TrophyManager.OnLevelUp(Player); QuestHelper.GetNewQuests(Player); return(true); }
private static void HandleCreate(GameSession session, PacketReader packet) { string guildName = packet.ReadUnicodeString(); if (session.Player.Guild != null) { return; } if (!session.Player.Wallet.Meso.Modify(-2000)) { session.Send(GuildPacket.ErrorNotice((byte)GuildErrorNotice.NotEnoughMesos)); return; } if (DatabaseManager.Guilds.NameExists(guildName)) { session.Send(GuildPacket.ErrorNotice((byte)GuildErrorNotice.GuildWithSameNameExists)); return; } Guild newGuild = new(guildName, session.Player); GameServer.GuildManager.AddGuild(newGuild); session.FieldManager.BroadcastPacket(GuildPacket.UpdateGuildTag2(session.Player, guildName)); session.Send(GuildPacket.Create(guildName)); string inviter = ""; // nobody because nobody invited the guild leader GuildMember member = newGuild.Members.FirstOrDefault(x => x.Player == session.Player); session.Send(GuildPacket.UpdateGuild(newGuild)); session.Send(GuildPacket.MemberBroadcastJoinNotice(member, inviter, false)); session.Send(GuildPacket.MemberJoin(session.Player)); // Remove any applications foreach (GuildApplication application in session.Player.GuildApplications) { Guild guild = GameServer.GuildManager.GetGuildById(application.GuildId); application.Remove(session.Player, guild); } DatabaseManager.Characters.Update(session.Player); TrophyManager.OnGuildJoin(session.Player); }
public bool LevelUp() { if (!ExpMetadataStorage.LevelExist((short)(Level + 1))) { return(false); } Level++; TrophyManager.OnLevelUp(Player); Player.Stats.AddBaseStats(Player); Player.FieldPlayer.RecoverHp(FieldPlayer.Stats[StatId.Hp].Bonus); Session.FieldManager.BroadcastPacket(ExperiencePacket.LevelUp(FieldPlayer.ObjectId, Level)); Session.Send(StatPacket.SetStats(FieldPlayer)); QuestHelper.GetNewQuests(Player); return(true); }
public bool LevelUp() { if (!ExpMetadataStorage.LevelExist((short)(Level + 1))) { return(false); } Level++; TrophyManager.OnLevelUp(Player); Player.StatPointDistribution.AddTotalStatPoints(5); Player.Session.FieldManager.BroadcastPacket(ExperiencePacket.LevelUp(Player.FieldPlayer, Level)); // TODO: Gain max HP Player.FieldPlayer.RecoverHp(Player.FieldPlayer.Stats[StatId.Hp].Bonus); Player.Session.Send(StatPointPacket.WriteTotalStatPoints(Player)); QuestHelper.GetNewQuests(Player); return(true); }
public void GainMasteryExp(MasteryType type, long amount) { MasteryExp masteryExp = MasteryExp.FirstOrDefault(x => x.Type == type); if (masteryExp == null || amount <= 0) { return; } // user already has some exp in mastery, so simply update it Session.Send(MasteryPacket.SetExp(type, masteryExp.CurrentExp += amount)); int currLevel = MasteryMetadataStorage.GetGradeFromXP(type, masteryExp.CurrentExp); if (currLevel <= masteryExp.Level) { return; } masteryExp.Level = currLevel; TrophyManager.OnGainMasteryLevel(Player, masteryExp.Type); }
public override void Handle(GameSession session, PacketReader packet) { float distance = packet.ReadFloat(); if (distance > Block.BLOCK_SIZE * 6) { if (session.Player.Mount != null && session.Player.Levels.PrestigeLevel < (int)PrestigePerk.SafeRiding) { session.FieldManager.BroadcastPacket(MountPacket.StopRide(session.Player.FieldPlayer)); } session.Player.FallDamage(); TrophyManager.OnFallDamage(session.Player); } if (session.Player.OnAirMount) { session.Player.OnAirMount = false; } TrophyManager.OnFall(session.Player, distance); }
public void SetAchievement(int boxId, string type, string trophySet) { List <Character> players = Field.State.Players.Values.ToList(); if (boxId != 0) { MapTriggerBox box = MapEntityMetadataStorage.GetTriggerBox(Field.MapId, boxId); if (box is null) { return; } players = players.Where(player => FieldManager.IsPlayerInBox(box, player)).ToList(); } foreach (IFieldObject <Player> player in players) { if (type == "trigger") { TrophyManager.OnTrigger(player.Value, trophySet); } } }
public TrophyController(ITrophyService trophy) { _trophyManager = (TrophyManager)trophy; }
void Start() { DontDestroyOnLoad(transform.gameObject); this.Client = GameObject.Find("Network").GetComponent<Client>(); this.Client.MessageScoreUpdateEvent += Client_MessageScoreUpdateEvent; this.Client.MessageBuildingConstructionEvent += Client_MessageBuildingConstructionEvent; this.Client.MessageBuildingDestructionEvent += Client_MessageBuildingDestructionEvent; //this.Client.MessageTrophyWonEvent += Client_MessageTrophyWonEvent; this.Client.MessageChallengeFinalSuccessRateEvent += Client_MessageChallengeFinalSuccessRateEvent; this.TrophyManager = GameObject.Find("Trophies").GetComponent<TrophyManager>(); this.TrophyManager.TrophyObtained += TrophyManager_TrophyObtained; this.ScoreCount = 0; this.filePath = ConstantsLoader.getConstant(TypeConstant.fileScores); this.scores = new List<Tuple<int, string, int, int, int, float>>(); this.ChallengeSuccessRate = new List<float>(); for(int i = 0; i<4; i++) { this.ChallengeSuccessRate.Add(0); } loadPreviousScores(); this.BuildingCount = 0; this.MedalCount = 0; }
public override void Handle(GameSession session, PacketReader packet) { packet.ReadInt(); // ? // Liftable: 00 00 00 00 00 // SendBreakable // Self Player player = session.Player; Account account = player.Account; session.EnterField(player); session.Send(StatPacket.SetStats(player.FieldPlayer)); session.Send(StatPointPacket.WriteTotalStatPoints(player)); session.Send(StatPointPacket.WriteTotalStatPoints(player)); // This packet is sent twice on GMS, not sure why session.Send(StatPointPacket.WriteStatPointDistribution(player)); session.Send(SkillPointPacket.ExtraSkillPoints(player)); if (player.ActivePet is not null) { player.ActivePet.SetMetadataValues(); Pet pet = session.FieldManager.RequestPet(player.ActivePet, player.FieldPlayer); if (pet is not null) { player.FieldPlayer.ActivePet = pet; session.Send(ResponsePetPacket.LoadPetSettings(pet)); session.Send(NoticePacket.Notice(SystemNotice.PetSummonOn, NoticeType.Chat | NoticeType.FastText)); } } if (account.IsVip()) { session.Send(BuffPacket.SendBuff(0, new(100000014, player.FieldPlayer.ObjectId, player.FieldPlayer.ObjectId, 1, (int)account.VIPExpiration, 1))); session.Send(PremiumClubPacket.ActivatePremium(player.FieldPlayer, account.VIPExpiration)); } session.Send(EmotePacket.LoadEmotes(player)); session.Send(MacroPacket.LoadControls(player.Macros)); session.Send(ChatStickerPacket.LoadChatSticker(player)); session.Send(ResponseCubePacket.DecorationScore(account.Home)); session.Send(ResponseCubePacket.LoadHome(player.FieldPlayer.ObjectId, player.Account.Home)); session.Send(ResponseCubePacket.ReturnMap(player.ReturnMapId)); session.Send(LapenshardPacket.Load(player.Inventory.LapenshardStorage)); IEnumerable <Cube> cubes = session.FieldManager.State.Cubes.Values .Where(x => x.Value.PlotNumber == 1 && x.Value.Item.HousingCategory is ItemHousingCategory.Farming or ItemHousingCategory.Ranching) .Select(x => x.Value); foreach (Cube cube in cubes) { session.Send(FunctionCubePacket.UpdateFunctionCube(cube.CoordF.ToByte(), 2, 1)); } if (player.Party is not null) { session.Send(PartyPacket.UpdatePlayer(player)); } GlobalEvent globalEvent = GameServer.GlobalEventManager.GetCurrentEvent(); if (globalEvent is not null && !MapMetadataStorage.MapIsInstancedOnly(player.MapId)) { session.Send(GlobalPortalPacket.Notice(globalEvent)); } FieldWar fieldWar = GameServer.FieldWarManager.CurrentFieldWar; if (fieldWar is not null && !MapMetadataStorage.MapIsInstancedOnly(player.MapId) && fieldWar.MapId != player.MapId) { session.Send(FieldWarPacket.LegionPopup(fieldWar.Id, fieldWar.EntryClosureTime.ToUnixTimeSeconds())); } session.Send(KeyTablePacket.SendHotbars(player.GameOptions)); TrophyManager.OnMapEntered(player, player.MapId); QuestManager.OnMapEnter(player, player.MapId); player.InitializeEffects(); }
private static void HandleJump(GameSession session) { TrophyManager.OnJump(session.Player); }
private static void HandleInteract(GameSession session, PacketReader packet) { Player player = session.Player; string id = packet.ReadString(); session.FieldManager.State.InteractObjects.TryGetValue(id, out IFieldObject <InteractObject> fieldInteractObject); if (fieldInteractObject is null) { return; } InteractObject interactObject = fieldInteractObject.Value; InteractObjectMetadata metadata = InteractObjectMetadataStorage.GetInteractObjectMetadata(interactObject.InteractId); QuestManager.OnInteractObject(player, interactObject.InteractId); switch (interactObject.Type) { case InteractObjectType.Binoculars: session.Send(InteractObjectPacket.Use(interactObject)); break; case InteractObjectType.Ui: session.Send(InteractObjectPacket.Use(interactObject)); break; case InteractObjectType.RankBoard: session.Send(WebOpenPacket.Open(metadata.Web.Url)); break; case InteractObjectType.AdBalloon: session.Send(PlayerHostPacket.AdBalloonWindow((AdBalloon)interactObject)); break; case InteractObjectType.Gathering: GatheringHelper.HandleGathering(session, metadata.Gathering.RecipeId, out int numDrop); session.Send(InteractObjectPacket.Use(interactObject, (short)(numDrop > 0 ? 0 : 1), numDrop)); break; case InteractObjectType.Common: // Unsure if all interact objects need to be set as disabled. interactObject.State = InteractObjectState.Disable; session.Send(InteractObjectPacket.Update(interactObject)); session.Send(InteractObjectPacket.Interact(interactObject)); foreach ((int questId, QuestState state) in metadata.Quests) { if (!player.QuestData.TryGetValue(questId, out QuestStatus questStatus) || questStatus.State != state) { continue; } interactObject.State = InteractObjectState.Activated; session.Send(InteractObjectPacket.Update(interactObject)); } DropItems(); TrophyManager.OnObjectInteract(player, interactObject.InteractId); if (interactObject is MapChest) { // Unsure if setting as activated is specific of map chests interactObject.State = InteractObjectState.Activated; // Delayed removal of the chest Task.Run(async() => { await Task.Delay(TimeSpan.FromSeconds(10)); session.FieldManager.State.RemoveInteractObject(interactObject.Id); session.FieldManager.BroadcastPacket(InteractObjectPacket.Update(interactObject)); session.FieldManager.BroadcastPacket(InteractObjectPacket.Remove(interactObject)); }); } return; } session.Send(InteractObjectPacket.Interact(interactObject)); void DropItems() { foreach (int boxId in metadata.Drop.IndividualDropBoxId) { ItemDropMetadata itemDropMetadataStorage = ItemDropMetadataStorage.GetItemDropMetadata(boxId); if (itemDropMetadataStorage is null) { continue; } foreach (DropGroup dropGroup in itemDropMetadataStorage.DropGroups) { foreach (DropGroupContent dropGroupContent in dropGroup.Contents) { foreach (int itemId in dropGroupContent.ItemIds) { int amount = Random.Shared.Next((int)dropGroupContent.MinAmount, (int)dropGroupContent.MaxAmount); Item item = new(itemId, amount, dropGroupContent.Rarity); session.FieldManager.AddItem(session.Player.FieldPlayer, item); } } } } foreach (int boxId in metadata.Drop.GlobalDropBoxId) { ItemDropMetadata itemDropMetadataStorage = ItemDropMetadataStorage.GetItemDropMetadata(boxId); if (itemDropMetadataStorage is null) { continue; } foreach (DropGroup dropGroup in itemDropMetadataStorage.DropGroups) { foreach (DropGroupContent dropGroupContent in dropGroup.Contents) { foreach (int itemId in dropGroupContent.ItemIds) { int amount = Random.Shared.Next((int)dropGroupContent.MinAmount, (int)dropGroupContent.MaxAmount); Item item = new(itemId, amount, dropGroupContent.Rarity); session.FieldManager.AddItem(session.Player.FieldPlayer, item); } } } } } }