Esempio n. 1
0
        public void newClanMessage(Clan c, ChatMessage chatMessage)
        {
            PacketBuilder pb = new PacketBuilder();

            pb.setId(54).setSize(Packet.Size.VariableByte);
            pb.addLong(chatMessage.getPlayer().getLoginDetails().getLongName());
            pb.addByte((byte)1); // dummy
            pb.addLong(misc.playerNameToLong(c.getClanName()));
            pb.addUShort(0);     // some message counter bs
            string message        = chatMessage.getChatText();
            int    messageCounter = player.getFriends().getNextUniqueId();

            pb.addThreeBytes(messageCounter);
            pb.addByte((byte)chatMessage.getPlayer().getRights());
            pb.addBytes(chatMessage.getPacked());
            connection.SendPacket(pb.toPacket());
        }
Esempio n. 2
0
        public void sendIgnores(long[] names)
        {
            PacketBuilder pb = new PacketBuilder().setId(126).setSize(Packet.Size.VariableShort);

            foreach (long name in names)
            {
                pb.addLong(name);
            }
            connection.SendPacket(pb.toPacket());
        }
Esempio n. 3
0
        public void updateClan(Clan c)
        {
            PacketBuilder pb = new PacketBuilder();

            pb.setId(55).setSize(Packet.Size.VariableShort);
            pb.addLong(misc.playerNameToLong(c.getClanOwner()));
            pb.addLong(misc.playerNameToLong(c.getClanName()));
            pb.addByte((byte)c.getKickRights());
            pb.addByte((byte)c.getUserList().Count);
            foreach (ClanUser list in c.getUserList())
            {
                Player p = list.getClanMember();
                pb.addLong(p.getLoginDetails().getLongName());
                pb.addUShort(p.getWorld());
                int rights = Convert.ToInt32(list.getClanRights());
                pb.addByte((byte)rights);
                pb.addString("Server " + p.getWorld());
            }
            connection.SendPacket(pb.toPacket());
        }
        private static void appendAppearanceUpdate(Player p, PacketBuilder updateBlock) {
		    PacketBuilder playerProps = new PacketBuilder().setSize(Packet.Size.Bare);
		
		    Appearance app = p.getAppearance();
		    playerProps.addByte((byte) (app.getGender() & 0xFF));
		    if((app.getGender() & 0x2) == 2) {
			    playerProps.addByte((byte) 0);
			    playerProps.addByte((byte) 0);
		    }
		    playerProps.addByte((byte) p.getPrayers().getPkIcon());
		    playerProps.addByte((byte) p.getPrayers().getHeadIcon());
		    if (!app.isInvisible()) {
			    if(!app.isNpc()) {
				    for(int i = 0; i < 4; i++) {
					    if(p.getEquipment().getItemInSlot((ItemData.EQUIP)i) != -1) {
                            playerProps.addUShort(32768 + p.getEquipment().getSlot((ItemData.EQUIP)i).getDefinition().getEquipId());
					    } else {
						    playerProps.addByte((byte) 0);
					    }
				    }
                    if (p.getEquipment().getItemInSlot(ItemData.EQUIP.CHEST) != -1)
                    {
                        playerProps.addUShort(32768 + p.getEquipment().getSlot(ItemData.EQUIP.CHEST).getDefinition().getEquipId());
				    } else {
                        playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.AMULET));
				    }
                    if (p.getEquipment().getItemInSlot(ItemData.EQUIP.SHIELD) != -1)
                    {
                        playerProps.addUShort(32768 + p.getEquipment().getSlot(ItemData.EQUIP.SHIELD).getDefinition().getEquipId());
				    } else {
					    playerProps.addByte((byte) 0);
				    }
                    Item chest = p.getEquipment().getSlot(ItemData.EQUIP.CHEST);
                    if (chest != null && chest.getDefinition() != null)
                    {
					    if(!ItemData.isFullBody(chest.getDefinition())) {
                            playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.WEAPON));
					    } else {
						    playerProps.addByte((byte) 0);
					    }
				    } else {
                        playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.WEAPON));
				    }
                    if (p.getEquipment().getItemInSlot(ItemData.EQUIP.LEGS) != -1)
                    {
                        playerProps.addUShort(32768 + p.getEquipment().getSlot(ItemData.EQUIP.LEGS).getDefinition().getEquipId());
				    } else {
                        playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.SHIELD));
				    }
                    Item hat = p.getEquipment().getSlot(ItemData.EQUIP.HAT);
                    if (hat != null && hat.getDefinition() != null)
                    {
					    if(!ItemData.isFullHat(hat.getDefinition()) && !ItemData.isFullMask(hat.getDefinition())) {
                            playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.HAT));
					    } else {
						    playerProps.addByte((byte) 0);
					    }
				    } else {
                        playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.HAT));
				    }
                    if (p.getEquipment().getItemInSlot(ItemData.EQUIP.HANDS) != -1)
                    {
                        playerProps.addUShort(32768 + p.getEquipment().getSlot(ItemData.EQUIP.HANDS).getDefinition().getEquipId());
				    } else {
                        playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.CHEST));
				    }
                    if (p.getEquipment().getItemInSlot(ItemData.EQUIP.FEET) != -1)
                    {
                        playerProps.addUShort(32768 + p.getEquipment().getSlot(ItemData.EQUIP.FEET).getDefinition().getEquipId());
				    } else {
					    playerProps.addUShort(0x100 + app.getLook(6));
				    }
                    if (hat != null && hat.getDefinition() != null)
                    {
					    if(!ItemData.isFullMask(hat.getDefinition())) {
                            playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.CAPE));
					    } else {
						    playerProps.addByte((byte) 0);
					    }
				    } else {
                        playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.CAPE));
				    }
			    } else {
				    playerProps.addUShort(-1);
				    playerProps.addUShort(app.getNpcId());
				    playerProps.addByte((byte) 255);
			    }
		    } else {
			    for (int i = 0; i < 12; i++) {
				    playerProps.addByte((byte) 0);
			    }
		    }
		    foreach(int colour in app.getColoursArray()) {
			    playerProps.addByte((byte) colour);
		    }
		    playerProps.addUShort(p.getEquipment().getStandWalkAnimation());
		    playerProps.addLong(p.getLoginDetails().getLongName());
		    playerProps.addByte((byte) p.getSkills().getCombatLevel());
		    playerProps.addUShort(0);
		    playerProps.addByte((byte) 0);
		    updateBlock.addByteA((byte) (playerProps.getLength() & 0xFF));
		    updateBlock.addBytes(playerProps.toPacket().getData(), 0, playerProps.getLength());
	    }
 public void updateClan(Clan c)
 {
     PacketBuilder pb = new PacketBuilder();
     pb.setId(55).setSize(Packet.Size.VariableShort);
     pb.addLong(misc.playerNameToLong(c.getClanOwner()));
     pb.addLong(misc.playerNameToLong(c.getClanName()));
     pb.addByte((byte)c.getKickRights());
     pb.addByte((byte)c.getUserList().Count);
     foreach (ClanUser list in c.getUserList())
     {
         Player p = list.getClanMember();
         pb.addLong(p.getLoginDetails().getLongName());
         pb.addUShort(p.getWorld());
         int rights = Convert.ToInt32(list.getClanRights());
         pb.addByte((byte)rights);
         pb.addString("Server " + p.getWorld());
     }
     connection.SendPacket(pb.toPacket());
 }
        public void newClanMessage(Clan c, ChatMessage chatMessage) {
			PacketBuilder pb = new PacketBuilder();
            pb.setId(54).setSize(Packet.Size.VariableByte);
            pb.addLong(chatMessage.getPlayer().getLoginDetails().getLongName());
            pb.addByte((byte)1); // dummy
            pb.addLong(misc.playerNameToLong(c.getClanName()));
            pb.addUShort(0); // some message counter bs
            string message = chatMessage.getChatText();
			int messageCounter = player.getFriends().getNextUniqueId();
            pb.addThreeBytes(messageCounter);
            pb.addByte((byte)chatMessage.getPlayer().getRights());
            pb.addBytes(chatMessage.getPacked());
            connection.SendPacket(pb.toPacket());
        }
        public void sendIgnores(long[] names) {
		    PacketBuilder pb  = new PacketBuilder().setId(126).setSize(Packet.Size.VariableShort);
		    foreach(long name in names) {
                pb.addLong(name);
		    }
            connection.SendPacket(pb.toPacket());
	    }
        private static void appendAppearanceUpdate(Player p, PacketBuilder updateBlock)
        {
            PacketBuilder playerProps = new PacketBuilder().setSize(Packet.Size.Bare);

            Appearance app = p.getAppearance();

            playerProps.addByte((byte)(app.getGender() & 0xFF));
            if ((app.getGender() & 0x2) == 2)
            {
                playerProps.addByte((byte)0);
                playerProps.addByte((byte)0);
            }
            playerProps.addByte((byte)p.getPrayers().getPkIcon());
            playerProps.addByte((byte)p.getPrayers().getHeadIcon());
            if (!app.isInvisible())
            {
                if (!app.isNpc())
                {
                    for (int i = 0; i < 4; i++)
                    {
                        if (p.getEquipment().getItemInSlot((ItemData.EQUIP)i) != -1)
                        {
                            playerProps.addUShort(32768 + p.getEquipment().getSlot((ItemData.EQUIP)i).getDefinition().getEquipId());
                        }
                        else
                        {
                            playerProps.addByte((byte)0);
                        }
                    }
                    if (p.getEquipment().getItemInSlot(ItemData.EQUIP.CHEST) != -1)
                    {
                        playerProps.addUShort(32768 + p.getEquipment().getSlot(ItemData.EQUIP.CHEST).getDefinition().getEquipId());
                    }
                    else
                    {
                        playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.AMULET));
                    }
                    if (p.getEquipment().getItemInSlot(ItemData.EQUIP.SHIELD) != -1)
                    {
                        playerProps.addUShort(32768 + p.getEquipment().getSlot(ItemData.EQUIP.SHIELD).getDefinition().getEquipId());
                    }
                    else
                    {
                        playerProps.addByte((byte)0);
                    }
                    Item chest = p.getEquipment().getSlot(ItemData.EQUIP.CHEST);
                    if (chest != null && chest.getDefinition() != null)
                    {
                        if (!ItemData.isFullBody(chest.getDefinition()))
                        {
                            playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.WEAPON));
                        }
                        else
                        {
                            playerProps.addByte((byte)0);
                        }
                    }
                    else
                    {
                        playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.WEAPON));
                    }
                    if (p.getEquipment().getItemInSlot(ItemData.EQUIP.LEGS) != -1)
                    {
                        playerProps.addUShort(32768 + p.getEquipment().getSlot(ItemData.EQUIP.LEGS).getDefinition().getEquipId());
                    }
                    else
                    {
                        playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.SHIELD));
                    }
                    Item hat = p.getEquipment().getSlot(ItemData.EQUIP.HAT);
                    if (hat != null && hat.getDefinition() != null)
                    {
                        if (!ItemData.isFullHat(hat.getDefinition()) && !ItemData.isFullMask(hat.getDefinition()))
                        {
                            playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.HAT));
                        }
                        else
                        {
                            playerProps.addByte((byte)0);
                        }
                    }
                    else
                    {
                        playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.HAT));
                    }
                    if (p.getEquipment().getItemInSlot(ItemData.EQUIP.HANDS) != -1)
                    {
                        playerProps.addUShort(32768 + p.getEquipment().getSlot(ItemData.EQUIP.HANDS).getDefinition().getEquipId());
                    }
                    else
                    {
                        playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.CHEST));
                    }
                    if (p.getEquipment().getItemInSlot(ItemData.EQUIP.FEET) != -1)
                    {
                        playerProps.addUShort(32768 + p.getEquipment().getSlot(ItemData.EQUIP.FEET).getDefinition().getEquipId());
                    }
                    else
                    {
                        playerProps.addUShort(0x100 + app.getLook(6));
                    }
                    if (hat != null && hat.getDefinition() != null)
                    {
                        if (!ItemData.isFullMask(hat.getDefinition()))
                        {
                            playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.CAPE));
                        }
                        else
                        {
                            playerProps.addByte((byte)0);
                        }
                    }
                    else
                    {
                        playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.CAPE));
                    }
                }
                else
                {
                    playerProps.addUShort(-1);
                    playerProps.addUShort(app.getNpcId());
                    playerProps.addByte((byte)255);
                }
            }
            else
            {
                for (int i = 0; i < 12; i++)
                {
                    playerProps.addByte((byte)0);
                }
            }
            foreach (int colour in app.getColoursArray())
            {
                playerProps.addByte((byte)colour);
            }
            playerProps.addUShort(p.getEquipment().getStandWalkAnimation());
            playerProps.addLong(p.getLoginDetails().getLongName());
            playerProps.addByte((byte)p.getSkills().getCombatLevel());
            playerProps.addUShort(0);
            playerProps.addByte((byte)0);
            updateBlock.addByteA((byte)(playerProps.getLength() & 0xFF));
            updateBlock.addBytes(playerProps.toPacket().getData(), 0, playerProps.getLength());
        }