public void RemovePlayerFromParty(PlayerDC player, ConversationDC conv) { if (player.PlayerId == Player.PlayerId) { DropConversation(conv); return; } var selectedConv = conversationDCListView.SelectedItem as ConversationDC; var q = (from c in conversations where c.ConversationId == conv.ConversationId select c).ToList(); if (q.Count > 0) { var c = q.ElementAt(0); var q1 = (from p in c.Participants where p.PlayerId == player.PlayerId select p).ToList(); if (q1.Count > 0) { c.Participants = c.Participants.ToList(); ((List<PlayerDC>)c.Participants).Remove(q1.ElementAt(0)); c.ParticipantsNames = " " + c.Host.Pseudonym + " (Host) \n "; foreach (var p in c.Participants) { c.ParticipantsNames += p.Pseudonym + ", "; } c.ParticipantsNames = c.ParticipantsNames.Remove(c.ParticipantsNames.Length - 2); partyPage.LoadConversation(); ConversationsListViewSource.View.Refresh(); } } }
private void OnSubmitSubscription(object sender, RoutedEventArgs e) { if (_login.Text.Trim() != "" && _password.Text.Trim() != "") { try { mainWindow.ChannelFactory = new DuplexChannelFactory <IBomberService>(mainWindow, "BomberServiceEndpoint"); mainWindow.Server = mainWindow.ChannelFactory.CreateChannel(); var account = new AccountDC() { Login = _login.Text, Password = _password.Text }; var player = new PlayerDC() { Pseudonym = _pseudonym.Text, PlayerDescription = _playerDescription.Text, }; if (player.Pseudonym.Trim() == "") { player.Pseudonym = account.Login; } mainWindow.Server.CreateAccount(account, player); mainWindow.IsEnabled = false; } catch { MessageBox.Show("Conexion failure... Please try again later."); } } else { MessageBox.Show("Please choose a login and password before submitting."); } }
private void OnSearchFriends(object sender, RoutedEventArgs e) { PlayerDC refPlayer = new PlayerDC() { Pseudonym = _pseudo.Text, Login = _login.Text }; mainWindow.Server.SearchFriends(refPlayer); }
public void RemoveFriendshipRequestFromList(PlayerDC p) { friendshipRequests.Remove(p); FriendshipRequestsViewSource.Source = friendshipRequests; FriendshipRequestsViewSource.View.Refresh(); if (playerDCListView1.Items.Count != 0 && playerDCListView1.SelectedItem as PlayerDC != null) friendshipRequestPage = new FriendshipRequestPage(this, playerDCListView1.SelectedItem as PlayerDC); else _contentFrame.Content = null; }
public void ReceiveProfil(PlayerDC myProfil, IEnumerable<PlayerDC> friendShipRequests, IEnumerable<ConversationDC> playerConvDCs) { Player = myProfil; homePage = new HomePage(this); FriendshipRequestsViewSource.Source = friendShipRequests; this.friendshipRequests = friendShipRequests.ToList<PlayerDC>(); foreach (var c in playerConvDCs) { InitializeConversation(c); } Server.RequestFriends(); }
public void NotifyFriendshipEnding(PlayerDC playerDC) { var q = (from f in friends where f.PlayerId == playerDC.PlayerId select f).ToList(); if (q.Count > 0) { var newFriendsList = friends.ToList(); newFriendsList.Remove(q.ElementAt(0)); friends = newFriendsList; playerDCViewSource.Source = friends; playerDCViewSource.View.Refresh(); } }
private void LoadProfil() { profil = new PlayerDC() { NumberOfVictories = mainWindow.Player.NumberOfVictories, Pseudonym = mainWindow.Player.Pseudonym, PlayerDescription = mainWindow.Player.PlayerDescription }; playerDCViewSource.Source = new List <PlayerDC>() { profil }; playerDCViewSource.View.Refresh(); }
public void NotifyPlayerStatusChange(PlayerDC friend) { var q = from f in friends where f.PlayerId == friend.PlayerId select f; if (q.Count() > 0) { var f = q.ToList().ElementAt(0); var previousStatus = f.PlayerStatus; f.PlayerStatus = friend.PlayerStatus; LoadFriends(); friendPage.LoadPlayerInfos(friendPage.friend); if (previousStatus == "Offline" && NotifyConnexion) new NotificationWindow(f.Pseudonym + "\nhas connected!"); } }
private void OnFriendsFocus(object sender, RoutedEventArgs e) { _contentFrame.Content = friendPage; PlayerDC f = playerDCListView.SelectedItem as PlayerDC; if (f != null && f.HasNotSeenMsg) { f.HasNotSeenMsg = false; LoadFriends(); allowSelection = false; playerDCListView.SelectedItem = f; friendPage.LoadPlayerInfos(f); } else { allowSelection = true; } }
private void OnSelectedFriendChanged(object sender, SelectionChangedEventArgs e) { if (!allowSelection) { allowSelection = true; return; } PlayerDC p = playerDCListView.SelectedItem as PlayerDC; if (p != null && p.HasNotSeenMsg) { p.HasNotSeenMsg = false; LoadFriends(); playerDCListView.SelectedItem = p; } friendPage.LoadPlayerInfos(p); }
public void NotifyFriendProfilChange(PlayerDC playerDC) { var q = (from f in friends where f.PlayerId == playerDC.PlayerId select f).ToList(); if (q.Count > 0) { var f = q.ElementAt(0); f.Pseudonym = playerDC.Pseudonym; f.PlayerDescription = playerDC.PlayerDescription; var selectedFriend = playerDCListView.SelectedItem; LoadFriends(); allowSelection = false; playerDCListView.SelectedItem = selectedFriend; friendPage.friend = selectedFriend as PlayerDC; if (_contentFrame.Content == friendPage) friendPage.LoadPlayerInfos(friendPage.friend); } }
public void LoadPlayerInfos(PlayerDC p) { if (p != null) { if (p.PlayerStatus == "Offline") { p.IsConnected = false; } else { p.IsConnected = true; } } playerDCViewSource.Source = new List <PlayerDC>() { p }; friend = p; }
public void NotifyFriendshipEstablishment(PlayerDC playerDC) { var q = (from r in friendshipRequests where r.PlayerId == playerDC.PlayerId select r).ToList(); if (q.Count > 0) { RemoveFriendshipRequestFromList(q.ElementAt(0)); } q = (from f in friends where f.PlayerId == playerDC.PlayerId select f).ToList(); if (q.Count == 0) { addFriendsPage.playerDCViewSource.Source = new List<PlayerDC>(); addFriendsPage.playerDCViewSource.View.Refresh(); var newFriendsList = new List<PlayerDC>() { playerDC }; friends = newFriendsList.Concat(friends); LoadFriends(); playerDCViewSource.View.Refresh(); } }
public void KillPlayer(ConversationDC conv, PlayerDC player) { Game.GameContentManager.KillPlayer(player.Login); }
public void UpdatePlayerPosition(ConversationDC conv, PlayerDC player) { Game.GameContentManager.UpdatePlayerPosition(player.Login, player.PlayerPositionX, player.PlayerPositionY); }
public Player(ContentManager sCont, ref List<string> msgBuffer, ref PaperDoll pd, PlayerDC raw_player) { //Constructor stuff cont = sCont; my_grid_coord = new gridCoordinate(raw_player.Player_GC_X, raw_player.Player_GC_Y); my_Position = new Vector2(raw_player.Player_GC_X * 32, raw_player.Player_GC_Y * 32); rGen = new Random(); message_buffer = msgBuffer; //!Constructor stuff my_gold = raw_player.Player_Gold; lifetime_gold = raw_player.Player_Lifetime_Gold; base_smell_value = 10; base_sound_value = 10; //Player stuff my_class = ((Chara_Class)Enum.Parse(typeof(Chara_Class), raw_player.Chara_Class)); my_character = ((Character)Enum.Parse(typeof(Character), raw_player.Character)); switch (my_character) { case Character.Falsael: my_Texture = cont.Load<Texture2D>("Player/falsael_sprite"); my_dead_texture = cont.Load<Texture2D>("Player/falsael_dead"); break; case Character.Petaer: my_Texture = cont.Load<Texture2D>("Player/petaer_sprite"); my_dead_texture = cont.Load<Texture2D>("Player/petaer_dead"); break; case Character.Ziktofel: my_Texture = cont.Load<Texture2D>("Player/ziktofel_sprite"); my_dead_texture = cont.Load<Texture2D>("Player/ziktofel_dead"); break; case Character.Halephon: my_Texture = cont.Load<Texture2D>("Player/halephon_sprite"); my_dead_texture = cont.Load<Texture2D>("Player/halephon_dead"); break; case Character.Belia: my_Texture = cont.Load<Texture2D>("Player/belia_sprite"); my_dead_texture = cont.Load<Texture2D>("Player/belia_sprite"); break; default: my_Texture = cont.Load<Texture2D>("Player/lmfaoplayer"); my_dead_texture = cont.Load<Texture2D>("Player/playercorpse"); break; } //Health stuff. base_hp = raw_player.Base_Health; BuffDebuffTracker = new List<StatusEffect>(); Head = new Limb(raw_player.Limbs[0]); Torso = new Limb(raw_player.Limbs[1]); R_Arm = new Limb(raw_player.Limbs[2]); L_Arm = new Limb(raw_player.Limbs[3]); R_Leg = new Limb(raw_player.Limbs[4]); L_Leg = new Limb(raw_player.Limbs[5]); //Inventory stuff inventory = new List<Item>(); reserved_potion_ids = new List<Tuple<int, int>>(); //WILL NEED TO FIGURE THESE OUT. for (int i = 0; i < raw_player.Reserved_Potion_Code.Count; i++) reserved_potion_ids.Add(new Tuple<int, int>(raw_player.Reserved_Potion_Code[i], raw_player.Reserved_Potion_ID[i])); for (int i = 0; i < raw_player.Armors_In_Inv.Count; i++) inventory.Add(new Armor(raw_player.Armors_In_Inv[i])); for (int i = 0; i < raw_player.Potions_In_Inv.Count; i++) acquire_potion(new Potion(raw_player.Potions_In_Inv[i])); for (int i = 0; i < raw_player.Scrolls_In_Inv.Count; i++) inventory.Add(new Scroll(raw_player.Scrolls_In_Inv[i])); for (int i = 0; i < raw_player.Weapons_In_Inv.Count; i++) inventory.Add(new Weapon(raw_player.Weapons_In_Inv[i])); //Equipped Items Weapon next_mh = null; if (raw_player.Main_Hand != null) { next_mh = new Weapon(raw_player.Main_Hand); equip_main_hand(next_mh); } Weapon next_oh = null; if (raw_player.Off_Hand != null) { next_oh = new Weapon(raw_player.Off_Hand); equip_off_hand(next_oh); } Armor next_helmet = null; if (raw_player.Helmet != null) { next_helmet = new Armor(raw_player.Helmet); equip_armor(next_helmet); } Armor next_OA = null; if (raw_player.Over_Armor != null) { next_OA = new Armor(raw_player.Over_Armor); equip_armor(next_OA); } Armor next_UA = null; if (raw_player.Under_Armor != null) { next_UA = new Armor(raw_player.Under_Armor); equip_armor(next_UA); } //Character stuff base_smell_value = raw_player.Player_Base_Smell; base_sound_value = raw_player.Player_Base_Sound; c_energy = raw_player.Player_Current_Energy; max_energy = raw_player.Player_Max_Energy; calculate_dodge_chance(); pDoll = pd; normal_backing = Color.White; invis_backing = new Color(255, 255, 255, 75); }
public PlayerDC compress_to_dataclass() { PlayerDC p_DC = new PlayerDC(); p_DC.Base_Health = base_hp; p_DC.Chara_Class = my_class.ToString(); p_DC.Character = my_character.ToString(); if(helm != null) p_DC.Helmet = helm.compress_to_dataclass(); p_DC.Limbs = new List<LimbDC>(); p_DC.Limbs.Add(Head.compress_to_dataclass()); p_DC.Limbs.Add(Torso.compress_to_dataclass()); p_DC.Limbs.Add(R_Arm.compress_to_dataclass()); p_DC.Limbs.Add(L_Arm.compress_to_dataclass()); p_DC.Limbs.Add(R_Leg.compress_to_dataclass()); p_DC.Limbs.Add(L_Leg.compress_to_dataclass()); if(main_hand != null) p_DC.Main_Hand = main_hand.compress_to_dataclass(); if(off_hand != null && off_hand != main_hand) p_DC.Off_Hand = off_hand.compress_to_dataclass(); if(over_armor != null) p_DC.Over_Armor = over_armor.compress_to_dataclass(); p_DC.Player_Base_Smell = base_smell_value; p_DC.Player_Base_Sound = base_sound_value; p_DC.Player_Current_Energy = c_energy; p_DC.Player_GC_X = my_grid_coord.x; p_DC.Player_GC_Y = my_grid_coord.y; p_DC.Player_Gold = my_gold; p_DC.Player_Lifetime_Gold = lifetime_gold; p_DC.Player_Max_Energy = max_energy; if(under_armor != null) p_DC.Under_Armor = under_armor.compress_to_dataclass(); List<int> potion_codes = new List<int>(); List<int> potion_IDs = new List<int>(); for (int i = 0; i < reserved_potion_ids.Count; i++) { potion_codes.Add(reserved_potion_ids[i].Item1); potion_IDs.Add(reserved_potion_ids[i].Item2); } p_DC.Reserved_Potion_Code = potion_codes; p_DC.Reserved_Potion_ID = potion_IDs; List<WeaponDC> inv_weapons = new List<WeaponDC>(); List<ArmorDC> inv_armors = new List<ArmorDC>(); List<ScrollDC> inv_scrolls = new List<ScrollDC>(); List<PotionDC> inv_potions = new List<PotionDC>(); for (int i = 0; i < inventory.Count; i++) { if (inventory[i] is Weapon) inv_weapons.Add(((Weapon)inventory[i]).compress_to_dataclass()); else if (inventory[i] is Armor) inv_armors.Add(((Armor)inventory[i]).compress_to_dataclass()); else if (inventory[i] is Scroll) inv_scrolls.Add(((Scroll)inventory[i]).compress_to_dataclass()); else if (inventory[i] is Potion) for(int j = 0; j < ((Potion)inventory[i]).get_my_quantity(); j++) inv_potions.Add(((Potion)inventory[i]).compress_to_dataclass()); } p_DC.Armors_In_Inv = inv_armors; p_DC.Weapons_In_Inv = inv_weapons; p_DC.Scrolls_In_Inv = inv_scrolls; p_DC.Potions_In_Inv = inv_potions; return p_DC; }
public void NotifyFriendshipRequest(PlayerDC playerDC) { friendshipRequests.Add(playerDC); FriendshipRequestsViewSource.Source = friendshipRequests; FriendshipRequestsViewSource.View.Refresh(); }