invertika_game.Game.Inventory.sendFull C# (CSharp) Method

sendFull() public method

public sendFull ( ) : void
return void
        public void sendFull()
        {
            ///* Sends all the information needed to construct inventory
            //   and equipment to the client */
            //MessageOut m(GPMSG_INVENTORY_FULL);

            //m.writeInt16(mPoss.inventory.size());
            //for (InventoryData::const_iterator l = mPoss.inventory.begin(),
            //     l_end = mPoss.inventory.end(); l != l_end; ++l)
            //{
            //    assert(l.second.itemId);
            //    m.writeInt16(l.first); // Slot id
            //    m.writeInt16(l.second.itemId);
            //    m.writeInt16(l.second.amount);
            //}

            //for (EquipData::const_iterator k = mPoss.equipSlots.begin(),
            //     k_end = mPoss.equipSlots.end();
            //     k != k_end;
            //     ++k)
            //{
            //    m.writeInt16(k.first);                 // Equip slot id
            //    m.writeInt16(k.second.itemId);         // Item id
            //    m.writeInt16(k.second.itemInstance);   // Item instance
            //}

            //gameHandler.sendTo(mCharacter, m);
        }

Usage Example

Example #1
0
        public void tokenMatched(NetComputer client, object data)
        {
            GameClient computer=(GameClient)client;
            Character character=(Character)data;

            computer.character=character;
            computer.status=(int)AccountClientStatus.CLIENT_CONNECTED;

            character.setClient(computer);

            MessageOut result=new MessageOut(Protocol.GPMSG_CONNECT_RESPONSE);

            if(!GameState.insert(character))
            {
                result.writeInt8((int)ErrorMessage.ERRMSG_SERVER_FULL);
                kill(character);
                //delete character;
                computer.disconnect(result);
                return;
            }

            result.writeInt8((int)ErrorMessage.ERRMSG_OK);
            computer.send(result);

            // Force sending the whole character to the client.
            Inventory inv=new Inventory(character);
            inv.sendFull();
            character.modifiedAllAttribute();

            foreach(KeyValuePair<int, int> pair in character.mExperience)
            {
                character.updateDerivedAttributes((uint)pair.Key);
            }
        }