protected override void ReadItem(int index)
        {
            StoC_0x02_InventoryUpdate.Item item = new StoC_0x02_InventoryUpdate.Item();

            item.slot = ReadByte();
            item.level = ReadByte();

            item.value1 = ReadByte();
            item.value2 = ReadByte();

            item.hand = ReadByte();
            byte temp = ReadByte(); //WriteByte((byte) ((item.Type_Damage*64) + item.Object_Type));
            item.damageType = (byte)(temp >> 6);
            item.objectType = (byte)(temp & 0x3F);
            item.weight = ReadShort();
            item.condition = ReadByte();
            item.durability = ReadByte();
            item.quality = ReadByte();
            item.bonus = ReadByte();
            item.model = ReadShort();
            item.extension = ReadByte();
            item.color = ReadShort();
            item.flag = ReadByte();
            item.effect = ReadByte();
            item.name = ReadPascalString();

            items[index] = item;
        }
        protected override void ReadItem(int index)
        {
            StoC_0x02_InventoryUpdate.Item item = new StoC_0x02_InventoryUpdate.Item();

            item.slot  = ReadByte();
            item.level = ReadByte();

            item.value1 = ReadByte();
            item.value2 = ReadByte();

            item.hand = ReadByte();
            byte temp = ReadByte();             //WriteByte((byte) ((item.Type_Damage*64) + item.Object_Type));

            item.damageType = (byte)(temp >> 6);
            item.objectType = (byte)(temp & 0x3F);
            item.weight     = ReadShort();
            item.condition  = ReadByte();
            item.durability = ReadByte();
            item.quality    = ReadByte();
            item.bonus      = ReadByte();
            item.model      = ReadShort();
            item.extension  = ReadByte();
            item.color      = ReadShort();
            item.flag       = ReadByte();
            item.effect     = ReadByte();
            item.name       = ReadPascalString();

            items[index] = item;
        }
            public override void MakeString(TextWriter text, bool flagsDescription)
            {
                text.Write("\n\tQuestName: \"{0}\"\n\tQuestDesc: \"{1}\"", questName, questDesc);
                text.Write("\n\tlen:{0} message:\"{1}\"", dialogLen, message);
                text.Write("\n\tquestID:0x{0:X4} goalsCount:{1}", questID, goalsCount);
                for (int i = 0; i < goalsCount; i++)
                {
                    text.Write("\n\t[{0}]: \"{1}\"", i, goals[i]);
                }

                text.Write("\n\tMoney_Reward:{0} Exp:{1:00.0}% baseRewardsCount:{2}", MoneyRewardFormatted(moneyReward), rewardExp, baseRewardsCount);

                for (int i = 0; i < baseRewardsCount; i++)
                {
                    StoC_0x02_InventoryUpdate.Item item = baseRewards[i];

                    text.Write("\n\t[{0}]: level:{1,-2} value1:0x{2:X2} value2:0x{3:X2} hand:0x{4:X2} damageType:0x{5:X2} objectType:0x{6:X2} weight:{7,-4} con:{8,-3} dur:{9,-3} qual:{10,-3} bonus:{11,-2} model:0x{12:X4} color:0x{13:X4} effect:0x{14:X2} flag:0x{15:X2} extension:{16} unk_1112:0x{18:X2} bonus level:{19:X2} itemID:{20} \"{17}\"",
                               i, item.level, item.value1, item.value2, item.hand, item.damageType, item.objectType, item.weight, item.condition, item.durability, item.quality, item.bonus, item.model, item.color, item.effect, item.flag, item.extension, item.name, item.unk1_1112, item.bonus_level, item.itemID);
                    if (flagsDescription && item.name != null && item.name != "")
                    {
                        text.Write(" ({0})", (StoC_0x02_InventoryUpdate.eObjectType)item.objectType);
                    }
                    if ((item.flag & 0x08) == 0x08)
                    {
                        text.Write("\n\t\teffectIcon:0x{0:X4}  effectName:\"{1}\"",
                                   item.effectIcon, item.effectName);
                    }
                    if ((item.flag & 0x10) == 0x10)
                    {
                        text.Write("\n\t\teffectIcon2:0x{0:X4}  effectName2:\"{1}\"",
                                   item.effectIcon2, item.effectName2);
                    }
                }
                text.Write("\n\toptionalRewardsChoiceMax:{0} optionalRewardsCount:{1}", optionalRewardsChoiceMax, optionalRewardsCount);
                for (int i = 0; i < optionalRewardsCount; i++)
                {
                    StoC_0x02_InventoryUpdate.Item item = optionalRewards[i];

                    text.Write("\n\t[{0}]: level:{1,-2} value1:0x{2:X2} value2:0x{3:X2} hand:0x{4:X2} damageType:0x{5:X2} objectType:0x{6:X2} weight:{7,-4} con:{8,-3} dur:{9,-3} qual:{10,-3} bonus:{11,-2} model:0x{12:X4} color:0x{13:X4} effect:0x{14:X2} flag:0x{15:X2} extension:{16} unk_1112:0x{18:X2} bonus level:{19:X2} itemID:{20} \"{17}\"",
                               i, item.level, item.value1, item.value2, item.hand, item.damageType, item.objectType, item.weight, item.condition, item.durability, item.quality, item.bonus, item.model, item.color, item.effect, item.flag, item.extension, item.name, item.unk1_1112, item.bonus_level, item.itemID);
                    if (flagsDescription && item.name != null && item.name != "")
                    {
                        text.Write(" ({0})", (StoC_0x02_InventoryUpdate.eObjectType)item.objectType);
                    }
                    if ((item.flag & 0x08) == 0x08)
                    {
                        text.Write("\n\t\teffectIcon:0x{0:X4}  effectName:\"{1}\"",
                                   item.effectIcon, item.effectName);
                    }
                    if ((item.flag & 0x10) == 0x10)
                    {
                        text.Write("\n\t\teffectIcon2:0x{0:X4}  effectName2:\"{1}\"",
                                   item.effectIcon2, item.effectName2);
                    }
                }
            }
 protected override void WriteItemInfo(int i, TextWriter text, bool flagsDescription)
 {
     StoC_0x02_InventoryUpdate.Item item = items[i];
     text.Write("\n\tslot:{0,-2} level:{1,-2} value1:0x{2:X2} value2:0x{3:X2} hand:0x{4:X2} damageType:0x{5:X2} objectType:0x{6:X2} weight:{7,-4} con:{8,-3} dur:{9,-3} qual:{10,-3} bonus:{11,-2} model:0x{12:X4} extension:{13} color:0x{14:X4} effect:0x{15:X2} flag:0x{16:X2} \"{17}\"",
                item.slot, item.level, item.value1, item.value2, item.hand, item.damageType, item.objectType, item.weight, item.condition, item.durability, item.quality, item.bonus, item.model, item.extension, item.color, item.effect, item.flag, item.name);
     if (flagsDescription && item.name != null && item.name != "")
     {
         text.Write(" ({0})", (StoC_0x02_InventoryUpdate.eObjectType)item.objectType);
     }
 }
示例#5
0
            public override void MakeString(TextWriter text, bool flagsDescription)
            {
                text.Write("index:{0,-2} (NewQuest) NameLen:{1,-3} descLen:{2,-3} goals:{3} level:{4} unk2:{5}", index, lenName, lenDesc, goalsCount, level, unk2);

                if (lenName == 0 && lenDesc == 0)
                {
                    return;
                }
                text.Write("\n\tQuestName: \"{0}\"\n\tQuestDesc: \"{1}\"", name, desc);
                for (int i = 0; i < goalsCount; i++)
                {
                    text.Write("\n\t[{0}]: \"{1}\"", i, goals[i]);

                    QuestGoalInfo questGoalInfo = goalInfo[i];
                    text.Write("\n\tinfo: type:0x{0:X4}",
                               questGoalInfo.type);
                    text.Write("\n\tzoneId2:{0,-3} @X2:{1,-5} @Y2:{2,-5} radius?:{3}",
                               questGoalInfo.zoneId2, questGoalInfo.XOff2, questGoalInfo.YOff2, questGoalInfo.unk2);
                    text.Write("\n\tzoneId1:{0,-3} @X1:{1,-5} @Y1:{2,-5} unk1:0x{3:X4}",
                               questGoalInfo.zoneId, questGoalInfo.XOff, questGoalInfo.YOff, questGoalInfo.unk1);

                    StoC_0x02_InventoryUpdate.Item item = goalItems[i];

                    if (item.slot > 0)
                    {
                        text.Write("\n\tslot:{0,-2} level:{1,-2} value1:0x{2:X2} value2:0x{3:X2} hand:0x{4:X2} damageType:0x{5:X2} objectType:0x{6:X2} weight:{7,-4} con:{8,-3} dur:{9,-3} qual:{10,-3} bonus:{11,-2} model:0x{12:X4} color:0x{13:X4} effect:0x{14:X2} flag:0x{15:X2} extension:{16} \"{17}\"",
                                   item.slot, item.level, item.value1, item.value2, item.hand, item.damageType, item.objectType, item.weight, item.condition, item.durability, item.quality, item.bonus, item.model, item.color, item.effect, item.flag, item.extension, item.name);
                        if (flagsDescription && item.name != null && item.name != "")
                        {
                            text.Write(" ({0})", (StoC_0x02_InventoryUpdate.eObjectType)item.objectType);
                        }
                        if ((item.flag & 0x08) == 0x08)
                        {
                            text.Write("\n\t\teffectIcon:0x{0:X4}  effectName:\"{1}\"",
                                       item.effectIcon, item.effectName);
                        }
                        if ((item.flag & 0x10) == 0x10)
                        {
                            text.Write("\n\t\teffectIcon2:0x{0:X4}  effectName2:\"{1}\"",
                                       item.effectIcon2, item.effectName2);
                        }
                    }
                }
            }
            public override void Init(StoC_0x83_QuestUpdate pak)
            {
                index      = pak.ReadByte();                     // 0x00
                lenName    = pak.ReadByte();                     // 0x01
                unk2       = pak.ReadShortLowEndian();           // 0x02
                goalsCount = pak.ReadByte();                     // 0x04
                level      = pak.ReadByte();                     // 0x05
                name       = pak.ReadString(lenName);            // 0x06
                lenDesc    = pak.ReadByte();
                desc       = pak.ReadString(lenDesc);
                goals      = new string[goalsCount];
                goalInfo   = new QuestGoalInfo[goalsCount];
                goalItems  = new StoC_0x02_InventoryUpdate.Item[goalsCount];
                for (int i = 0; i < goalsCount; i++)
                {
                    ushort goalDescLen = pak.ReadShortLowEndian();
#if SKIP_CR_IN_DESCRIPTION
                    goals[i] = pak.ReadString(goalDescLen - 1); // 0x0A on end string
                    pak.Skip(1);                                // skip 0x0A on end string
#else
                    goals[i] = pak.ReadString(goalDescLen);
#endif
                    QuestGoalInfo questGoalInfo = new QuestGoalInfo();
                    questGoalInfo.zoneId2          = pak.ReadShortLowEndian();
                    questGoalInfo.XOff2            = pak.ReadShortLowEndian();
                    questGoalInfo.YOff2            = pak.ReadShortLowEndian();
                    questGoalInfo.unk2             = pak.ReadShortLowEndian();
                    questGoalInfo.type             = pak.ReadShortLowEndian();
                    questGoalInfo.unk1             = pak.ReadShortLowEndian();
                    questGoalInfo.zoneId           = pak.ReadShortLowEndian();
                    questGoalInfo.XOff             = pak.ReadShortLowEndian();
                    questGoalInfo.YOff             = pak.ReadShortLowEndian();
                    goalInfo[i]                    = questGoalInfo;
                    questGoalInfo.flagGoalFinished = pak.ReadByte();

                    StoC_0x02_InventoryUpdate.Item item = new StoC_0x02_InventoryUpdate.Item();

                    item.slot = pak.ReadByte();
                    if (item.slot > 0)
                    {
                        item.unk1_1115 = pak.ReadShort();
                        item.level     = pak.ReadByte();

                        item.value1 = pak.ReadByte();
                        item.value2 = pak.ReadByte();

                        item.hand = pak.ReadByte();
                        byte temp = pak.ReadByte();                         //WriteByte((byte) ((item.Type_Damage*64) + item.Object_Type));
                        item.damageType = (byte)(temp >> 6);
                        item.objectType = (byte)(temp & 0x3F);
                        item.unk1_1112  = pak.ReadByte();
                        item.weight     = pak.ReadShort();
                        item.condition  = pak.ReadByte();
                        item.durability = pak.ReadByte();
                        item.quality    = pak.ReadByte();
                        item.bonus      = pak.ReadByte();
                        item.unk2_1112  = pak.ReadByte();
                        item.model      = pak.ReadShort();
                        item.extension  = pak.ReadByte();
                        item.color      = pak.ReadShort();
                        item.flag       = pak.ReadByte();
                        if ((item.flag & 0x08) == 0x08)
                        {
                            item.effectIcon = pak.ReadShort();
                            item.effectName = pak.ReadPascalString();
                        }
                        if ((item.flag & 0x10) == 0x10)
                        {
                            item.effectIcon2 = pak.ReadShort();
                            item.effectName2 = pak.ReadPascalString();
                        }
                        item.effect = pak.ReadByte();
                        item.name   = pak.ReadPascalString();
                    }
                    goalItems[i] = item;
                }
            }
			public override void Init(StoC_0x81_ShowDialog pak)
			{
				questName = pak.ReadPascalString(); // 0x0c
				questDesc = pak.ReadPascalString();
				dialogLen = pak.ReadShort();
				message = pak.ReadString(dialogLen);
				questID = pak.ReadShort();
				goalsCount = pak.ReadByte();
				goals = new string[goalsCount];
				for (int i = 0; i < goalsCount; i++)
				{
#if SKIP_CR_IN_DESCRIPTION
					questLevel = pak.ReadByte(); // temporary used
					goals[i] = pak.ReadString(questLevel - 1); // 0x0A on end string
					pak.Skip(1);// skip 0x0A on end string
#else
					goals[i] = pak.ReadPascalString();
#endif
				}
				unk1_194 = pak.ReadShort();
				questLevel = pak.ReadByte();
				rewardGold = pak.ReadByte();
				rewardExp = pak.ReadByte();
				baseRewardsCount = pak.ReadByte();
				baseRewards = new StoC_0x02_InventoryUpdate.Item[baseRewardsCount];
				for (int i = 0; i < baseRewardsCount; i++)
				{
					StoC_0x02_InventoryUpdate.Item item = new StoC_0x02_InventoryUpdate.Item();
					item.unk1_1115 = pak.ReadShort();
					item.level = pak.ReadByte();

					item.value1 = pak.ReadByte();
					item.value2 = pak.ReadByte();

					item.hand = pak.ReadByte();
					byte temp = pak.ReadByte(); //WriteByte((byte) ((item.Type_Damage*64) + item.Object_Type));
					item.damageType = (byte)(temp >> 6);
					item.objectType = (byte)(temp & 0x3F);
					item.unk1_1112 = pak.ReadByte();
					item.weight = pak.ReadShort();
					item.condition = pak.ReadByte();
					item.durability = pak.ReadByte();
					item.quality = pak.ReadByte();
					item.bonus = pak.ReadByte();
					item.unk2_1112 = pak.ReadByte();
					item.model = pak.ReadShort();
					item.extension = pak.ReadByte();
					item.color = pak.ReadShort();
					item.flag = pak.ReadByte();
					if ((item.flag & 0x08) == 0x08)
					{
						item.effectIcon = pak.ReadShort();
						item.effectName = pak.ReadPascalString();
					}
					if ((item.flag & 0x10) == 0x10)
					{
						item.effectIcon2 = pak.ReadShort();
						item.effectName2 = pak.ReadPascalString();
					}
					item.effect = pak.ReadByte();
					item.name = pak.ReadPascalString();
					baseRewards[i] = item;
				}
				optionalRewardsChoiceMax = pak.ReadByte();
				optionalRewardsCount = pak.ReadByte();
				optionalRewards = new StoC_0x02_InventoryUpdate.Item[optionalRewardsCount];
				for (int i = 0; i < optionalRewardsCount; i++)
				{
					StoC_0x02_InventoryUpdate.Item item = new StoC_0x02_InventoryUpdate.Item();
					item.unk1_1115 = pak.ReadShort();
					item.level = pak.ReadByte();

					item.value1 = pak.ReadByte();
					item.value2 = pak.ReadByte();

					item.hand = pak.ReadByte();
					byte temp = pak.ReadByte(); //WriteByte((byte) ((item.Type_Damage*64) + item.Object_Type));
					item.damageType = (byte)(temp >> 6);
					item.objectType = (byte)(temp & 0x3F);
					item.unk1_1112 = pak.ReadByte();
					item.weight = pak.ReadShort();
					item.condition = pak.ReadByte();
					item.durability = pak.ReadByte();
					item.quality = pak.ReadByte();
					item.bonus = pak.ReadByte();
					item.unk2_1112 = pak.ReadByte();
					item.model = pak.ReadShort();
					item.extension = pak.ReadByte();
					item.color = pak.ReadShort();
					item.flag = pak.ReadByte();
					if ((item.flag & 0x08) == 0x08)
					{
						item.effectIcon = pak.ReadShort();
						item.effectName = pak.ReadPascalString();
					}
					if ((item.flag & 0x10) == 0x10)
					{
						item.effectIcon2 = pak.ReadShort();
						item.effectName2 = pak.ReadPascalString();
					}
					item.effect = pak.ReadByte();
					item.name = pak.ReadPascalString();
					optionalRewards[i] = item;
				}
			}
        /// <summary>
        /// Activates a log action.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="selectedPacket">The selected packet.</param>
        /// <returns><c>true</c> if log data tab should be updated.</returns>
        public bool Activate(IExecutionContext context, PacketLocation selectedPacket)
        {
            PacketLog log = context.LogManager.GetPacketLog(selectedPacket.LogIndex);
            int selectedIndex = selectedPacket.PacketIndex;

            int VisibleSlots = 0xFF;
            int weaponSkill = -1;
            double DPS = -1;
            StoC_0x02_InventoryUpdate.Item[] weapons = new StoC_0x02_InventoryUpdate.Item[4];
            Packet charStats = null;

            for (int i = 0; i < selectedIndex; i++)
            {
                Packet pak = log[i];
                if (pak is StoC_0x16_VariousUpdate)
                {
                    StoC_0x16_VariousUpdate stat = (StoC_0x16_VariousUpdate)pak;
                    if (stat.SubCode == 5)
                    {
                        StoC_0x16_VariousUpdate.PlayerStateUpdate subData = (StoC_0x16_VariousUpdate.PlayerStateUpdate)stat.SubData;
                        DPS = subData.weaponDamageHigh + 0.01 * subData.weaponDamageLow;
                        weaponSkill = (subData.weaponSkillHigh << 8) + subData.weaponSkillLow;
                    }
                }
                else if (pak is StoC_0xFB_CharStatsUpdate_175)
                {
                    if ((pak as StoC_0xFB_CharStatsUpdate_175).Flag != 0xFF)
                        charStats = pak;
                }
                else if (pak is StoC_0xFB_CharStatsUpdate)
                {
                    charStats = pak;
                }
                else if (pak is StoC_0x02_InventoryUpdate)
                {
                    StoC_0x02_InventoryUpdate invPack = (StoC_0x02_InventoryUpdate)pak;
                    if (invPack.PreAction == 1 || invPack.PreAction == 0)
                    {
                        VisibleSlots = invPack.VisibleSlots;
                        for (int j = 0; j < invPack.SlotsCount; j++)
                        {
                            StoC_0x02_InventoryUpdate.Item item = (StoC_0x02_InventoryUpdate.Item)invPack.Items[j];
                            switch (item.slot)
                            {
                                case 10:
                                    weapons[0] = item;
            //									Logger.Say(string.Format("{16:X2}\tslot:{0,-2} level:{1,-2} value1:0x{2:X2} value2:0x{3:X2} hand:0x{4:X2} damageType:0x{5:X2} objectType:0x{6:X2} weight:{7,-4} con:{8,-3} dur:{9,-3} qual:{10,-3} bonus:{11,-2} model:0x{12:X4} color:0x{13:X4} effect:0x{14:X2} \"{15}\"",
            //									item.slot, item.level, item.value1, item.value2, item.hand, item.damageType, item.objectType, item.weight, item.condition, item.durability, item.quality, item.bonus, item.model, item.color, item.effect, item.name, invPack.VisibleSlots));
                                    break;
                                case 11:
                                    weapons[1] = item;
                                    break;
                                case 12:
                                    weapons[2] = item;
                                    break;
                                case 13:
                                    weapons[3] = item;
                                    break;
                                default:
                                    break;
                            }
                        }
                    }
                }
            }

            StringBuilder str = new StringBuilder();
            str.AppendFormat("Weapon damage = {0:0.00}\n", DPS);
            str.AppendFormat("Weapon skill  = {0}\n", weaponSkill);
            if (charStats != null)
            {
                str.Append(charStats.GetPacketDataString(true));
                str.AppendFormat("\n");
            }
            str.AppendFormat("\n");
            str.AppendFormat("Visible slots = 0x{0:X2}", VisibleSlots);
            str.AppendFormat("\n");
            //((VisibleSlots & 0x0F) == 0)
            string weaponName1 = "";
            string weaponName2 = "";
            for (int i = 0; i < 4; i++)
            {
                if ((i == (VisibleSlots & 0x0F)) || (i == ((VisibleSlots >> 4) & 0x0F)))
                {
                    StoC_0x02_InventoryUpdate.Item item = (StoC_0x02_InventoryUpdate.Item)weapons[i];
            //					str.AppendFormat("slot:{0,-2} level:{1,-2} value1:0x{2:X2} value2:0x{3:X2} hand:0x{4:X2} damageType:0x{5:X2} objectType:0x{6:X2} weight:{7,-4} con:{8,-3} dur:{9,-3} qual:{10,-3} bonus:{11,-2} model:0x{12:X4} color:0x{13:X4} effect:0x{14:X2} \"{15}\"\n",
            //					item.slot, item.level, item.value1, item.value2, item.hand, item.damageType, item.objectType, item.weight, item.condition, item.durability, item.quality, item.bonus, item.model, item.color, item.effect, item.name);
                    if (item.objectType == 42)//shield
                        str.AppendFormat("slot:{0,-2} level:{1,-2} size:{2} con:{3,-3} qual:{4,-3} bonus:{5,-2} model:0x{6:X4} \"{7}\"",
                        item.slot, item.level, item.value1, item.condition, item.quality, item.bonus, item.model, item.name);
                    else
                        str.AppendFormat("slot:{0,-2} level:{1,-2} dps:{2:0.00} spd:{3:0.00} damageType:{4} con:{5,-3} qual:{6,-3} bonus:{7,-2} model:0x{8:X4} \"{9}\"",
                        item.slot, item.level, 0.1 * item.value1, 0.1 * item.value2, item.damageType, item.condition, item.quality, item.bonus, item.model, item.name);
                    str.AppendFormat(" ({0})\n", (StoC_0x02_InventoryUpdate.eObjectType)item.objectType);
                    if (weaponName1 == "")
                        weaponName1 = item.name;
                    else if (item.name != weaponName1)
                        weaponName2 = item.name;
                }
            }

            for (int i = 0; i < log.Count; i++)
            {
                if (weaponName1 == "" && weaponName2 == "")
                    break;
                Packet pak = log[i];
                if (pak is StoC_0xC4_CustomTextWindow)
                {
                    if (weaponName1 != "" && (pak as StoC_0xC4_CustomTextWindow).Caption == weaponName1)
                    {
                        str.Append('\n');
                        str.Append(pak.GetPacketDataString(true));
                        weaponName1 = "";
                    }
                    else if (weaponName2 != "" && (pak as StoC_0xC4_CustomTextWindow).Caption == weaponName2)
                    {
                        str.Append('\n');
                        str.Append(pak.GetPacketDataString(true));
                        weaponName2 = "";
                    }
                }
            }

            InfoWindowForm infoWindow = new InfoWindowForm();
            infoWindow.Text = "Player weapon info (right click to close)";
            infoWindow.Width = 800;
            if (charStats == null)
                infoWindow.Height = 300;
            else
                infoWindow.Height = 400;
            infoWindow.InfoRichTextBox.Text = str.ToString();
            infoWindow.StartWindowThread();

            return false;
        }
			public override void Init(StoC_0x83_QuestUpdate pak)
			{
				index = pak.ReadByte();          // 0x00
				lenName = pak.ReadByte();        // 0x01
				unk2 = pak.ReadShortLowEndian(); // 0x02
				goalsCount = pak.ReadByte();     // 0x04
				level = pak.ReadByte();          // 0x05
				name = pak.ReadString(lenName);  // 0x06
				lenDesc = pak.ReadByte();
				desc = pak.ReadString(lenDesc);
				goals = new string[goalsCount];
				goalInfo = new QuestGoalInfo[goalsCount];
				goalItems = new StoC_0x02_InventoryUpdate.Item[goalsCount];
				for (int i = 0; i < goalsCount; i++)
				{
					ushort goalDescLen = pak.ReadShortLowEndian();
#if SKIP_CR_IN_DESCRIPTION
					goals[i] = pak.ReadString(goalDescLen - 1); // 0x0A on end string
					pak.Skip(1);// skip 0x0A on end string
#else
					goals[i] = pak.ReadString(goalDescLen);
#endif
					QuestGoalInfo questGoalInfo = new QuestGoalInfo();
					questGoalInfo.zoneId2 = pak.ReadShortLowEndian();
					questGoalInfo.XOff2 = pak.ReadShortLowEndian();
					questGoalInfo.YOff2 = pak.ReadShortLowEndian();
					questGoalInfo.unk2 = pak.ReadShortLowEndian();
					questGoalInfo.type = pak.ReadShortLowEndian();
					questGoalInfo.unk1 = pak.ReadShortLowEndian();
					questGoalInfo.zoneId = pak.ReadShortLowEndian();
					questGoalInfo.XOff = pak.ReadShortLowEndian();
					questGoalInfo.YOff = pak.ReadShortLowEndian();
					goalInfo[i] = questGoalInfo;
					questGoalInfo.flagGoalFinished = pak.ReadByte();

					StoC_0x02_InventoryUpdate.Item item = new StoC_0x02_InventoryUpdate.Item();

					item.slot = pak.ReadByte();
					if (item.slot > 0)
					{
						item.level = pak.ReadByte();

						item.value1 = pak.ReadByte();
						item.value2 = pak.ReadByte();

						item.hand = pak.ReadByte();
						byte temp = pak.ReadByte(); //WriteByte((byte) ((item.Type_Damage*64) + item.Object_Type));
						item.damageType = (byte)(temp >> 6);
						item.objectType = (byte)(temp & 0x3F);
						item.weight = pak.ReadShort();
						item.condition = pak.ReadByte();
						item.durability = pak.ReadByte();
						item.quality = pak.ReadByte();
						item.bonus = pak.ReadByte();
						item.model = pak.ReadShort();
						item.extension = pak.ReadByte();
						item.color = pak.ReadShort();
						item.flag = pak.ReadByte();
						if ((item.flag & 0x08) == 0x08)
						{
							item.effectIcon = pak.ReadShort();
							item.effectName = pak.ReadPascalString();
						}
						if ((item.flag & 0x10) == 0x10)
						{
							item.effectIcon2 = pak.ReadShort();
							item.effectName2 = pak.ReadPascalString();
						}
						item.effect = pak.ReadByte();
						item.name = pak.ReadPascalString();
					}
					goalItems[i] = item;
				}
			}
            public override void Init(StoC_0x81_ShowDialog pak)
            {
                questName  = pak.ReadPascalString();
                questDesc  = pak.ReadPascalString();
                dialogLen  = pak.ReadShort();
                message    = pak.ReadString(dialogLen);
                questID    = pak.ReadShort();
                goalsCount = pak.ReadByte();
                goals      = new string[goalsCount];
                for (int i = 0; i < goalsCount; i++)
                {
#if SKIP_CR_IN_DESCRIPTION
                    questLevel = pak.ReadByte();                 // temporary used
                    goals[i]   = pak.ReadString(questLevel - 1); // 0x0A on end string
                    pak.Skip(1);                                 // skip 0x0A on end string
#else
                    goals[i] = pak.ReadPascalString();
#endif
                }
                questLevel       = pak.ReadByte();
                rewardGold       = pak.ReadByte();
                rewardExp        = pak.ReadByte();
                baseRewardsCount = pak.ReadByte();
                baseRewards      = new StoC_0x02_InventoryUpdate.Item[baseRewardsCount];
                for (int i = 0; i < baseRewardsCount; i++)
                {
                    StoC_0x02_InventoryUpdate.Item item = new StoC_0x02_InventoryUpdate.Item();
                    item.level = pak.ReadByte();

                    item.value1 = pak.ReadByte();
                    item.value2 = pak.ReadByte();

                    item.hand = pak.ReadByte();
                    byte temp = pak.ReadByte();                     //WriteByte((byte) ((item.Type_Damage*64) + item.Object_Type));
                    item.damageType = (byte)(temp >> 6);
                    item.objectType = (byte)(temp & 0x3F);
                    item.weight     = pak.ReadShort();
                    item.condition  = pak.ReadByte();
                    item.durability = pak.ReadByte();
                    item.quality    = pak.ReadByte();
                    item.bonus      = pak.ReadByte();
                    item.model      = pak.ReadShort();
                    item.extension  = pak.ReadByte();
                    item.color      = pak.ReadShort();
                    item.flag       = pak.ReadByte();
                    if ((item.flag & 0x08) == 0x08)
                    {
                        item.effectIcon = pak.ReadShort();
                        item.effectName = pak.ReadPascalString();
                    }
                    if ((item.flag & 0x10) == 0x10)
                    {
                        item.effectIcon2 = pak.ReadShort();
                        item.effectName2 = pak.ReadPascalString();
                    }
                    item.effect    = pak.ReadByte();
                    item.name      = pak.ReadPascalString();
                    baseRewards[i] = item;
                }
                optionalRewardsChoiceMax = pak.ReadByte();
                optionalRewardsCount     = pak.ReadByte();
                optionalRewards          = new StoC_0x02_InventoryUpdate.Item[optionalRewardsCount];
                for (int i = 0; i < optionalRewardsCount; i++)
                {
                    StoC_0x02_InventoryUpdate.Item item = new StoC_0x02_InventoryUpdate.Item();
                    item.level = pak.ReadByte();

                    item.value1 = pak.ReadByte();
                    item.value2 = pak.ReadByte();

                    item.hand = pak.ReadByte();
                    byte temp = pak.ReadByte();                     //WriteByte((byte) ((item.Type_Damage*64) + item.Object_Type));
                    item.damageType = (byte)(temp >> 6);
                    item.objectType = (byte)(temp & 0x3F);
                    item.weight     = pak.ReadShort();
                    item.condition  = pak.ReadByte();
                    item.durability = pak.ReadByte();
                    item.quality    = pak.ReadByte();
                    item.bonus      = pak.ReadByte();
                    item.model      = pak.ReadShort();
                    item.extension  = pak.ReadByte();
                    item.color      = pak.ReadShort();
                    item.flag       = pak.ReadByte();
                    if ((item.flag & 0x08) == 0x08)
                    {
                        item.effectIcon = pak.ReadShort();
                        item.effectName = pak.ReadPascalString();
                    }
                    if ((item.flag & 0x10) == 0x10)
                    {
                        item.effectIcon2 = pak.ReadShort();
                        item.effectName2 = pak.ReadPascalString();
                    }
                    item.effect        = pak.ReadByte();
                    item.name          = pak.ReadPascalString();
                    optionalRewards[i] = item;
                }
            }