getModelId() public method

public getModelId ( ) : uint
return uint
Beispiel #1
0
        private void createCharacterRSI(byte[] packet, NetworkStream client)
        {
            // Instance the Data Loader
            DataLoader ItemLoader = DataLoader.getInstance();

            isNewCreatedChar = true;

            string debugHexPacket = StringUtils.bytesToString_NS(packet);

            // lets read the values
            // the IDs for the Appeareance is always uint16 goID
            byte[] bodyTypeIDByte         = new byte[4];
            byte[] professionByte         = new byte[4];
            byte[] facialdetailBytes      = new byte[4];
            byte[] facialdetailColorBytes = new byte[4];
            byte[] hairBytes      = new byte[4];
            byte[] hairColorBytes = new byte[4];
            byte[] skintoneBytes  = new byte[4];
            byte[] tatooBytes     = new byte[4];
            byte[] headIDBytes    = new byte[4];

            // Clothing
            byte[] shirtIDBytes     = new byte[4];
            byte[] pantsIDBytes     = new byte[4];
            byte[] outerwearIDBytes = new byte[4];
            byte[] hatIDBytes       = new byte[4];
            byte[] eyewearIDBytes   = new byte[4];
            byte[] footwearIDBytes  = new byte[4];
            byte[] glovesIDBytes    = new byte[4];
            //byte[] legginsIDBytes           = new byte[4];

            // RSI
            ArrayUtils.copy(packet, 3, skintoneBytes, 0, 2);        // Done!
            ArrayUtils.copy(packet, 7, bodyTypeIDByte, 0, 2);       // Done!
            ArrayUtils.copy(packet, 15, hairBytes, 0, 2);           // Done!
            ArrayUtils.copy(packet, 19, hairColorBytes, 0, 2);      // Done!
            ArrayUtils.copy(packet, 23, tatooBytes, 0, 2);          // Done!
            ArrayUtils.copy(packet, 27, headIDBytes, 0, 2);
            ArrayUtils.copy(packet, 31, facialdetailBytes, 0, 2);
            ArrayUtils.copy(packet, 35, facialdetailColorBytes, 0, 2);
            ArrayUtils.copy(packet, 67, professionByte, 0, 2);

            UInt16 body       = 0;
            UInt16 gender     = 0;
            UInt32 bodyTypeId = NumericalUtils.ByteArrayToUint32(bodyTypeIDByte, 1);

            UInt16 hairId            = NumericalUtils.ByteArrayToUint16(hairBytes, 1);
            UInt16 haircolor         = NumericalUtils.ByteArrayToUint16(hairColorBytes, 1);
            UInt16 tattoo            = NumericalUtils.ByteArrayToUint16(tatooBytes, 1);
            UInt16 facialDetailColor = NumericalUtils.ByteArrayToUint16(facialdetailColorBytes, 1);
            UInt16 skintone          = NumericalUtils.ByteArrayToUint16(skintoneBytes, 1);
            UInt16 headID            = NumericalUtils.ByteArrayToUint16(headIDBytes, 1);

            // Get Values by "NewRSI" IDs
            NewRSIItem hairItem = ItemLoader.getNewRSIItemByTypeAndID("HAIR", hairId);
            NewRSIItem bodyItem = ItemLoader.getNewRSIItemByTypeAndID("BODY", (ushort)bodyTypeId);
            NewRSIItem headItem = ItemLoader.getNewRSIItemByTypeAndID("HEAD", headID);

            Store.dbManager.MarginDbHandler.updateRSIValue("body", bodyItem.internalId.ToString(), newCharID);
            Store.dbManager.MarginDbHandler.updateRSIValue("sex", bodyItem.gender.ToString(), newCharID);
            Store.dbManager.MarginDbHandler.updateRSIValue("face", headItem.internalId.ToString(), newCharID);              // ToDo:
            Store.dbManager.MarginDbHandler.updateRSIValue("hair", hairItem.internalId.ToString(), newCharID);
            Store.dbManager.MarginDbHandler.updateRSIValue("haircolor", haircolor.ToString(), newCharID);                   // ToDo: check if it is correct
            Store.dbManager.MarginDbHandler.updateRSIValue("tattoo", tattoo.ToString(), newCharID);                         // ToDo:
            Store.dbManager.MarginDbHandler.updateRSIValue("facialdetailcolor", facialDetailColor.ToString(), newCharID);   // ToDo:
            Store.dbManager.MarginDbHandler.updateRSIValue("skintone", skintone.ToString(), newCharID);
            // Clothing Items
            // ToDo: GLOVES ARE MISSING!
            ArrayUtils.copy(packet, 43, shirtIDBytes, 0, 2);
            ArrayUtils.copy(packet, 47, glovesIDBytes, 0, 2);
            ArrayUtils.copy(packet, 55, pantsIDBytes, 0, 2);
            ArrayUtils.copy(packet, 51, outerwearIDBytes, 0, 2);
            ArrayUtils.copy(packet, 34, hatIDBytes, 0, 2);
            ArrayUtils.copy(packet, 39, eyewearIDBytes, 0, 2);
            ArrayUtils.copy(packet, 63, footwearIDBytes, 0, 2);

            ClothingItem shirt     = ItemLoader.getItemValues(NumericalUtils.ByteArrayToUint16(shirtIDBytes, 1));
            ClothingItem pants     = ItemLoader.getItemValues(NumericalUtils.ByteArrayToUint16(pantsIDBytes, 1));
            ClothingItem outerwear = ItemLoader.getItemValues(NumericalUtils.ByteArrayToUint16(outerwearIDBytes, 1));
            ClothingItem hat       = ItemLoader.getItemValues(NumericalUtils.ByteArrayToUint16(hatIDBytes, 1));
            ClothingItem eyewear   = ItemLoader.getItemValues(NumericalUtils.ByteArrayToUint16(eyewearIDBytes, 1));
            ClothingItem footwear  = ItemLoader.getItemValues(NumericalUtils.ByteArrayToUint16(footwearIDBytes, 1));
            ClothingItem gloves    = ItemLoader.getItemValues(NumericalUtils.ByteArrayToUint16(glovesIDBytes, 1));


            Store.dbManager.MarginDbHandler.updateRSIValue("hat", hat.getModelId().ToString(), newCharID);
            Store.dbManager.MarginDbHandler.updateRSIValue("shirt", shirt.getModelId().ToString(), newCharID);
            Store.dbManager.MarginDbHandler.updateRSIValue("shirtcolor", shirt.getModelId().ToString(), newCharID);
            Store.dbManager.MarginDbHandler.updateRSIValue("coat", outerwear.getModelId().ToString(), newCharID);
            Store.dbManager.MarginDbHandler.updateRSIValue("coatcolor", outerwear.getModelId().ToString(), newCharID);
            Store.dbManager.MarginDbHandler.updateRSIValue("pants", pants.getModelId().ToString(), newCharID);
            Store.dbManager.MarginDbHandler.updateRSIValue("pantscolor", pants.getModelId().ToString(), newCharID);
            Store.dbManager.MarginDbHandler.updateRSIValue("shoes", pants.getModelId().ToString(), newCharID);
            Store.dbManager.MarginDbHandler.updateRSIValue("shoecolor", pants.getModelId().ToString(), newCharID);
            Store.dbManager.MarginDbHandler.updateRSIValue("glasses", pants.getModelId().ToString(), newCharID);
            Store.dbManager.MarginDbHandler.updateRSIValue("glassescolor", pants.getModelId().ToString(), newCharID);

            // ToDO: Figre out the ITem Slots for "currentlyWearing" Items and add the ITems correctly to the Inventory

            // FirstName
            UInt16 currentOffset = 79;

            byte[] firstNameLenBytes = new byte[2];
            ArrayUtils.copy(packet, currentOffset, firstNameLenBytes, 0, 2);
            UInt16 firstNameLen = NumericalUtils.ByteArrayToUint16(firstNameLenBytes, 1);

            currentOffset += 2;

            byte[] firstNameBytes = new byte[NumericalUtils.ByteArrayToUint16(firstNameLenBytes, 1) - 1];
            ArrayUtils.copy(packet, currentOffset, firstNameBytes, 0, firstNameLen - 1);
            string firstNameString = StringUtils.charBytesToString(firstNameBytes);

            currentOffset += firstNameLen;

            // LastName
            byte[] lastNameLenBytes = new byte[2];
            ArrayUtils.copy(packet, currentOffset, lastNameLenBytes, 0, 2);
            UInt16 lastNameLen = NumericalUtils.ByteArrayToUint16(lastNameLenBytes, 1);

            currentOffset += 2;

            byte[] lastNameBytes = new byte[NumericalUtils.ByteArrayToUint16(lastNameLenBytes, 1) - 1];
            ArrayUtils.copy(packet, currentOffset, lastNameBytes, 0, lastNameLen - 1);
            string lastNameString = StringUtils.charBytesToString(lastNameBytes);

            currentOffset += lastNameLen;

            // Description
            byte[] descriptionLenBytes = new byte[2];
            ArrayUtils.copy(packet, currentOffset, descriptionLenBytes, 0, 2);
            UInt16 descriptionLen = NumericalUtils.ByteArrayToUint16(descriptionLenBytes, 1);

            currentOffset += 2;

            byte[] descriptionBytes = new byte[NumericalUtils.ByteArrayToUint16(descriptionLenBytes, 1) - 1];
            ArrayUtils.copy(packet, currentOffset, descriptionBytes, 0, descriptionLen - 1);
            string descriptionString = StringUtils.charBytesToString(descriptionBytes);

            currentOffset += lastNameLen;

            // Update Characters values
            Store.dbManager.MarginDbHandler.updateCharacter(firstNameString, lastNameString, descriptionString, newCharID);

            // Add the Basic Abilitys...
            Store.dbManager.MarginDbHandler.addAbility(-2147481600, 0, newCharID, 1, 1);
            Store.dbManager.MarginDbHandler.addAbility(-2147367936, 1, newCharID, 1, 1);
            Store.dbManager.MarginDbHandler.addAbility(-2147294208, 2, newCharID, 0, 1);
            Store.dbManager.MarginDbHandler.addAbility(-2147281920, 3, newCharID, 0, 0);
            Store.dbManager.MarginDbHandler.addAbility(-2147280896, 4, newCharID, 0, 0);
            Store.dbManager.MarginDbHandler.addAbility(-2147437568, 5, newCharID, 1, 1);
            Store.dbManager.MarginDbHandler.addAbility(-2147425280, 6, newCharID, 0, 0);
            Store.dbManager.MarginDbHandler.addAbility(-2147404800, 7, newCharID, 0, 0);
            Store.dbManager.MarginDbHandler.addAbility(-2147445760, 8, newCharID, 0, 0);
            Store.dbManager.MarginDbHandler.addAbility(-2146493440, 9, newCharID, 0, 0);
            Store.dbManager.MarginDbHandler.addAbility(-2146453504, 10, newCharID, 1, 0);

            // we have all created - lets load the charData
            loadCharacter(packet, client, this.newCharID);
        }
Beispiel #2
0
        public void processMountItem(ref byte[] rpcData)
        {
            byte sourceSlot = rpcData[0];
            byte destSlot   = rpcData[1];


            UInt32       clothingItemId = Store.dbManager.WorldDbHandler.GetItemGOIDAtInventorySlot(rpcData[0]);
            DataLoader   dataLoader     = DataLoader.getInstance();
            ClothingItem item           = dataLoader.getItemValues(clothingItemId);


            string partModel = null;
            string partColor = null;

            UInt16 toRealSlotId = 0;

            switch (item.getClothesType())
            {
            case "1950892361":
            case "FEMALE HAT":
            case "MALE HAT":
                toRealSlotId = 0x61;
                partModel    = "hat";
                break;

            case "2001027401":
            case "FEMALE GLASSES":
            case "MALE GLASSES":
                toRealSlotId = 0x62;
                partModel    = "glasses";
                partColor    = "glassescolor";
                break;

            case "1750286665":     // New Way but lets stay old values there
            case "FEMALE SHIRT":
            case "MALE SHIRT":
                toRealSlotId = 0x63;
                partModel    = "shirt";
                partColor    = "shirtcolor";
                break;

            case "1816609097":
            case "FEMALE GLOVES":
            case "MALE GLOVES":
                toRealSlotId = 0x64;
                partModel    = "gloves";
                break;

            case "2001682761":
            case "FEMALE COAT":
            case "MALE COAT":
                toRealSlotId = 0x65;
                partModel    = "coat";
                partColor    = "coatcolor";
                break;

            case "1397768521":
            case "MALE PANTS":
            case "FEMALE PANTS":
                toRealSlotId = 0x66;
                partModel    = "pants";
                partColor    = "pantscolor";
                break;

            case "1733050697":
            case "FEMALE LEGGINGS":
                toRealSlotId = 0x67;
                partModel    = "leggins";
                break;

            case "2001092937":
            case "FEMALE SHOES":
            case "MALE SHOES":
                toRealSlotId = 0x68;
                partModel    = "shoes";
                partColor    = "shoecolor";
                break;
            }

            if (partModel != null)
            {
                Store.dbManager.WorldDbHandler.updateRsiPartValue(partModel, item.getModelId());
            }

            if (partColor != null)
            {
                Store.dbManager.WorldDbHandler.updateRsiPartValue(partColor, item.getColorId());
            }
            Store.dbManager.WorldDbHandler.setRsiValues();

            int[] current = Store.currentClient.playerData.getRsiValues();
            Store.currentClient.playerData.setRsiValues(current);
            byte[] rsiData = PacketsUtils.getRSIBytes(current);


            // Move the wear item from the wearing slot to the next new slot (but maybe doesnt work if inventory is full)

            ServerPackets pak = new ServerPackets();

            if (Store.dbManager.WorldDbHandler.isSlotinUseByItem(toRealSlotId))
            {
                UInt16 newSlotId = Store.dbManager.WorldDbHandler.getFirstNewSlot();
                Store.dbManager.WorldDbHandler.updateInventorySlot(toRealSlotId, newSlotId);
                pak.sendInventoryItemMove(toRealSlotId, newSlotId, Store.currentClient);
            }
            pak.sendAppeareanceUpdate(Store.currentClient, rsiData);
            Store.dbManager.WorldDbHandler.updateInventorySlot(sourceSlot, toRealSlotId);
            pak.sendInventoryItemMove(sourceSlot, toRealSlotId, Store.currentClient);
        }
Beispiel #3
0
        private void createCharacterRSI(byte[] packet, NetworkStream client)
        {
            // Instance the Data Loader
            DataLoader itemLoader = DataLoader.getInstance();

            isNewCreatedChar = true;
            string debugHexPacket = StringUtils.bytesToString_NS(packet);

            // ToDo: Replace all with Packet Reader Instance
            PacketReader reader = new PacketReader(packet);

            reader.incrementOffsetByValue(3);


            UInt16 body   = 0;
            UInt16 gender = 0;


            UInt16 skintone = reader.readUInt16(1);

            reader.setOffsetOverrideValue(7);
            UInt16 bodyTypeId = reader.readUInt16(1);

            reader.setOffsetOverrideValue(15);
            UInt16 hairId = reader.readUInt16(1);

            reader.setOffsetOverrideValue(19);
            UInt16 haircolor = reader.readUInt16(1);

            reader.setOffsetOverrideValue(23);
            UInt16 tattoo = reader.readUInt16(1);

            reader.setOffsetOverrideValue(27);
            UInt16 headId = reader.readUInt16(1);

            reader.setOffsetOverrideValue(31);
            UInt16 facialDetail = reader.readUInt16(1);

            reader.setOffsetOverrideValue(35);
            // ToDo: it has a bug - figure out correct position
            UInt16 facialDetailColor = reader.readUInt16(1);

            // ToDo: Remove this when facialDetailColor is parsed properly
            facialDetailColor = 0;
            reader.setOffsetOverrideValue(67);
            UInt16 profession = reader.readUInt16(1);


            // lets read the values
            // the IDs for the Appeareance is always uint16 goID
            // Extra Hint: there are no leggins in Char Creation Process
            reader.setOffsetOverrideValue(35);
            UInt16 hatId = reader.readUInt16(1);

            reader.setOffsetOverrideValue(39);
            UInt16 eyewearId = reader.readUInt16(1);

            reader.setOffsetOverrideValue(43);
            UInt16 shirtId = reader.readUInt16(1);

            reader.setOffsetOverrideValue(47);
            UInt16 glovesId = reader.readUInt16(1);

            reader.setOffsetOverrideValue(51);
            UInt16 outerwearId = reader.readUInt16(1);

            reader.setOffsetOverrideValue(55);
            UInt16 pantsId = reader.readUInt16(1);

            reader.setOffsetOverrideValue(63);
            UInt16 footwearId = reader.readUInt16(1);


            // Get Values by "NewRSI" IDs
            NewRSIItem hairItem = itemLoader.getNewRSIItemByTypeAndID("HAIR", hairId);
            NewRSIItem bodyItem = itemLoader.getNewRSIItemByTypeAndID("BODY", (ushort)bodyTypeId);
            NewRSIItem headItem = itemLoader.getNewRSIItemByTypeAndID("HEAD", headId);

            Store.dbManager.MarginDbHandler.updateRSIValue("body", bodyItem.internalId.ToString(), newCharID);
            Store.dbManager.MarginDbHandler.updateRSIValue("sex", bodyItem.gender.ToString(), newCharID);
            Store.dbManager.MarginDbHandler.updateRSIValue("face", headItem.internalId.ToString(), newCharID);              // ToDo:
            Store.dbManager.MarginDbHandler.updateRSIValue("hair", hairItem.internalId.ToString(), newCharID);
            Store.dbManager.MarginDbHandler.updateRSIValue("haircolor", haircolor.ToString(), newCharID);                   // ToDo: check if it is correct
            Store.dbManager.MarginDbHandler.updateRSIValue("tattoo", tattoo.ToString(), newCharID);                         // ToDo:
            Store.dbManager.MarginDbHandler.updateRSIValue("facialdetail", facialDetail.ToString(), newCharID);             // ToDo:
            Store.dbManager.MarginDbHandler.updateRSIValue("facialdetailcolor", facialDetailColor.ToString(), newCharID);   // ToDo:
            Store.dbManager.MarginDbHandler.updateRSIValue("skintone", skintone.ToString(), newCharID);


            // Clothing Items
            ClothingItem shirt     = itemLoader.getItemValues(shirtId);
            ClothingItem pants     = itemLoader.getItemValues(pantsId);
            ClothingItem outerwear = itemLoader.getItemValues(outerwearId);
            ClothingItem hat       = itemLoader.getItemValues(hatId);
            ClothingItem eyewear   = itemLoader.getItemValues(eyewearId);
            ClothingItem footwear  = itemLoader.getItemValues(footwearId);
            ClothingItem gloves    = itemLoader.getItemValues(glovesId);

            Store.dbManager.MarginDbHandler.updateRSIValue("hat", hat.getModelId().ToString(), newCharID);
            Store.dbManager.MarginDbHandler.updateRSIValue("shirt", shirt.getModelId().ToString(), newCharID);
            Store.dbManager.MarginDbHandler.updateRSIValue("shirtcolor", shirt.getColorId().ToString(), newCharID);
            Store.dbManager.MarginDbHandler.updateRSIValue("coat", outerwear.getModelId().ToString(), newCharID);
            Store.dbManager.MarginDbHandler.updateRSIValue("coatcolor", outerwear.getColorId().ToString(), newCharID);
            Store.dbManager.MarginDbHandler.updateRSIValue("pants", pants.getModelId().ToString(), newCharID);
            Store.dbManager.MarginDbHandler.updateRSIValue("pantscolor", pants.getColorId().ToString(), newCharID);
            Store.dbManager.MarginDbHandler.updateRSIValue("shoes", footwear.getModelId().ToString(), newCharID);
            Store.dbManager.MarginDbHandler.updateRSIValue("shoecolor", footwear.getColorId().ToString(), newCharID);
            Store.dbManager.MarginDbHandler.updateRSIValue("glasses", eyewear.getModelId().ToString(), newCharID);
            Store.dbManager.MarginDbHandler.updateRSIValue("glassescolor", eyewear.getColorId().ToString(), newCharID);
            Store.dbManager.MarginDbHandler.updateRSIValue("gloves", gloves.getModelId().ToString(), newCharID);

            Store.dbManager.MarginDbHandler.AddItemToSlot(hatId, 0x61, newCharID);
            Store.dbManager.MarginDbHandler.AddItemToSlot(eyewearId, 0x62, newCharID);
            Store.dbManager.MarginDbHandler.AddItemToSlot(shirtId, 0x63, newCharID);
            Store.dbManager.MarginDbHandler.AddItemToSlot(glovesId, 0x64, newCharID);
            Store.dbManager.MarginDbHandler.AddItemToSlot(outerwearId, 0x65, newCharID);
            Store.dbManager.MarginDbHandler.AddItemToSlot(pantsId, 0x66, newCharID);
            Store.dbManager.MarginDbHandler.AddItemToSlot(footwearId, 0x68, newCharID);


            // FirstName
            UInt16 currentOffset = 79;

            byte[] firstNameLenBytes = new byte[2];
            ArrayUtils.copy(packet, currentOffset, firstNameLenBytes, 0, 2);
            UInt16 firstNameLen = NumericalUtils.ByteArrayToUint16(firstNameLenBytes, 1);

            currentOffset += 2;

            byte[] firstNameBytes = new byte[NumericalUtils.ByteArrayToUint16(firstNameLenBytes, 1) - 1];
            ArrayUtils.copy(packet, currentOffset, firstNameBytes, 0, firstNameLen - 1);
            string firstNameString = StringUtils.charBytesToString(firstNameBytes);

            currentOffset += firstNameLen;

            // LastName
            byte[] lastNameLenBytes = new byte[2];
            ArrayUtils.copy(packet, currentOffset, lastNameLenBytes, 0, 2);
            UInt16 lastNameLen = NumericalUtils.ByteArrayToUint16(lastNameLenBytes, 1);

            currentOffset += 2;

            byte[] lastNameBytes = new byte[NumericalUtils.ByteArrayToUint16(lastNameLenBytes, 1) - 1];
            ArrayUtils.copy(packet, currentOffset, lastNameBytes, 0, lastNameLen - 1);
            string lastNameString = StringUtils.charBytesToString(lastNameBytes);

            currentOffset += lastNameLen;

            // Description
            byte[] descriptionLenBytes = new byte[2];
            ArrayUtils.copy(packet, currentOffset, descriptionLenBytes, 0, 2);
            UInt16 descriptionLen = NumericalUtils.ByteArrayToUint16(descriptionLenBytes, 1);

            currentOffset += 2;

            byte[] descriptionBytes = new byte[NumericalUtils.ByteArrayToUint16(descriptionLenBytes, 1) - 1];
            ArrayUtils.copy(packet, currentOffset, descriptionBytes, 0, descriptionLen - 1);
            string descriptionString = StringUtils.charBytesToString(descriptionBytes);

            currentOffset += lastNameLen;

            // Update Characters values
            Store.dbManager.MarginDbHandler.updateCharacter(firstNameString, lastNameString, descriptionString, newCharID);

            // Add the Basic Abilitys...
            addStartAbilitys(newCharID);

            // we have all created - lets load the charData
            loadCharacter(packet, client, this.newCharID);
        }