private void ValidateNewCharacterHandler_(List<object> objects)
        {
            var createdCharacter = new PlayerCharacter
                                {
                                        Name = (string) objects[1],
                                        Appearance = new PlayerAppearance(BitConverter.ToUInt32((byte[]) objects[2], 0))
                                };

                        ValidationFailed();
                        //ValidationSucceeded(createdCharacter);
        }
예제 #2
0
        private void DeleteCharacterSucceeded(PlayerCharacter characterToDelete)
        {
            if (!Game.Player.Account.Characters.Contains(characterToDelete))
                        {
                                Debug.ThrowException(new Exception("account does not contain " + characterToDelete));
                        }

                        Game.Player.Account.RemoveCharacter(characterToDelete);

                        Network.AuthServer.Send(AuthServerMessage.StreamTerminator, Network.AuthServer.LoginCount, 0);
        }
예제 #3
0
        public Party(PlayerCharacter leader)
        {
            if (leader == null)
                        {
                                Debug.ThrowException(new ArgumentException("leader of a party cannot be null"));
                        }

                        Leader = leader;
                        _members = new List<PlayerCharacter> {Leader};
                        _invites = new List<Party>();
                        _joinRequests = new List<Party>();
        }
예제 #4
0
        internal SkillBar(PlayerCharacter character)
        {
            _character = character;
                        _skills = new SkillBarSkill[8];
                        _copies = new Dictionary<SkillBarSkill, uint>();

                        for (uint i = 0; i < 8; i++)
                        {
                                _skills[i] = new SkillBarSkill(this, Skill.None);
                                _copies.Add(_skills[i], 0);
                        }
        }
        private void ValidationSucceeded(PlayerCharacter createdCharacter)
        {
            Game.Player.Account.AddCharacter(createdCharacter);

                        Network.GameServer.Send((GameServerMessage) 382, (byte) 1);

                        Network.GameServer.Send(GameServerMessage.CharacterCreated,
                                                new byte[16],
                                                createdCharacter.Name,
                                                (ushort) 100, //Map.TeamArenas,
                                                createdCharacter.GetLoginScreenAppearance());

                        Game.Player.Character = createdCharacter;
                        Game.State = GameState.CharacterScreen;
        }
예제 #6
0
파일: Player.cs 프로젝트: Darth-Alex/client
 protected override void Initialized()
 {
     Character = new PlayerCharacter();
     Game.Zone.AddAgent(Character);
 }
예제 #7
0
        public void AddMember(PlayerCharacter agent)
        {
            if (ParentZone != null && ParentZone.Parties.Any(party => party._members.Contains(agent)))
                        {
                                Debug.ThrowException(new Exception("agent " + agent.Name + " is already member of a party"));
                        }

                        _members.Add(agent);

                        if (Created && ParentZone == Game.Zone)
                        {
                                Network.GameServer.Send(GameServerMessage.AddPartyMember, IdManager.GetId(this), (ushort) IdManager.GetId(agent), (byte) 1);

                                if (agent == Game.Player.Character)
                                {
                                        ShowParty();
                                }
                        }
        }
예제 #8
0
        public void RemoveMember(PlayerCharacter agent)
        {
            if (!_members.Contains(agent))
                        {
                                Debug.ThrowException(new Exception("agent " + agent.Name + " not part of this party"));
                        }

                        if (_members.Count <= 1)
                        {
                                Debug.ThrowException(new Exception("cannot remove last member of group"));
                        }

                        _members.Remove(agent);

                        if (Created && ParentZone == Game.Zone)
                        {
                                if (agent != Leader)
                                {
                                        Network.GameServer.Send(GameServerMessage.RemovePartyMember, IdManager.GetId(this), (ushort) IdManager.GetId(agent));

                                        if (agent == Game.Player.Character)
                                        {
                                                Game.Zone.AddParty(new Party(Game.Player.Character));
                                        }
                                }
                                else
                                {
                                        Game.Zone.RemoveParty(this);

                                        var restParty = new Party(_members[0]);

                                        Game.Zone.AddParty(restParty);

                                        foreach (PlayerCharacter member in _members)
                                        {
                                                if (member == restParty.Leader) continue;

                                                restParty.AddMember(member);
                                        }

                                        foreach (Party invite in _invites)
                                        {
                                                restParty.AddInvite(invite);
                                        }

                                        foreach (Party joinRequest in _joinRequests)
                                        {
                                                restParty.AddJoinRequest(joinRequest);
                                        }

                                        Game.Zone.AddParty(new Party(Leader));
                                }
                        }
        }
예제 #9
0
 internal void RemoveCharacter(PlayerCharacter character)
 {
     _characters.Remove(character);
 }
예제 #10
0
        public void AddCharacter(PlayerCharacter character)
        {
            _characters.Add(character);

                        if (Game.State != GameState.Handshake && Game.State != GameState.LoginScreen)
                        {
                                Network.AuthServer.Send(AuthServerMessage.Character,
                                                        Network.AuthServer.LoginCount,
                                                        new byte[16],
                                                        0,
                                                        character.Name,
                                                        character.GetLoginScreenAppearance());
                        }
        }
예제 #11
0
 public void Merge(PlayerCharacter player)
 {
     Send("merge", o => { o.target = Entity.Players.First(p => p.Character == player).Id; });
 }
예제 #12
0
 public void Kick(PlayerCharacter player)
 {
     Send("kick", o => { o.target = Entity.Players.First(p => p.Character == player).Id; });
 }
예제 #13
0
 private void GenerateJoinRequests(PlayerCharacter groupLeader, JArray invites)
 {
     if (invites == null) return;
     foreach (string leaderid in invites.Select(y => (string)y).ToArray())
     {
         PlayerCharacter requestedGroupJoinLeader = Entity.GetEntity<Player>(Guid.Parse(leaderid)).Character;
         Party partyOfRequestedGroupJoinLeader = Game.Zone.Parties.FirstOrDefault(x => x.Leader == requestedGroupJoinLeader);
         Party ownParty = Game.Zone.Parties.FirstOrDefault(x => x.Leader == groupLeader);
         partyOfRequestedGroupJoinLeader?.AddJoinRequest(ownParty);
     }
 }