//When a client wants to enter the game world, we need to send them a bunch of information to set up their game world before they can enter public static void HandleEnterWorldRequest(int ClientID, ref NetworkPacket Packet) { CommunicationLog.LogIn(ClientID + " enter world request"); //Read the characters name the player is going to use, use it to fetch the rest of the characters data from the database string CharacterName = Packet.ReadString(); CharacterData CharacterData = CharactersDatabase.GetCharacterData(CharacterName); //Fetch this ClientConnection and make sure they were able to be found ClientConnection Client = ConnectionManager.GetClient(ClientID); if (Client == null) { MessageLog.Print("ERROR: Client not found, unable to handle enter world request."); return; } //Store the character data in the client Client.Character = CharacterData; //Send the clients lists of other players, AI entities, item pickups, inventory contents, equipped items and socketed actionbar abilities GameWorldStatePacketSender.SendActivePlayerList(ClientID); GameWorldStatePacketSender.SendActiveEntityList(ClientID); GameWorldStatePacketSender.SendActiveItemList(ClientID); GameWorldStatePacketSender.SendInventoryContents(ClientID, CharacterName); GameWorldStatePacketSender.SendEquippedItems(ClientID, CharacterName); GameWorldStatePacketSender.SendSocketedAbilities(ClientID, CharacterName); }
public static void HandlePlayerActionBar(PacketReader Reader) { Log.PrintIncomingPacket("InventoryEquipmentManagement.HandleCharacterActionBar"); //Grab all the action bar slot UI components from the scene DraggableUIComponent[] ActionBarSlots = DraggableUIControl.Instance.ActionBarSlots; //Loop through reading in each action bar items data, updating the slots as needed for (int i = 0; i < 5; i++) { //Read each slots values int ItemNumber = Reader.ReadInt(); int ItemID = Reader.ReadInt(); //Empty the action bar slots with nothing within them if (ItemNumber == 0 || ItemNumber == -1) { ActionBarSlots[i].ItemData = null; ActionBarSlots[i].UpdateUIDisplay(); } else //Display action bar slots with abilities within them { ActionBarSlots[i].ItemData = ItemList.Instance.GetItemData(ItemNumber); ActionBarSlots[i].ItemID = ItemID; ActionBarSlots[i].UpdateUIDisplay(); } } //Now everything is ready and set up correctly, tell the server we have finished loading into the game successfully GameWorldStatePacketSender.SendNewPlayerReady(); }
public void ClickSelectCharacter(int CharacterSlot) { //Keep note of which character was selected and attempt to enter into the game world with them PlayerData LocalPlayer = PlayerManager.Instance.LocalPlayer; LocalPlayer.CurrentCharacter = LocalPlayer.PlayerCharacters[CharacterSlot - 1]; MenuPanelDisplayManager.Instance.DisplayPanel("Waiting Panel"); GameWorldStatePacketSender.SendEnterWorldRequest(LocalPlayer.CurrentCharacter); }
void Awake() { Instance = this; }