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); }
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); }
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>(); }
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; }
protected override void Initialized() { Character = new PlayerCharacter(); Game.Zone.AddAgent(Character); }
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(); } } }
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)); } } }
internal void RemoveCharacter(PlayerCharacter character) { _characters.Remove(character); }
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()); } }
public void Merge(PlayerCharacter player) { Send("merge", o => { o.target = Entity.Players.First(p => p.Character == player).Id; }); }
public void Kick(PlayerCharacter player) { Send("kick", o => { o.target = Entity.Players.First(p => p.Character == player).Id; }); }
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); } }