private void SendPartyUpdate() { foreach (Client member in members) { CommunityProtocol.GetProtocol().SendParty(member.index, PartyId, Leader.playerId, MemberIds()); } }
private void InitLogin(int index, uint playerId, string playerName, string sessionCode) { Server.GetClientByIndex(index).Character = new Character(index); SendPlayer(index); if (Database.Database.CheckCharacterExistanceById(playerId.ToString())) { CatalogueProtocol.GetProtocol().SendCard(index, CardView.GUI, 130920111u); CatalogueProtocol.GetProtocol().SendCard(index, CardView.GUI, 264733124u); CatalogueProtocol.GetProtocol().SendCard(index, CardView.GUI, 215278030u); CatalogueProtocol.GetProtocol().SendCard(index, CardView.GUI, 207047790u); CatalogueProtocol.GetProtocol().SendCard(index, CardView.GUI, 130762195u); PlayerProtocol.GetProtocol().SendPlayerId(index); PlayerProtocol.GetProtocol().SendName(index); PlayerProtocol.GetProtocol().SendAvatar(index); PlayerProtocol.GetProtocol().SendFaction(index); if (Server.GetClientByIndex(index).Character.Faction == Faction.Colonial) { PlayerProtocol.GetProtocol().SendPlayerShips(index, 11, 22131180u); PlayerProtocol.GetProtocol().SendPlayerShips(index, 17, 22131178u); PlayerProtocol.GetProtocol().SendPlayerShips(index, 14, 22131196u); } else if (Server.GetClientByIndex(index).Character.Faction == Faction.Cylon) { PlayerProtocol.GetProtocol().SendCylonDuties(index); // I only have Cylon duties PlayerProtocol.GetProtocol().SendPlayerShips(index, 11, 22131208u); PlayerProtocol.GetProtocol().SendPlayerShips(index, 17, 22131210u); PlayerProtocol.GetProtocol().SendPlayerShips(index, 14, 22131226u); } PlayerProtocol.GetProtocol().SetActivePlayerShip(index, 11); PlayerProtocol.GetProtocol().SendItems(index); Database.Entities.Users user = Database.Database.GetUserById(Server.GetClientByIndex(index).playerId.ToString()); SettingProtocol.ReadSettingsFromDatabase(index, user.settings); if (user.controlKeys != null) { SettingProtocol.ReadControlKeysFromDatabase(index, user.controlKeys); } SettingProtocol.GetProtocol().SendSettings(index); if (Server.GetClientByIndex(index).Character.controlKeys.Count > 0) { SettingProtocol.GetProtocol().SendKeys(index); } CommunityProtocol.GetProtocol().SendChatSessionId(index); } }
public void RemoveMember(Client Player) { members.Remove(Player); Player.Character.partyId = 0; CommunityProtocol.GetProtocol().SendParty(Player.index, 0, 0, new uint[0]); if (members.Count > 1) { SendPartyUpdate(); } else { CommunityProtocol.GetProtocol().SendParty(Leader.index, 0, 0, new uint[0]); Server.Parties.Remove(PartyId); } }
public void InviteMember(uint PlayerId, int inviteOwnerIndex) { CommunityProtocol.GetProtocol().SendPartyInvite(Server.GetClientByPlayerId(PlayerId.ToString()).index, PartyId, Leader.playerId, Server.GetClientByIndex(inviteOwnerIndex).Character.name); }
public override void ParseMessage(int index, BgoProtocolReader br) { ushort msgType = (ushort)br.ReadUInt16(); switch ((Request)msgType) { // This case is ran when the player selects his faction. It will send to the client an // empty Avatar Description, so the customization will be set to default, and sends back // the faction, so the game will be sure that the selected faction is real. Also fater that // we change the scene to Avatar. case Request.SelectFaction: SendNewAvatarDescription(index); SendFaction(index, (Faction)br.ReadByte()); Server.GetClientByIndex(index).Character.GameLocation = GameLocation.Avatar; break; // Since we are not using a real database yet, we can just use the fake database to check if // the name is available or not. case Request.CheckNameAvailability: SendNameAvailability(index, br.ReadString()); break; case Request.ChooseName: Server.GetClientByIndex(index).Character.name = br.ReadString(); SendName(index); break; case Request.CreateAvatar: Dictionary <AvatarItem, string> items = new Dictionary <AvatarItem, string>(); int num = br.ReadLength(); for (int i = 0; i < num; i++) { items[(AvatarItem)br.ReadByte()] = br.ReadString(); } Client client = Server.GetClientByIndex(index); Database.Database.CreateCharacter(client.Character.name, client.playerId.ToString(), (byte)client.Character.Faction, items); Server.GetClientByIndex(index).Character.items = items; SendAvatar(index); SendPlayerId(index); if (Server.GetClientByIndex(index).Character.Faction == Faction.Colonial) { SendPlayerShips(index, 11, 22131180u); SetActivePlayerShip(index, 11); } else if (Server.GetClientByIndex(index).Character.Faction == Faction.Cylon) { SendPlayerShips(index, 11, 22131208u); SetActivePlayerShip(index, 11); } CommunityProtocol.GetProtocol().SendChatSessionId(index); client.Character.PlayerShip.sectorId = client.Character.Faction == Faction.Colonial ? 0u : 6u; Server.GetClientByIndex(index).Character.GameLocation = GameLocation.Space; break; case Request.SelectShip: SetActivePlayerShip(index, br.ReadUInt16()); break; default: Log.Add(LogSeverity.ERROR, string.Format("Unknown msgType \"{0}\" on {1}Protocol.", (Request)msgType, protocolID)); break; } }