public static void Process(ReceivablePacket packet)
    {
        // Server information.
        long objectId = packet.ReadLong();
        CharacterDataHolder npcTemplate   = NpcData.GetNpc(packet.ReadInt());
        CharacterDataHolder characterData = new CharacterDataHolder();

        characterData.SetX(packet.ReadFloat());
        characterData.SetY(packet.ReadFloat());
        characterData.SetZ(packet.ReadFloat());
        characterData.SetHeading(packet.ReadFloat());
        characterData.SetCurrentHp(packet.ReadLong());
        // Client information.
        characterData.SetName(npcTemplate.GetName());
        characterData.SetRace(npcTemplate.GetRace());
        characterData.SetHeight(npcTemplate.GetHeight());
        characterData.SetBelly(npcTemplate.GetBelly());;
        characterData.SetHairType(npcTemplate.GetHairType());
        characterData.SetHairColor(npcTemplate.GetHairColor());
        characterData.SetSkinColor(npcTemplate.GetSkinColor());
        characterData.SetEyeColor(npcTemplate.GetEyeColor());
        characterData.SetHeadItem(npcTemplate.GetHeadItem());
        characterData.SetChestItem(npcTemplate.GetChestItem());
        characterData.SetLegsItem(npcTemplate.GetLegsItem());
        characterData.SetHandsItem(npcTemplate.GetHandsItem());
        characterData.SetFeetItem(npcTemplate.GetFeetItem());
        characterData.SetLeftHandItem(npcTemplate.GetLeftHandItem());
        characterData.SetRightHandItem(npcTemplate.GetRightHandItem());
        characterData.SetMaxHp(npcTemplate.GetMaxHp());
        characterData.SetTargetable(npcTemplate.IsTargetable());

        WorldManager.Instance.UpdateObject(objectId, characterData);
    }
Exemplo n.º 2
0
    public static void Process(ReceivablePacket packet)
    {
        long objectId = packet.ReadLong();
        CharacterDataHolder characterData = new CharacterDataHolder();

        characterData.SetName(packet.ReadString());
        characterData.SetRace((byte)packet.ReadByte());
        characterData.SetHeight(packet.ReadFloat());
        characterData.SetBelly(packet.ReadFloat());
        characterData.SetHairType((byte)packet.ReadByte());
        characterData.SetHairColor(packet.ReadInt());
        characterData.SetSkinColor(packet.ReadInt());
        characterData.SetEyeColor(packet.ReadInt());
        characterData.SetHeadItem(packet.ReadInt());
        characterData.SetChestItem(packet.ReadInt());
        characterData.SetLegsItem(packet.ReadInt());
        characterData.SetHandsItem(packet.ReadInt());
        characterData.SetFeetItem(packet.ReadInt());
        characterData.SetLeftHandItem(packet.ReadInt());
        characterData.SetRightHandItem(packet.ReadInt());
        characterData.SetX(packet.ReadFloat());
        characterData.SetY(packet.ReadFloat());
        characterData.SetZ(packet.ReadFloat());
        characterData.SetHeading(packet.ReadFloat());
        characterData.SetCurrentHp(packet.ReadLong());
        characterData.SetMaxHp(packet.ReadLong());

        WorldManager.Instance.UpdateObject(objectId, characterData);
    }
    public static void Notify(ReceivablePacket packet)
    {
        // Get player list size.
        int listSize = packet.ReadByte();
        // Read the data.
        List <CharacterDataHolder> characterList = new List <CharacterDataHolder>(listSize);

        for (int i = 0; i < listSize; i++)
        {
            CharacterDataHolder characterData = new CharacterDataHolder();
            characterData.SetName(packet.ReadString());
            characterData.SetSlot((byte)packet.ReadByte());
            characterData.SetSelected(packet.ReadByte() == 1 ? true : false);
            characterData.SetRace((byte)packet.ReadByte());
            characterData.SetHeight(packet.ReadFloat());
            characterData.SetBelly(packet.ReadFloat());
            characterData.SetHairType(packet.ReadByte());
            characterData.SetHairColor(packet.ReadInt());
            characterData.SetSkinColor(packet.ReadInt());
            characterData.SetEyeColor(packet.ReadInt());
            characterData.SetHeadItem(packet.ReadInt());
            characterData.SetChestItem(packet.ReadInt());
            characterData.SetLegsItem(packet.ReadInt());
            characterData.SetHandsItem(packet.ReadInt());
            characterData.SetFeetItem(packet.ReadInt());
            characterData.SetLeftHandItem(packet.ReadInt());
            characterData.SetRightHandItem(packet.ReadInt());
            characterData.SetX(packet.ReadFloat());
            characterData.SetY(packet.ReadFloat());
            characterData.SetZ(packet.ReadFloat());
            characterData.SetHeading(packet.ReadFloat());
            characterData.SetExperience(packet.ReadLong());
            characterData.SetCurrentHp(packet.ReadLong());
            characterData.SetMaxHp(packet.ReadLong());
            characterData.SetCurrentMp(packet.ReadLong());
            characterData.SetMaxMp(packet.ReadLong());
            characterData.SetAccessLevel((byte)packet.ReadByte());
            characterList.Add(characterData);
        }

        // Send the data.
        MainManager.Instance.SetCharacterList(characterList);

        // Enable player selection.
        CharacterSelectionManager.Instance.SetWaitingServer(false);
    }