aorecomp

Anarchy Online classic in the browser

git clone https://aorecomp.ubeagle.com/code/aorecomp.git


server/item_addition.go (641B)


      1 package main
      2 
      3 import "encoding/binary"
      4 
      5 func inventoryAdditionPacket(player *character, item ownedItem) []byte {
      6 	// Live weapons/containers need their original subclass and first-free sentinel.
      7 	item.Slot = 111
      8 	if item.isPortableContainer() {
      9 		return backpackPacket(player.id, player.playfield, item, 104)
     10 	}
     11 	if item.Type == 51018 {
     12 		return weaponPacket(player.id, player.playfield, item, 104)
     13 	}
     14 	var body []byte
     15 	low, high := item.templateIDs()
     16 	for _, value := range []uint32{low, high, item.Quality, uint32(item.Count)} {
     17 		body = binary.BigEndian.AppendUint32(body, value)
     18 	}
     19 	return n3Packet(0x052e2f0c, 50000, player.id, body)
     20 }