changeset 468:8822405efad2

Слияние
author Ritor1
date Mon, 25 Feb 2013 11:10:57 +0600
parents 5d2667144526 (current diff) e9f40d344067 (diff)
children 0dbf780e247f
files mm7_2.cpp mm7_4.cpp mm7_data.cpp mm7_data.h
diffstat 8 files changed, 964 insertions(+), 869 deletions(-) [+]
line wrap: on
line diff
--- a/Arcomage.cpp	Mon Feb 25 11:09:55 2013 +0600
+++ b/Arcomage.cpp	Mon Feb 25 11:10:57 2013 +0600
@@ -5675,7 +5675,7 @@
         _449B7E_toggle_bit((unsigned char *)v11, 103, 1u);
       v11 += 6972;
     }
-    while ( (signed int)v11 < (signed int)((char *)&pParty->field_777C[36] + 2) );
+    while ( (signed int)v11 < (signed int)((char *)&pParty->StandartItemsInShops[36] + 2) );
     ++pParty->field_874;
     if ( pParty->field_874 > 1000000 )
       pParty->field_874 = 1000000;
@@ -5689,7 +5689,7 @@
         _449B7E_toggle_bit((unsigned char *)v12, 104, 1u);
       v12 += 6972;
     }
-    while ( (signed int)v12 < (signed int)((char *)&pParty->field_777C[36] + 2) );
+    while ( (signed int)v12 < (signed int)((char *)&pParty->StandartItemsInShops[36] + 2) );
     ++pParty->field_878;
     if ( pParty->field_878 > 1000000 )
       pParty->field_878 = 1000000;
--- a/Items.cpp	Mon Feb 25 11:09:55 2013 +0600
+++ b/Items.cpp	Mon Feb 25 11:10:57 2013 +0600
@@ -5,6 +5,9 @@
 #include "MapInfo.h"
 #include "FrameTableInc.h"
 #include "Allocator.h"
+#include "GUIWindow.h"
+#include "Events2D.h"
+#include "Chest.h"
 #include "LOD.h"
 #include "Monsters.h"
 #include "Party.h"
@@ -15,6 +18,87 @@
 
 
 
+struct ITEM_VARIATION
+	{
+	unsigned __int16 treasure_level;
+	unsigned __int16 item_class[4];
+	};
+
+
+char uItemsAmountPerShopType[5]={ 0, 6, 8, 12, 12};
+
+ITEM_VARIATION shopWeap_variation_ord[15] ={
+	{ 0, { 0, 0, 0, 0 }},
+	{ 1, { 23, 27, 20, 20 }},
+	{ 1, { 23, 24, 28, 20 }},
+	{ 2, { 23, 24, 25, 20 }},
+	{ 2, { 27, 27, 26, 26 }},
+	{ 4, { 24, 30, 25, 27 }},
+	{ 4, { 24, 30, 25, 27 }},
+	{ 3, { 30, 24, 20, 20 }},
+	{ 2, { 20, 20, 20, 20 }},
+	{ 3, { 27, 27, 26, 26 }},
+	{ 3, { 28, 28, 25, 25 }},
+	{ 2, { 23, 23, 24, 24 }},
+	{ 3, { 23, 23, 26, 26 }},
+	{ 2, { 30, 26, 26, 26 }},
+	{ 2, { 28, 25, 28, 29 }}};
+
+ITEM_VARIATION shopArmr_variation_ord[30] ={
+	{ 1, { 35, 35, 38, 38 }},
+	{ 1, { 31, 31, 31, 34 }},
+	{ 1, { 35, 35, 38, 38 }},
+	{ 1, { 31, 31, 32, 34 }},
+	{ 2, { 35, 35, 38, 38 }},
+	{ 2, { 31, 32, 32, 33 }},
+	{ 2, { 35, 35, 38, 38 }},
+	{ 2, { 31, 31, 32, 32 }},
+	{ 4, { 35, 35, 38, 38 }},
+	{ 4, { 31, 32, 33, 34 }},
+	{ 4, { 35, 35, 38, 38 }},
+	{ 4, { 31, 32, 33, 34 }},
+	{ 3, { 35, 35, 38, 38 }},
+	{ 3, { 31, 31, 31, 31 }},
+	{ 2, { 35, 35, 38, 38 }},
+	{ 2, { 31, 32, 34, 34 }},
+	{ 3, { 35, 35, 38, 38 }},
+	{ 3, { 31, 31, 32, 32 }},
+	{ 3, { 35, 35, 38, 38 }},
+	{ 3, { 32, 32, 32, 33 }},
+	{ 3, { 35, 35, 38, 38 }},
+	{ 3, { 31, 31, 31, 32 }},
+	{ 3, { 35, 35, 38, 38 }},
+	{ 3, { 33, 31, 32, 34 }},
+	{ 3, { 35, 35, 38, 38 }},
+	{ 3, { 33, 31, 32, 34 }},
+	{ 4, { 35, 35, 38, 38 }},
+	{ 4, { 33, 31, 32, 34 }}};
+
+
+
+unsigned __int16 shopMagic_treasure_lvl[14]= {0, 1, 1, 2, 2, 4, 4, 3, 2, 2, 2, 2, 2, 2};
+unsigned __int16 shopAlch_treasure_lvl[13]= {0, 1, 1, 2, 2, 3, 3, 4, 4, 2, 2, 2, 2};
+
+ITEM_VARIATION shopWeap_variation_spc[15]={
+	{ 0, { 0, 0, 0, 0 }},
+{ 2, { 25, 30, 20, 20}},
+{ 2, { 23, 24, 28, 20}},
+{ 3, { 23, 24, 25, 20}},
+{ 3, { 27, 27, 26, 26}},
+{ 5, { 23, 26, 28, 27}},
+{ 5, { 23, 26, 28, 27}},
+{ 4, { 30, 24, 20, 20}},
+{ 3, { 20, 20, 20, 20}},
+{ 4, { 27, 27, 26, 26}},
+{ 4, { 28, 28, 25, 25}},
+{ 4, { 23, 23, 24, 24}},
+{ 4, { 24, 24, 27, 20}},
+{ 4, { 30, 26, 26, 26}},
+{ 4, { 28, 25, 28, 29}}};
+
+
+
+unsigned __int16 shopMagicSpc_treasure_lvl[14]= {0, 2, 2, 3, 3, 5, 5, 4, 3, 3, 3, 3, 3, 3};
 
 
 ItemGen *ptr_50C9A4;
@@ -139,17 +223,13 @@
 //----- (00458260) --------------------------------------------------------
 void ItemGen::UpdateTempBonus(__int64 uTimePlayed)
 {
-  unsigned int v2; // eax@1
-
-  v2 = this->uAttributes;
-  if ( v2 & ITEM_TEMP_BONUS )
+  if ( this->uAttributes & ITEM_TEMP_BONUS )
   {
     if ( uTimePlayed > (signed __int64)this->uExpireTime )
     {
       this->uEncantmentType = 0;
-      LOBYTE(v2) = v2 & 0xF7;
       this->uSpecEnchantmentType = 0;
-      this->uAttributes = v2;
+      this->uAttributes = this->uAttributes&(~ITEM_TEMP_BONUS);
     }
   }
 }
@@ -1313,36 +1393,25 @@
 
 //----- (00456442) --------------------------------------------------------
 unsigned int ItemGen::GetValue()
-{
-  ItemGen *v1; // esi@1
-  unsigned int uBaseValue; // edi@1
-  int v3; // eax@4
-  int v4; // esi@5
-  unsigned int result; // eax@7
+	{
+	unsigned int uBaseValue; // edi@1
+	unsigned int bonus;
 
-  v1 = this;
-  uBaseValue = pItemsTable->pItems[this->uItemID].uValue;
-  if ( this->uAttributes & ITEM_TEMP_BONUS || pItemsTable->IsMaterialNonCommon(this) )
-    return uBaseValue;
-  if ( v1->uEncantmentType )
-  {
-    v3 = 100 * v1->_bonus_strength;
-    return uBaseValue + v3;
-  }
-  v4 = v1->uSpecEnchantmentType;
-  if ( !v4 )
-  {
-    result = uBaseValue;
-  }
-  else
-  {
-	v3 = pItemsTable->pSpecialEnchantments[v4].iTreasureLevel;
-    if ( (unsigned int)v3 > 0xA )
-      return uBaseValue + v3;
-    result = uBaseValue * v3;
-  }
-  return result;
-}
+	uBaseValue = pItemsTable->pItems[this->uItemID].uValue;
+	if ( this->uAttributes & ITEM_TEMP_BONUS || pItemsTable->IsMaterialNonCommon(this) )
+		return uBaseValue;
+	if (uEncantmentType )
+		return uBaseValue + 100 * _bonus_strength;;
+	if (uSpecEnchantmentType )
+		{
+		bonus = pItemsTable->pSpecialEnchantments[uSpecEnchantmentType].iTreasureLevel;
+		if ( bonus > 10 )
+			return uBaseValue + bonus;
+		else
+			return uBaseValue * bonus;
+		} 
+	return uBaseValue;
+	}
 
 //----- (00456499) --------------------------------------------------------
 const char *ItemGen::GetDisplayName()
@@ -1814,15 +1883,9 @@
 //----- (004505CC) --------------------------------------------------------
 bool ItemGen::GenerateArtifact()
 {
-  ItemGen *v1; // edi@1
   signed int uNumArtifactsNotFound; // esi@1
-  int v3; // eax@1
-  bool result; // eax@6
-  int artifacts_list[32]; // [sp+8h] [bp-A0h]@3
-  char Dst[32]; // [sp+88h] [bp-20h]@1
+  int artifacts_list[32]; 
 
-  auto a2 = this;
-  v1 = a2;
   memset(artifacts_list, 0,sizeof(artifacts_list));
   uNumArtifactsNotFound = 0;
 
@@ -1841,4 +1904,777 @@
     return false;
 
 }
-// 4505CC: using guessed type int var_A0[32];
\ No newline at end of file
+//----- (004B8E3D) --------------------------------------------------------
+void GenerateStandartShopItems()
+	{
+	signed int item_count; 
+	signed int shop_index; 
+	int treasure_lvl; 
+	int item_class; 
+	int mdf;
+
+	shop_index = (signed int)window_SpeakInHouse->ptr_1C;
+	if ( uItemsAmountPerShopType[p2DEvents[shop_index - 1].uType] )
+		{
+	    for (item_count=0; item_count<=uItemsAmountPerShopType[p2DEvents[shop_index - 1].uType]; ++item_count )
+		{
+		   if (shop_index<=14) //weapon shop
+			   {
+			   treasure_lvl = shopWeap_variation_ord[shop_index].treasure_level;
+			   item_class =shopWeap_variation_ord[shop_index].item_class[rand() % 4];
+			   }
+		   else if (shop_index<=28) //armor shop
+			   {
+			   mdf =0;
+			   if (item_count > 3)
+					 ++mdf;// rechek offsets
+			    treasure_lvl = shopArmr_variation_ord[2*(shop_index-15)+mdf].treasure_level;
+				item_class =shopArmr_variation_ord[2*(shop_index-15)+mdf].item_class[rand() % 4];
+			   }
+		   else if (shop_index<=41)  //magic shop
+			   {
+			   treasure_lvl = shopMagic_treasure_lvl[shop_index-28];
+			   item_class = 22;  //misc
+			   }
+		   else if (shop_index<=53) //alchemist shop
+			   {
+			    if (item_count<6)
+					{
+					pParty->StandartItemsInShops[shop_index][item_count].Reset();
+					pParty->StandartItemsInShops[shop_index][item_count].uItemID = 220;  //potion bottle
+					continue;
+					}
+				else
+					{
+					treasure_lvl = shopAlch_treasure_lvl[shop_index-41];
+					item_class = 45;  //reagent
+					}
+			   }
+		   pItemsTable->GenerateItem(treasure_lvl, item_class, &pParty->StandartItemsInShops[shop_index][item_count]);
+		   pParty->StandartItemsInShops[shop_index][item_count].SetIdentified();  //identified
+		}
+		}
+	pParty->InTheShopFlags[shop_index] = 0;
+	}
+
+//----- (004B8F94) --------------------------------------------------------
+void  GenerateSpecialShopItems()
+	{
+	/*GUIWindow *v0; // edi@1
+	signed int v1; // ebp@1
+	int v2; // ebx@1
+	signed int v3; // esi@1
+	int v4; // eax@3
+	int v5; // ebx@3
+	int v6; // ecx@3
+	bool v7; // eax@5
+	bool v8; // ST1C_4@5
+	int v9; // eax@5
+	int v10; // eax@10
+	void *result; // eax@15
+	signed int v12; // [sp-4h] [bp-18h]@7*/
+
+	signed int item_count; 
+	signed int shop_index; 
+	int treasure_lvl; 
+	int item_class; 
+	int mdf;
+
+	shop_index = (signed int)window_SpeakInHouse->ptr_1C;
+	if ( uItemsAmountPerShopType[p2DEvents[shop_index - 1].uType] )
+		{
+		for (item_count=0; item_count<=uItemsAmountPerShopType[p2DEvents[shop_index - 1].uType]; ++item_count )
+			{
+			if (shop_index<=14) //weapon shop
+				{
+				treasure_lvl = shopWeap_variation_spc[shop_index].treasure_level;
+				item_class =  shopWeap_variation_spc[shop_index].item_class[rand() % 4];
+				}
+			else if (shop_index<=28) //armor shop
+				{
+				mdf =0;
+				if (item_count > 3)
+					++mdf;
+				treasure_lvl = shopArmr_variation_ord[2*(shop_index-15)+mdf].treasure_level;
+				item_class =shopArmr_variation_ord[2*(shop_index-15)+mdf].item_class[rand() % 4];
+				}
+			else if (shop_index<=41)  //magic shop
+				{
+				treasure_lvl = shopMagicSpc_treasure_lvl[shop_index-28];
+				item_class = 22;  //misc
+				}
+			else if (shop_index<=53) //alchemist shop
+				{
+				if (item_count<6)
+					{
+					pParty->SpecialItemsInShop[shop_index][item_count].Reset();
+					pParty->SpecialItemsInShop[shop_index][item_count].uItemID = rand() % 32 + 740;  //mscrool
+					continue;
+					}
+				else
+					{
+					treasure_lvl = shopAlch_treasure_lvl[shop_index-41];
+					item_class = 44;  //potion
+					}
+				}
+			pItemsTable->GenerateItem(treasure_lvl, item_class, &pParty->SpecialItemsInShop[shop_index][item_count]);
+			pParty->SpecialItemsInShop[shop_index][item_count].SetIdentified();  //identified
+			}
+		}
+	pParty->InTheShopFlags[shop_index] = 0;
+
+
+
+/*
+
+	v0 = window_SpeakInHouse;
+	v1 = 0;
+	v2 = (int)&window_SpeakInHouse->ptr_1C;
+	v3 = (signed int)window_SpeakInHouse->ptr_1C;
+	//if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)ptr_507BC0->ptr_1C]] )
+	if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] )
+		{
+		while ( v3 > 14 )
+			{
+			if ( v3 <= 28 )
+				{
+				v7 = v1 > 3;
+				v8 = v7;
+				v9 = 5 * (v7 + 2 * v3 - 30);
+				v3 = (signed int)v0->ptr_1C;
+				v5 = word_4F06D8[v9];
+				v6 = word_4F05AE[5 * (v8 + 2 * v3) + rand() % 4];
+				goto LABEL_13;
+				}
+			if ( v3 <= 41 )
+				{
+				v5 = word_4F07B6[v3];
+				v12 = 22;
+				goto LABEL_12;
+				}
+			if ( v3 <= 53 )
+				{
+				if ( v1 >= 6 )
+					{
+					v5 = word_4F07B6[v3 + 1];
+					v12 = 44;
+LABEL_12:
+					v6 = v12;
+LABEL_13:
+					pItemsTable->GenerateItem(v5, v6,&pParty->SpecialItemsInShop[v3][v1]);//(ItemGen *)&pParty->field_C59C[9 * (v1 + 12 * v3) + 724]);
+					v0 = window_SpeakInHouse;
+					v2 = (int)&window_SpeakInHouse->ptr_1C;
+					// pParty->field_C59C[9 * (v1 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 729] = 1;
+					pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v1].uAttributes= 1;
+					goto LABEL_14;
+					}
+				// auto _a = (ItemGen *)&pParty->field_C59C[9 * (v1 + 12 * v3) + 724];
+				auto _a =&pParty->SpecialItemsInShop[v3][v1];
+				_a->Reset();
+				//	v2 = (int)&v0->ptr_1C;
+				//v10 = rand();
+				//	v0 = window_SpeakInHouse;
+				// pParty->field_C59C[9 * (v1 + 12 * *(int *)v2) + 724] = v10 % 32 + 740;
+				pParty->SpecialItemsInShop[(int)v0->ptr_1C][v1].uItemID= rand() % 32 + 740;
+				}
+LABEL_14:
+			v3 = *(int *)v2;
+			++v1;
+			//if ( v1 >= (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * *(int *)v2]] )
+			if ( v1 >= (unsigned __int8)uItemsAmountPerShopType[p2DEvents[*(int *)v2 - 1].uType] )
+				goto LABEL_15;
+			}
+		v4 = 5 * v3;
+		v3 = (signed int)v0->ptr_1C;
+		v5 = word_4F063E[v4];
+		v6 = word_4F063E[5 * v3 + rand() % 4 + 1];
+		goto LABEL_13;
+		}
+LABEL_15:
+	result = v0->ptr_1C;
+	pParty->InTheShopFlags[(int)v0->ptr_1C] = 0;*/
+	}
+
+
+//----- (00450218) --------------------------------------------------------
+void __cdecl sub_450218_prolly_generate_chests_loot()
+	{
+	unsigned int v0; // eax@1
+	Chest *v1; // ebx@1
+	MapInfo *v2; // esi@1
+	ItemGen *v3; // ebx@2
+	int v4; // ebp@4
+	int v5; // edi@4
+	int v6; // esi@4
+	int v7; // eax@4
+	signed int v8; // esi@4
+	int v9; // edx@4
+	int v10; // esi@8
+	int v11; // ebp@25
+	int v12; // esi@25
+	signed int v13; // ebp@27
+	ItemGen *v14; // edi@28
+	signed int v15; // edx@32
+	signed __int64 v16; // qtt@32
+	int v17; // esi@34
+	signed int v18; // [sp+10h] [bp-18h]@1
+	int v19; // [sp+14h] [bp-14h]@4
+	MapInfo *v20; // [sp+18h] [bp-10h]@1
+	Chest *v21; // [sp+1Ch] [bp-Ch]@1
+	int v22; // [sp+20h] [bp-8h]@26
+	signed int v23; // [sp+24h] [bp-4h]@2
+
+	v18 = rand() % 100;
+	v0 = pMapStats->GetMapInfo(pCurrentMapName);
+	v1 = pChests;
+	v2 = &pMapStats->pInfos[v0];
+	v21 = pChests;
+	v20 = &pMapStats->pInfos[v0];
+	do
+		{
+		v3 = v1->mm7__vector_pItems;
+		v23 = 140;
+		do
+			{
+			if ( (v3->uItemID & 0x80000000u) == 0 )
+				goto LABEL_56;
+			v4 = rand() % 5 + 1;
+			v5 = (unsigned __int8)byte_4E8168[abs((int)v3->uItemID)-1][2*v2->Treasure_prob];//[2 * (v2->Treasure_prob + 7 * abs((int)v3->uItemID)) + 2];
+			v6 = (unsigned __int8)byte_4E8168[abs((int)v3->uItemID)-1][2*v2->Treasure_prob+1];//[2 * (v2->Treasure_prob + 7 * abs((int)v3->uItemID)) + 3];
+			v7 = rand();
+			v8 = v6 - v5 + 1;
+			v9 = v5 + v7 % v8;
+			v19 = v5 + v7 % v8;
+			if ( v9 < 7 )
+				{
+				if ( v18 < 20 )
+					{
+					v3->Reset();
+					goto LABEL_25;
+					}
+				if ( v18 < 60 )
+					{
+					v10 = 0;
+					v3->Reset();
+					if ( v19 == 1 )
+						{
+						v10 = rand() % 51 + 50;
+						}
+					else
+						{
+						if ( v19 != 2 )
+							{
+							if ( v19 == 3 )
+								{
+								v10 = rand() % 301 + 200;
+								}
+							else
+								{
+								if ( v19 != 4 )
+									{
+									if ( v19 == 5 )
+										{
+										v10 = rand() % 1001 + 1000;
+LABEL_15:
+										v3->uItemID = 199;
+										}
+									else
+										{
+										if ( v19 == 6 )
+											{
+											v10 = rand() % 3001 + 2000;
+											goto LABEL_15;
+											}
+										}
+LABEL_23:
+									v3->SetIdentified();
+									v3->uSpecEnchantmentType = v10;
+LABEL_25:
+									v11 = v4 - 1;
+									v12 = 0;
+									if ( v11 > 0 )
+										{
+										v22 = v11;
+										while ( 1 )
+											{
+											v13 = v12;
+											if ( v12 >= 140 )
+												goto LABEL_52;
+											v14 = &v21->mm7__vector_pItems[v12];
+											while ( v14->uItemID )
+												{
+												++v13;
+												++v14;
+												if ( v13 >= 140 )
+													goto LABEL_52;
+												}
+											v16 = rand();
+											v15 = v16 % 100;
+											v18 = v16 % 100;
+											if ( v15 < 20 )
+												goto LABEL_52;
+											if ( v15 >= 60 )
+												{
+												pItemsTable->GenerateItem(v19, 0, v14);
+												goto LABEL_51;
+												}
+											v17 = 0;
+											v14->Reset();
+											if ( v19 == 1 )
+												{
+												v17 = rand() % 51 + 50;
+												goto LABEL_48;
+												}
+											if ( v19 == 2 )
+												{
+												v17 = rand() % 101 + 100;
+LABEL_48:
+												v14->uItemID = 197;
+												goto LABEL_49;
+												}
+											if ( v19 == 3 )
+												{
+												v17 = rand() % 301 + 200;
+												goto LABEL_44;
+												}
+											if ( v19 == 4 )
+												{
+												v17 = rand() % 501 + 500;
+LABEL_44:
+												v14->uItemID = 198;
+												goto LABEL_49;
+												}
+											if ( v19 == 5 )
+												break;
+											if ( v19 == 6 )
+												{
+												v17 = rand() % 3001 + 2000;
+LABEL_41:
+												v14->uItemID = 199;
+												}
+LABEL_49:
+											v14->uSpecEnchantmentType = v17;
+LABEL_51:
+											v12 = v13 + 1;
+LABEL_52:
+											--v22;
+											if ( !v22 )
+												goto LABEL_55;
+											}
+										v17 = rand() % 1001 + 1000;
+										goto LABEL_41;
+										}
+									goto LABEL_55;
+									}
+								v10 = rand() % 501 + 500;
+								}
+							v3->uItemID = 198;
+							goto LABEL_23;
+							}
+						v10 = rand() % 101 + 100;
+						}
+					v3->uItemID = 197;
+					goto LABEL_23;
+					}
+				pItemsTable->GenerateItem(v9, 0, v3);
+				goto LABEL_25;
+				}
+			v3->GenerateArtifact();
+LABEL_55:
+			v2 = v20;
+LABEL_56:
+			++v3;
+			--v23;
+			}
+			while ( v23 );
+			v1 = v21 + 1;
+			++v21;
+		}
+		while ( (signed int)v21 < (signed int)&uNumChests );
+	}
+
+
+	
+
+// 4505CC: using guessed type int var_A0[32];
+	//----- (004B3703) --------------------------------------------------------
+	int  sub_4B3703( int _this )
+		{
+		signed int v1; // edi@1
+		int v2; // eax@1
+		int v3; // ecx@1
+		signed int v4; // ebx@1
+		int v5; // ecx@2
+		int v6; // ecx@3
+		int v7; // ecx@4
+		int v8; // ecx@5
+		int v9; // ecx@6
+		signed int v10; // ebx@13
+		signed int v11; // edi@14
+		signed int v12; // esi@15
+		unsigned int v13; // ecx@16
+		int v14; // ecx@16
+		int v15; // ecx@17
+		int v16; // ecx@19
+		int v17; // ecx@20
+		int v18; // ecx@21
+		signed int v19; // esi@32
+		char *v20; // ecx@33
+		int v21; // ecx@34
+		int v22; // ecx@36
+		int v23; // ecx@37
+		int v24; // ecx@38
+		int v25; // ecx@39
+		int v26; // ecx@40
+		int v27; // ecx@41
+		int *v28; // esi@54
+		unsigned int v29; // edx@56
+		char *v30; // ecx@65
+		int v31; // ecx@106
+		int result; // eax@107
+		int v33; // [sp-4h] [bp-2Ch]@23
+		int v34; // [sp-4h] [bp-2Ch]@43
+		int v35[5]; // [sp+Ch] [bp-1Ch]@8
+		int a2; // [sp+20h] [bp-8h]@1
+		int v37; // [sp+24h] [bp-4h]@1
+
+		//need fixing
+		__debugbreak();
+		v1 = 0;
+		v2 = 0;
+		v3 = _this - 1;
+		a2 = 0;
+		v37 = 0;
+		dword_F8B1DC = 0;
+		v4 = 2;
+		if ( !v3 )
+			{
+			while ( 1 )
+				{
+				v19 = 1;
+				do
+					{
+					v20 = (char *)window_SpeakInHouse->ptr_1C + 4 * (unsigned int)window_SpeakInHouse->ptr_1C + v19;
+					/*if ( v1 )
+						v21 = word_4F063E[(signed int)v20];
+					else
+						v21 = word_4F0404[(signed int)v20 - 4];//word_4F03FE[(signed int)v20];*/
+					v22 = v21 - 23;
+					if ( v22 )
+						{
+						v23 = v22 - 1;
+						if ( v23 )
+							{
+							v24 = v23 - 1;
+							if ( v24 )
+								{
+								v25 = v24 - 1;
+								if ( v25 )
+									{
+									v26 = v25 - 1;
+									if ( v26 )
+										{
+										v27 = v26 - 1;
+										if ( v27 )
+											{
+											if ( v27 != v4 )
+												goto LABEL_51;
+											v34 = 36;
+											}
+										else
+											{
+											v34 = 42;
+											}
+										}
+									else
+										{
+										v34 = 41;
+										}
+									}
+								else
+									{
+									v34 = 40;
+									}
+								}
+							else
+								{
+								v34 = 39;
+								}
+							}
+						else
+							{
+							v34 = 38;
+							}
+						}
+					else
+						{
+						v34 = 37;
+						}
+					v37 = sub_4BE571(v34, v35, v37, 5);
+					v2 = dword_F8B1DC;
+					v4 = 2;
+LABEL_51:
+					++v19;
+					}
+					while ( v19 <= 4 );
+					++v1;
+					if ( v1 >= v4 )
+						goto LABEL_53;
+				}
+			}
+		v5 = (int)(v3 - 1);
+		if ( !v5 )
+			{
+			v10 = 0;
+			while ( 1 )
+				{
+				v11 = 0;
+				do
+					{
+					v12 = 1;
+					do
+						{
+						v13 = v11 + 2 * (unsigned int)window_SpeakInHouse->ptr_1C - 30;
+						v14 = v12 + 4 * v13 + v13;
+					/*	if ( v10 )
+							v15 = word_4F06D8[v14];
+						else
+							v15 = word_4F0498[v14];*/
+						v16 = v15 - 31;
+						if ( v16 )
+							{
+							v17 = v16 - 1;
+							if ( v17 )
+								{
+								v18 = v17 - 1;
+								if ( v18 )
+									{
+									if ( v18 != 1 )
+										goto LABEL_28;
+									v33 = 44;
+									}
+								else
+									{
+									v33 = 47;
+									}
+								}
+							else
+								{
+								v33 = 46;
+								}
+							}
+						else
+							{
+							v33 = 45;
+							}
+						v37 = sub_4BE571(v33, v35, v37, 5);
+						v2 = dword_F8B1DC;
+LABEL_28:
+						++v12;
+						}
+						while ( v12 <= 4 );
+						++v11;
+					}
+					while ( v11 < 2 );
+					++v10;
+					if ( v10 >= 2 )
+						goto LABEL_53;
+				}
+			}
+		v6 = v5 - 1;
+		if ( v6 )
+			{
+			v7 = v6 - 1;
+			if ( v7 )
+				{
+				v8 = v7 - 17;
+				if ( v8 )
+					{
+					v9 = v8 - 2;
+					if ( v9 )
+						{
+						if ( v9 == 7 )
+							{
+							v37 = 2;
+							v35[0] = 69;
+							v35[1] = 60;
+							}
+						}
+					else
+						{
+						v37 = 3;
+						v35[0] = 67;
+						v35[1] = 66;
+						v35[2] = 58;
+						}
+					}
+				else
+					{
+					v37 = 3;
+					v35[0] = 70;
+					v35[1] = 65;
+					v35[2] = 62;
+					}
+				}
+			else
+				{
+				v37 = 2;
+				v35[0] = 71;
+				v35[1] = 68;
+				}
+			}
+		else
+			{
+			v37 = 2;
+			v35[0] = 57;
+			v35[1] = 59;
+			}
+LABEL_53:
+		if ( v37 > 0 )
+			{
+			v28 = v35;
+			while ( 1 )
+				{
+				v29 = *v28;
+				if ( *v28 <= 47 )
+					break;
+				if ( (signed int)v29 <= 66 )
+					{
+					if ( v29 == 66 )
+						{
+						v30 = pSkillNames[30];
+						goto LABEL_106;
+						}
+					if ( v29 == 57 )
+						{
+						v30 = pSkillNames[21];
+						goto LABEL_106;
+						}
+					if ( v29 == 58 )
+						{
+						v30 = pSkillNames[22];
+						goto LABEL_106;
+						}
+					if ( v29 == 60 )
+						{
+						v30 = pSkillNames[24];
+						goto LABEL_106;
+						}
+					if ( v29 == 62 )
+						{
+						v30 = pSkillNames[26];
+						goto LABEL_106;
+						}
+					if ( v29 == 65 )
+						{
+						v30 = pSkillNames[29];
+						goto LABEL_106;
+						}
+					goto LABEL_100;
+					}
+				switch ( v29 )
+					{
+				case 0x43u:
+					v30 = pSkillNames[31];
+					break;
+				case 0x44u:
+					v30 = pSkillNames[32];
+					break;
+				case 0x45u:
+					v30 = pSkillNames[33];
+					break;
+				case 0x46u:
+					v30 = pSkillNames[34];
+					break;
+				default:
+					if ( v29 != 71 )
+						goto LABEL_100;
+					v30 = pSkillNames[35];
+					break;
+					}
+LABEL_106:
+				pShopOptions[v2] = v30;
+				v31 = a2++;
+				dword_F8B1DC = v2 + 1;
+				sub_4B36CC(v31, v29);
+				++v28;
+				if ( a2 >= v37 )
+					goto LABEL_107;
+				v2 = dword_F8B1DC;
+				}
+			if ( *v28 == 47 )
+				{
+				v30 = pSkillNames[11];
+				goto LABEL_106;
+				}
+			if ( (signed int)v29 > 40 )
+				{
+				if ( v29 == 41 )
+					{
+					v30 = pSkillNames[5];
+					goto LABEL_106;
+					}
+				if ( v29 == 42 )
+					{
+					v30 = pSkillNames[6];
+					goto LABEL_106;
+					}
+				if ( v29 == 44 )
+					{
+					v30 = pSkillNames[8];
+					goto LABEL_106;
+					}
+				if ( v29 == 45 )
+					{
+					v30 = pSkillNames[9];
+					goto LABEL_106;
+					}
+				if ( v29 == 46 )
+					{
+					v30 = pSkillNames[10];
+					goto LABEL_106;
+					}
+				}
+			else
+				{
+				if ( v29 == 40 )
+					{
+					v30 = pSkillNames[4];
+					goto LABEL_106;
+					}
+				if ( v29 == 5 )
+					{
+					v30 = pSkillNames[23];
+					goto LABEL_106;
+					}
+				if ( v29 == 36 )
+					{
+					v30 = pSkillNames[0];
+					goto LABEL_106;
+					}
+				if ( v29 == 37 )
+					{
+					v30 = pSkillNames[1];
+					goto LABEL_106;
+					}
+				if ( v29 == 38 )
+					{
+					v30 = pSkillNames[2];
+					goto LABEL_106;
+					}
+				if ( v29 == 39 )
+					{
+					v30 = pSkillNames[3];
+					goto LABEL_106;
+					}
+				}
+LABEL_100:
+			v30 = pGlobalTXT_LocalizationStrings[127]; //"No Text!"
+			goto LABEL_106;
+			}
+LABEL_107:
+		pDialogueWindow->_41D08F(a2, 1, 0, 2);
+		result = pDialogueWindow->pNumPresenceButton;
+		dword_F8B1E0 = pDialogueWindow->pNumPresenceButton;
+		return result;
+		}
--- a/Items.h	Mon Feb 25 11:09:55 2013 +0600
+++ b/Items.h	Mon Feb 25 11:10:57 2013 +0600
@@ -6,7 +6,7 @@
 
 
 /*  338 */
-enum ITEM_FLAGS
+enum ITEM_FLAGS :unsigned int
 {
   ITEM_IDENTIFIED = 0x1,
   ITEM_BROKEN = 0x2,
@@ -270,7 +270,8 @@
 };
 #pragma pack(pop)
 
-
+void GenerateStandartShopItems();
+void GenerateSpecialShopItems();
 
 
 extern ItemGen *ptr_50C9A4;
--- a/Party.h	Mon Feb 25 11:09:55 2013 +0600
+++ b/Party.h	Mon Feb 25 11:10:57 2013 +0600
@@ -272,8 +272,8 @@
   NPCData pHirelings[2];
   ItemGen pPickedItem;
   unsigned int uFlags;
-  ItemGen field_777C[53][12];
-  ItemGen Recipes_Item[53][12];   //D0EC
+  ItemGen StandartItemsInShops[53][12];
+  ItemGen SpecialItemsInShop[53][12];   //D0EC
   int field_12A5C[2117];
   char field_14B70[5000];
   char field_15EF8[250];
@@ -283,7 +283,7 @@
   int armageddon_timer;
   int field_16140;
   int pTurnBasedPlayerRecoveryTimes[4];
-  int field_16154[53];
+  int InTheShopFlags[53];
   int uFine;
   float flt_TorchlightColorR;
   float flt_TorchlightColorG;
--- a/mm7_2.cpp	Mon Feb 25 11:09:55 2013 +0600
+++ b/mm7_2.cpp	Mon Feb 25 11:10:57 2013 +0600
@@ -925,84 +925,6 @@
   }
 }
 
-//----- (004B8E3D) --------------------------------------------------------
-void *__cdecl GenerateShopItems()
-{
-  GUIWindow *v0; // eax@1
-  signed int v1; // edi@1
-  signed int v2; // esi@1
-  int v3; // ecx@3
-  int v4; // ebx@3
-  int v5; // ecx@3
-  bool v6; // ebp@5
-  int v7; // ecx@5
-  void *result; // eax@15
-  signed int v9; // [sp-Ch] [bp-14h]@7
-
-  v0 = window_SpeakInHouse;
-  v1 = 0;
-  v2 = (signed int)window_SpeakInHouse->ptr_1C;
-  //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)ptr_507BC0->ptr_1C]] )
-  if ( _4F063C_smthn_by_2da_uType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] )
-  {
-    while ( v2 > 14 )
-    {
-      if ( v2 <= 28 )
-      {
-        v6 = v1 > 3;
-        v7 = v6 + 2 * v2 - 30;
-        v2 = (signed int)v0->ptr_1C;
-        v4 = word_4F0498[5 * v7];
-        __debugbreak();
-        //things happen around word_4F0400 actually
-        //v5 = *(short *)&aTooManyStation[2 * (5 * (v6 + 2 * v2) + rand() % 4) + 10];
-        goto LABEL_13;
-      }
-      if ( v2 <= 41 )
-      {
-        v4 = word_4F0576[v2];
-        v9 = 22;  //misc
-        goto LABEL_12;
-      }
-      if ( v2 <= 53 )
-      {
-        if ( v1 >= 6 )
-        {
-          v4 = word_4F0578[v2];
-          v9 = 45;  //reagent
-LABEL_12:
-          v5 = v9;
-LABEL_13:
-          pItemsTable->GenerateItem(v4, v5, (ItemGen *)&pParty->field_777C[v2][v1]);//9 * (v1 + 12 * v2)]);
-          v0 = window_SpeakInHouse;
-          pParty->field_777C[(unsigned int)window_SpeakInHouse->ptr_1C][v1].uAttributes = 1;  //identified
-          goto LABEL_14;
-        }
-        auto _t = (ItemGen *)&pParty->field_777C[v2][v1];
-        _t->Reset();
-        v0 = window_SpeakInHouse;
-        pParty->field_777C[(unsigned int)window_SpeakInHouse->ptr_1C][v1].uItemID = 220;  //potion bottle
-      }
-LABEL_14:
-      v2 = (signed int)v0->ptr_1C;
-      ++v1;
-      //if ( v1 >= (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v0->ptr_1C]] )
-      if ( v1 >= (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents[(unsigned int)v0->ptr_1C - 1].uType] )
-        goto LABEL_15;
-    }
-    v3 = 5 * v2;
-    v2 = (signed int)v0->ptr_1C;
-    v4 = word_4F0404[v3 - 4];
-    v5 = word_4F0404[5 * v2 + rand() % 4 - 2];
-    goto LABEL_13;
-  }
-LABEL_15:
-  result = v0->ptr_1C;
-  *(int *)&pParty->field_16154[4 * (int)result] = 0;
-  return result;
-}
-
-
 
 //----- (004B910F) --------------------------------------------------------
 char *__cdecl WeaponShopDialog()
@@ -1492,7 +1414,7 @@
     do
     {
     //  if ( pParty->field_777C[9 * (int)&v48[3 * (unsigned int)window_SpeakInHouse->ptr_1C]] )
-	if ( pParty->field_777C[(unsigned int)window_SpeakInHouse->ptr_1C][(int)v48].uItemID);
+	if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(int)v48].uItemID);
       {
         v49 = word_F8B158[(signed int)v48];
         v50 = dword_F8B168[(signed int)v48];
@@ -1518,7 +1440,7 @@
     do
     {
    //   if ( pParty->field_C59C[9 * (int)&v109[3 * (unsigned int)window_SpeakInHouse->ptr_1C] + 724] )
-	if (pParty->Recipes_Item[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v109].uItemID)
+	if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v109].uItemID)
       {
         v52 = word_F8B158[(signed int)v109] + 30;
         v53 = dword_F8B168[(signed int)v109];
@@ -1544,7 +1466,7 @@
       v106.x = 0;
       do
       {
-        if ( pParty->field_777C[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID);//9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
+        if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID);//9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
           ++v106.x;
         ++v55;
       }
@@ -1555,7 +1477,7 @@
       do
       {
        // if ( pParty->field_C59C[9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
-	  if (pParty->Recipes_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID)
+	  if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID)
           ++v106.x;
         ++v55;
       }
@@ -1585,9 +1507,9 @@
         v106.x = v60;
         v61 = (int)window_SpeakInHouse->ptr_1C;
       //  v62 = 9 * (v60 + 12 * v61);
-        v63 = (ItemGen *)&pParty->field_777C[(int)v61][v60];
+        v63 = (ItemGen *)&pParty->StandartItemsInShops[(int)v61][v60];
         if ( dword_F8B19C != 2 )
-          v63 = &pParty->Recipes_Item[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724];
+          v63 = &pParty->SpecialItemsInShop[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724];
         if ( !v56 || !Str )
         {
           v85 = 0;
@@ -2033,7 +1955,7 @@
       do
       {
        // if ( pParty->field_777C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
-	  if ( pParty->field_777C[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID);
+	  if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID);
         {
           v46 = dword_F8B168[v114];
           v47 = 152 - v46->uTextureHeight;
@@ -2064,7 +1986,7 @@
       do
       {
       //  if ( pParty->field_777C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 54] )
-	  if ( pParty->field_777C[(unsigned int)window_SpeakInHouse->ptr_1C][v114+1].uItemID);
+	  if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114+1].uItemID);
         {
           v50 = dword_F8B168[v114 + 6];
           v51 = 308 - v50->uTextureHeight;
@@ -2097,7 +2019,7 @@
       do
       {
         //if ( pParty->field_C59C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
-	  if (pParty->Recipes_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID)
+	  if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID)
         {
           v54 = dword_F8B168[v114];
           v55 = 152 - v54->uTextureHeight;
@@ -2128,7 +2050,7 @@
       do
       {
        // if ( pParty->field_C59C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 778] )   //weak 
-	     if (pParty->Recipes_Item[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v114].uItemID) //not itemid
+	     if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v114].uItemID) //not itemid
         {
           v58 = dword_F8B168[v114 + 6];
           v59 = 308 - v58->uTextureHeight;
@@ -2166,7 +2088,7 @@
         do
         {
          // if ( pParty->field_777C[9 * (v62 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
-		if ( pParty->field_777C[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID);
+		if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID);
             ++v109;
           ++v62;
         }
@@ -2177,7 +2099,7 @@
         do
         {
           //if ( pParty->field_C59C[9 * (v62 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
-		if (pParty->Recipes_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID)
+		if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID)
             ++v109;
           ++v62;
         }
@@ -2211,9 +2133,9 @@
         v109 = v67;
         v68 = (int)window_SpeakInHouse->ptr_1C;
       //  v69 = 9 * (v67 + 12 * v68);
-        v70 = (ItemGen *)&pParty->field_777C[v68][v67];
+        v70 = (ItemGen *)&pParty->StandartItemsInShops[v68][v67];
         if ( dword_F8B19C != 2 )
-          v70 = &pParty->Recipes_Item[(int)v68][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724];
+          v70 = &pParty->SpecialItemsInShop[(int)v68][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724];
         if ( !v63 || !Str )
         {
           v93 = 0;
@@ -2418,7 +2340,7 @@
       do
       {
        // if ( pParty->field_C59C[9 * (v93 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
-	  if (pParty->Recipes_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v93].uItemID)
+	  if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v93].uItemID)
           ++v149;
         ++v93;
       }
@@ -2435,7 +2357,7 @@
           v97 = uActiveCharacter - 1;
        //   v98 = (ItemGen *)&pParty->field_C59C[9 * (v95 - 1 + 12 * (int)v96) + 724];
           v99 = _this->_490EEE(
-                 &pParty->Recipes_Item[(int)v96][v95-1],// (ItemGen *)&pParty->field_C59C[9 * (v95 - 1 + 12 * (int)v96) + 724],
+                 &pParty->SpecialItemsInShop[(int)v96][v95-1],// (ItemGen *)&pParty->field_C59C[9 * (v95 - 1 + 12 * (int)v96) + 724],
                   2,
                   (int)window_SpeakInHouse->ptr_1C,
                   2);
@@ -2450,7 +2372,7 @@
         do
         {
           //if ( pParty->field_C59C[9 * (v104 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
-		if (pParty->Recipes_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v104].uItemID)
+		if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v104].uItemID)
           {
             v105 = dword_F8B168[v104];
             if ( v104 >= 4 )
@@ -2638,7 +2560,7 @@
       do
       {
       //  if ( pParty->field_777C[9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
-	  if ( pParty->field_777C[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID);
+	  if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID);
         {
           v56 = dword_F8B168[v55];
           if ( v55 >= 4 )
@@ -2673,7 +2595,7 @@
       do
       {
        // if ( (char *)pParty->field_C59C[9 * (v61 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] != v11 )
-	  if (pParty->Recipes_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v61].uItemID)
+	  if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v61].uItemID)
         {
           v62 = dword_F8B168[v61];
           if ( v61 >= 4 )
@@ -2710,7 +2632,7 @@
       do
       {
        // if ( (char *)pParty->field_777C[9 * (v68 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] != v11 )
-	  if ( pParty->field_777C[(unsigned int)window_SpeakInHouse->ptr_1C][v68].uItemID);
+	  if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v68].uItemID);
           ++v149;
         ++v68;
       }
@@ -2721,7 +2643,7 @@
       do
       {
        // if ( (char *)pParty->field_C59C[9 * (v68 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] != v11 )
-	  if (pParty->Recipes_Item[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v68].uItemID)
+	  if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v68].uItemID)
           ++v149;
         ++v68;
       }
@@ -2751,9 +2673,9 @@
       v75 = (int)window_SpeakInHouse->ptr_1C;
       v76 = 9 * (v74 - 1 + 12 * v75);
       if ( dword_F8B19C == 2 )
-        v77 = (ItemGen *)&pParty->field_777C[v76];
+        v77 = (ItemGen *)&pParty->StandartItemsInShops[v76];
       else
-        v77 = &pParty->Recipes_Item[(int)75][v74-1];//(ItemGen *)&pParty->field_C59C[v76 + 724];
+        v77 = &pParty->SpecialItemsInShop[(int)75][v74-1];//(ItemGen *)&pParty->field_C59C[v76 + 724];
       if ( v69 == (short)v11 || Str == v11 )
       {
         v124 = (__int64 *)v11;
@@ -4100,7 +4022,7 @@
       case 96:
         pDialogueWindow->eWindowType = WINDOW_MainMenu;
         UI_CreateEndConversationButton();
-        sub_4B3703((void *)dword_F8B198);
+        sub_4B3703(dword_F8B198);
         break;
       case 101:
         pDialogueWindow->eWindowType = WINDOW_MainMenu;
@@ -4208,8 +4130,8 @@
                          pParty->field_3C.field_50[2 * (unsigned int)v8->ptr_1C + 1],
                          pParty->field_3C.field_50[2 * (unsigned int)v8->ptr_1C]) < (signed __int64)pParty->uTimePlayed )
   {
-    GenerateShopItems();
-    sub_4B8F94();
+    GenerateStandartShopItems();
+    GenerateSpecialShopItems();
     v8 = window_SpeakInHouse;
     v40 = window_SpeakInHouse->ptr_1C;
     //v3 = dword_F8B198;
@@ -4226,11 +4148,11 @@
   v44 = p2DEvents[(unsigned int)v8->ptr_1C - 1].uType;
   if ( uMessageParam == 2 )
   {
-    if ( _4F063C_smthn_by_2da_uType[v44] )
+    if ( uItemsAmountPerShopType[v44] )
     {
       do
       {
-        v45 = pParty->field_777C[(int)v42][v43].uItemID;
+        v45 = pParty->StandartItemsInShops[(int)v42][v43].uItemID;
         if ( v45 )
         {
           v46 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v45].pIconName, TEXTURE_16BIT_PALETTE);
@@ -4242,19 +4164,19 @@
         ++v43;
       }
       //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] );
-      while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] );
+      while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] );
     }
     if ( dword_F8B198 == 1 )
     {
       v47 = v8->ptr_1C;
       v48 = 0;
       //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] )
-      if ( _4F063C_smthn_by_2da_uType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] )
+      if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] )
       {
         do
         {
          // if ( pParty->field_777C[9 * (v48 + 12 * (int)v47)] )
-		 if ( pParty->field_777C[(int)v47][v48].uItemID);
+		 if ( pParty->StandartItemsInShops[(int)v47][v48].uItemID);
           {
             v49 = rand();
             v8 = window_SpeakInHouse;
@@ -4264,18 +4186,18 @@
           ++v48;
         }
         //while ( v48 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] );
-        while ( v48 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] );
+        while ( v48 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] );
       }
     }
   }
   else
   {
-    if ( _4F063C_smthn_by_2da_uType[v44] )
+    if ( uItemsAmountPerShopType[v44] )
     {
       do
       {
         //v50 = pParty->field_C59C[9 * (v43 + 12 * (int)v42) + 724];
-	  v50=pParty->Recipes_Item[(unsigned int)v42][(signed int)v43].uItemID;
+	  v50=pParty->SpecialItemsInShop[(unsigned int)v42][(signed int)v43].uItemID;
         if ( v50 )
         {
           v51 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v50].pIconName, TEXTURE_16BIT_PALETTE);
@@ -4287,19 +4209,19 @@
         ++v43;
       }
       //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] );
-      while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] );
+      while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] );
     }
     if ( dword_F8B198 == 1 )
     {
       v52 = v8->ptr_1C;
       v53 = 0;
       //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] )
-      if ( _4F063C_smthn_by_2da_uType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] )
+      if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] )
       {
         do
         {
          // if ( pParty->field_C59C[9 * (v53 + 12 * (int)v52) + 724] )
-		if (pParty->Recipes_Item[(unsigned int)v52][v53].uItemID)
+		if (pParty->SpecialItemsInShop[(unsigned int)v52][v53].uItemID)
           {
             v54 = rand();
             v8 = window_SpeakInHouse;
@@ -4309,7 +4231,7 @@
           ++v53;
         }
         //while ( v53 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] );
-        while ( v53 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType ] );
+        while ( v53 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType ] );
       }
     }
   }
@@ -4612,13 +4534,13 @@
    // v31 = 9 * (v29 - 1 + 12 * (int)v30);
     if ( dword_F8B19C == 2 )
     {
-      v32 = (ItemGen *)&pParty->field_777C[(int)v30][v29];
-      _this = (ItemGen *)&pParty->field_777C[(int)v30][v29];
+      v32 = (ItemGen *)&pParty->StandartItemsInShops[(int)v30][v29];
+      _this = (ItemGen *)&pParty->StandartItemsInShops[(int)v30][v29];
     }
     else
     {
-      _this =&pParty->Recipes_Item[(int)v30][v29-1]; //(ItemGen *)&pParty->field_C59C[v31 + 724];
-      v32 = &pParty->Recipes_Item[(int)v30][v29-1];//(ItemGen *)&pParty->field_C59C[v31 + 724];
+      _this =&pParty->SpecialItemsInShop[(int)v30][v29-1]; //(ItemGen *)&pParty->field_C59C[v31 + 724];
+      v32 = &pParty->SpecialItemsInShop[(int)v30][v29-1];//(ItemGen *)&pParty->field_C59C[v31 + 724];
     }
     //v33 = p2DEvents_minus1__20[13 * (signed int)v30];
     v33 = p2DEvents[(signed int)v30 - 1].fPriceMultiplier;
@@ -8071,202 +7993,6 @@
   return a1a.Create(0, 0, 0, 0);
 }
 
-//----- (00450218) --------------------------------------------------------
-void __cdecl sub_450218_prolly_generate_chests_loot()
-{
-  unsigned int v0; // eax@1
-  Chest *v1; // ebx@1
-  MapInfo *v2; // esi@1
-  ItemGen *v3; // ebx@2
-  int v4; // ebp@4
-  int v5; // edi@4
-  int v6; // esi@4
-  int v7; // eax@4
-  signed int v8; // esi@4
-  int v9; // edx@4
-  int v10; // esi@8
-  int v11; // ebp@25
-  int v12; // esi@25
-  signed int v13; // ebp@27
-  ItemGen *v14; // edi@28
-  signed int v15; // edx@32
-  signed __int64 v16; // qtt@32
-  int v17; // esi@34
-  signed int v18; // [sp+10h] [bp-18h]@1
-  int v19; // [sp+14h] [bp-14h]@4
-  MapInfo *v20; // [sp+18h] [bp-10h]@1
-  Chest *v21; // [sp+1Ch] [bp-Ch]@1
-  int v22; // [sp+20h] [bp-8h]@26
-  signed int v23; // [sp+24h] [bp-4h]@2
-
-  v18 = rand() % 100;
-  v0 = pMapStats->GetMapInfo(pCurrentMapName);
-  v1 = pChests;
-  v2 = &pMapStats->pInfos[v0];
-  v21 = pChests;
-  v20 = &pMapStats->pInfos[v0];
-  do
-  {
-    v3 = v1->mm7__vector_pItems;
-    v23 = 140;
-    do
-    {
-      if ( (v3->uItemID & 0x80000000u) == 0 )
-        goto LABEL_56;
-      v4 = rand() % 5 + 1;
-      v5 = (unsigned __int8)byte_4E8168[abs((int)v3->uItemID)-1][2*v2->Treasure_prob];//[2 * (v2->Treasure_prob + 7 * abs((int)v3->uItemID)) + 2];
-      v6 = (unsigned __int8)byte_4E8168[abs((int)v3->uItemID)-1][2*v2->Treasure_prob+1];//[2 * (v2->Treasure_prob + 7 * abs((int)v3->uItemID)) + 3];
-      v7 = rand();
-      v8 = v6 - v5 + 1;
-      v9 = v5 + v7 % v8;
-      v19 = v5 + v7 % v8;
-      if ( v9 < 7 )
-      {
-        if ( v18 < 20 )
-        {
-          v3->Reset();
-          goto LABEL_25;
-        }
-        if ( v18 < 60 )
-        {
-          v10 = 0;
-          v3->Reset();
-          if ( v19 == 1 )
-          {
-            v10 = rand() % 51 + 50;
-          }
-          else
-          {
-            if ( v19 != 2 )
-            {
-              if ( v19 == 3 )
-              {
-                v10 = rand() % 301 + 200;
-              }
-              else
-              {
-                if ( v19 != 4 )
-                {
-                  if ( v19 == 5 )
-                  {
-                    v10 = rand() % 1001 + 1000;
-LABEL_15:
-                    v3->uItemID = 199;
-                  }
-                  else
-                  {
-                    if ( v19 == 6 )
-                    {
-                      v10 = rand() % 3001 + 2000;
-                      goto LABEL_15;
-                    }
-                  }
-LABEL_23:
-                  v3->SetIdentified();
-                  v3->uSpecEnchantmentType = v10;
-LABEL_25:
-                  v11 = v4 - 1;
-                  v12 = 0;
-                  if ( v11 > 0 )
-                  {
-                    v22 = v11;
-                    while ( 1 )
-                    {
-                      v13 = v12;
-                      if ( v12 >= 140 )
-                        goto LABEL_52;
-                      v14 = &v21->mm7__vector_pItems[v12];
-                      while ( v14->uItemID )
-                      {
-                        ++v13;
-                        ++v14;
-                        if ( v13 >= 140 )
-                          goto LABEL_52;
-                      }
-                      v16 = rand();
-                      v15 = v16 % 100;
-                      v18 = v16 % 100;
-                      if ( v15 < 20 )
-                        goto LABEL_52;
-                      if ( v15 >= 60 )
-                      {
-                        pItemsTable->GenerateItem(v19, 0, v14);
-                        goto LABEL_51;
-                      }
-                      v17 = 0;
-                      v14->Reset();
-                      if ( v19 == 1 )
-                      {
-                        v17 = rand() % 51 + 50;
-                        goto LABEL_48;
-                      }
-                      if ( v19 == 2 )
-                      {
-                        v17 = rand() % 101 + 100;
-LABEL_48:
-                        v14->uItemID = 197;
-                        goto LABEL_49;
-                      }
-                      if ( v19 == 3 )
-                      {
-                        v17 = rand() % 301 + 200;
-                        goto LABEL_44;
-                      }
-                      if ( v19 == 4 )
-                      {
-                        v17 = rand() % 501 + 500;
-LABEL_44:
-                        v14->uItemID = 198;
-                        goto LABEL_49;
-                      }
-                      if ( v19 == 5 )
-                        break;
-                      if ( v19 == 6 )
-                      {
-                        v17 = rand() % 3001 + 2000;
-LABEL_41:
-                        v14->uItemID = 199;
-                      }
-LABEL_49:
-                      v14->uSpecEnchantmentType = v17;
-LABEL_51:
-                      v12 = v13 + 1;
-LABEL_52:
-                      --v22;
-                      if ( !v22 )
-                        goto LABEL_55;
-                    }
-                    v17 = rand() % 1001 + 1000;
-                    goto LABEL_41;
-                  }
-                  goto LABEL_55;
-                }
-                v10 = rand() % 501 + 500;
-              }
-              v3->uItemID = 198;
-              goto LABEL_23;
-            }
-            v10 = rand() % 101 + 100;
-          }
-          v3->uItemID = 197;
-          goto LABEL_23;
-        }
-        pItemsTable->GenerateItem(v9, 0, v3);
-        goto LABEL_25;
-      }
-      v3->GenerateArtifact();
-LABEL_55:
-      v2 = v20;
-LABEL_56:
-      ++v3;
-      --v23;
-    }
-    while ( v23 );
-    v1 = v21 + 1;
-    ++v21;
-  }
-  while ( (signed int)v21 < (signed int)&uNumChests );
-}
 
 //----- (00450521) --------------------------------------------------------
 signed int __fastcall sub_450521_ProllyDropItemAt(int ecx0, signed int a2, int a3, int a4, int a5, unsigned __int16 a6)
--- a/mm7_4.cpp	Mon Feb 25 11:09:55 2013 +0600
+++ b/mm7_4.cpp	Mon Feb 25 11:10:57 2013 +0600
@@ -4915,7 +4915,7 @@
   NPCData *npc = nullptr;
   if ( dword_5C35D4 )
   {
-    __debugbreak(); // fix  
+    //__debugbreak(); // fix  
     npc = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)];
   }
   else
@@ -8922,7 +8922,7 @@
   pParty->field_3C._shop_ban_times[2 * a1] = LODWORD(pParty->uTimePlayed) + 368640;
   pParty->field_3C._shop_ban_times[2 * a1 + 1] = HIDWORD(v6);
 LABEL_13:
-  *(int *)&pParty->field_16154[4 * a1] = 1;
+  pParty->InTheShopFlags[a1] = 1;
   if ( v3 )
   {
     v7 = &pOutdoor->ddm;
@@ -9055,7 +9055,7 @@
 // F8B1E0: using guessed type int dword_F8B1E0;
 
 
-
+//view  item details  in shop?
 //----- (004B1A2D) --------------------------------------------------------
 void __cdecl sub_4B1A2D()
 {
@@ -9113,7 +9113,7 @@
     v7 = (ItemGen *)((char *)&pParty->pPickedItem + 4 * v6 + 4);
     if ( dword_F8B19C != 2 )
    //   v7 = (ItemGen *)&pParty->field_C59C[v6 + 715];
-		v7 =&pParty->Recipes_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v5];
+		v7 =&pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v5];
     goto LABEL_15;
   }
   if ( dword_F8B198 <= 16 && dword_F8B19C == 18 )
@@ -10365,385 +10365,6 @@
            0);
 }
 
-//----- (004B3703) --------------------------------------------------------
-int __thiscall sub_4B3703(void *_this)
-{
-  signed int v1; // edi@1
-  int v2; // eax@1
-  char *v3; // ecx@1
-  signed int v4; // ebx@1
-  int v5; // ecx@2
-  int v6; // ecx@3
-  int v7; // ecx@4
-  int v8; // ecx@5
-  int v9; // ecx@6
-  signed int v10; // ebx@13
-  signed int v11; // edi@14
-  signed int v12; // esi@15
-  unsigned int v13; // ecx@16
-  int v14; // ecx@16
-  int v15; // ecx@17
-  int v16; // ecx@19
-  int v17; // ecx@20
-  int v18; // ecx@21
-  signed int v19; // esi@32
-  char *v20; // ecx@33
-  int v21; // ecx@34
-  int v22; // ecx@36
-  int v23; // ecx@37
-  int v24; // ecx@38
-  int v25; // ecx@39
-  int v26; // ecx@40
-  int v27; // ecx@41
-  int *v28; // esi@54
-  unsigned int v29; // edx@56
-  char *v30; // ecx@65
-  int v31; // ecx@106
-  int result; // eax@107
-  int v33; // [sp-4h] [bp-2Ch]@23
-  int v34; // [sp-4h] [bp-2Ch]@43
-  int v35[5]; // [sp+Ch] [bp-1Ch]@8
-  int a2; // [sp+20h] [bp-8h]@1
-  int v37; // [sp+24h] [bp-4h]@1
-
-  v1 = 0;
-  v2 = 0;
-  v3 = (char *)_this - 1;
-  a2 = 0;
-  v37 = 0;
-  dword_F8B1DC = 0;
-  v4 = 2;
-  if ( !v3 )
-  {
-    while ( 1 )
-    {
-      v19 = 1;
-      do
-      {
-        v20 = (char *)window_SpeakInHouse->ptr_1C + 4 * (unsigned int)window_SpeakInHouse->ptr_1C + v19;
-        if ( v1 )
-          v21 = word_4F063E[(signed int)v20];
-        else
-          v21 = word_4F0404[(signed int)v20 - 4];//word_4F03FE[(signed int)v20];
-        v22 = v21 - 23;
-        if ( v22 )
-        {
-          v23 = v22 - 1;
-          if ( v23 )
-          {
-            v24 = v23 - 1;
-            if ( v24 )
-            {
-              v25 = v24 - 1;
-              if ( v25 )
-              {
-                v26 = v25 - 1;
-                if ( v26 )
-                {
-                  v27 = v26 - 1;
-                  if ( v27 )
-                  {
-                    if ( v27 != v4 )
-                      goto LABEL_51;
-                    v34 = 36;
-                  }
-                  else
-                  {
-                    v34 = 42;
-                  }
-                }
-                else
-                {
-                  v34 = 41;
-                }
-              }
-              else
-              {
-                v34 = 40;
-              }
-            }
-            else
-            {
-              v34 = 39;
-            }
-          }
-          else
-          {
-            v34 = 38;
-          }
-        }
-        else
-        {
-          v34 = 37;
-        }
-        v37 = sub_4BE571(v34, v35, v37, 5);
-        v2 = dword_F8B1DC;
-        v4 = 2;
-LABEL_51:
-        ++v19;
-      }
-      while ( v19 <= 4 );
-      ++v1;
-      if ( v1 >= v4 )
-        goto LABEL_53;
-    }
-  }
-  v5 = (int)(v3 - 1);
-  if ( !v5 )
-  {
-    v10 = 0;
-    while ( 1 )
-    {
-      v11 = 0;
-      do
-      {
-        v12 = 1;
-        do
-        {
-          v13 = v11 + 2 * (unsigned int)window_SpeakInHouse->ptr_1C - 30;
-          v14 = v12 + 4 * v13 + v13;
-          if ( v10 )
-            v15 = word_4F06D8[v14];
-          else
-            v15 = word_4F0498[v14];
-          v16 = v15 - 31;
-          if ( v16 )
-          {
-            v17 = v16 - 1;
-            if ( v17 )
-            {
-              v18 = v17 - 1;
-              if ( v18 )
-              {
-                if ( v18 != 1 )
-                  goto LABEL_28;
-                v33 = 44;
-              }
-              else
-              {
-                v33 = 47;
-              }
-            }
-            else
-            {
-              v33 = 46;
-            }
-          }
-          else
-          {
-            v33 = 45;
-          }
-          v37 = sub_4BE571(v33, v35, v37, 5);
-          v2 = dword_F8B1DC;
-LABEL_28:
-          ++v12;
-        }
-        while ( v12 <= 4 );
-        ++v11;
-      }
-      while ( v11 < 2 );
-      ++v10;
-      if ( v10 >= 2 )
-        goto LABEL_53;
-    }
-  }
-  v6 = v5 - 1;
-  if ( v6 )
-  {
-    v7 = v6 - 1;
-    if ( v7 )
-    {
-      v8 = v7 - 17;
-      if ( v8 )
-      {
-        v9 = v8 - 2;
-        if ( v9 )
-        {
-          if ( v9 == 7 )
-          {
-            v37 = 2;
-            v35[0] = 69;
-            v35[1] = 60;
-          }
-        }
-        else
-        {
-          v37 = 3;
-          v35[0] = 67;
-          v35[1] = 66;
-          v35[2] = 58;
-        }
-      }
-      else
-      {
-        v37 = 3;
-        v35[0] = 70;
-        v35[1] = 65;
-        v35[2] = 62;
-      }
-    }
-    else
-    {
-      v37 = 2;
-      v35[0] = 71;
-      v35[1] = 68;
-    }
-  }
-  else
-  {
-    v37 = 2;
-    v35[0] = 57;
-    v35[1] = 59;
-  }
-LABEL_53:
-  if ( v37 > 0 )
-  {
-    v28 = v35;
-    while ( 1 )
-    {
-      v29 = *v28;
-      if ( *v28 <= 47 )
-        break;
-      if ( (signed int)v29 <= 66 )
-      {
-        if ( v29 == 66 )
-        {
-          v30 = pSkillNames[30];
-          goto LABEL_106;
-        }
-        if ( v29 == 57 )
-        {
-          v30 = pSkillNames[21];
-          goto LABEL_106;
-        }
-        if ( v29 == 58 )
-        {
-          v30 = pSkillNames[22];
-          goto LABEL_106;
-        }
-        if ( v29 == 60 )
-        {
-          v30 = pSkillNames[24];
-          goto LABEL_106;
-        }
-        if ( v29 == 62 )
-        {
-          v30 = pSkillNames[26];
-          goto LABEL_106;
-        }
-        if ( v29 == 65 )
-        {
-          v30 = pSkillNames[29];
-          goto LABEL_106;
-        }
-        goto LABEL_100;
-      }
-      switch ( v29 )
-      {
-        case 0x43u:
-          v30 = pSkillNames[31];
-          break;
-        case 0x44u:
-          v30 = pSkillNames[32];
-          break;
-        case 0x45u:
-          v30 = pSkillNames[33];
-          break;
-        case 0x46u:
-          v30 = pSkillNames[34];
-          break;
-        default:
-          if ( v29 != 71 )
-            goto LABEL_100;
-          v30 = pSkillNames[35];
-          break;
-      }
-LABEL_106:
-      pShopOptions[v2] = v30;
-      v31 = a2++;
-      dword_F8B1DC = v2 + 1;
-      sub_4B36CC(v31, v29);
-      ++v28;
-      if ( a2 >= v37 )
-        goto LABEL_107;
-      v2 = dword_F8B1DC;
-    }
-    if ( *v28 == 47 )
-    {
-      v30 = pSkillNames[11];
-      goto LABEL_106;
-    }
-    if ( (signed int)v29 > 40 )
-    {
-      if ( v29 == 41 )
-      {
-        v30 = pSkillNames[5];
-        goto LABEL_106;
-      }
-      if ( v29 == 42 )
-      {
-        v30 = pSkillNames[6];
-        goto LABEL_106;
-      }
-      if ( v29 == 44 )
-      {
-        v30 = pSkillNames[8];
-        goto LABEL_106;
-      }
-      if ( v29 == 45 )
-      {
-        v30 = pSkillNames[9];
-        goto LABEL_106;
-      }
-      if ( v29 == 46 )
-      {
-        v30 = pSkillNames[10];
-        goto LABEL_106;
-      }
-    }
-    else
-    {
-      if ( v29 == 40 )
-      {
-        v30 = pSkillNames[4];
-        goto LABEL_106;
-      }
-      if ( v29 == 5 )
-      {
-        v30 = pSkillNames[23];
-        goto LABEL_106;
-      }
-      if ( v29 == 36 )
-      {
-        v30 = pSkillNames[0];
-        goto LABEL_106;
-      }
-      if ( v29 == 37 )
-      {
-        v30 = pSkillNames[1];
-        goto LABEL_106;
-      }
-      if ( v29 == 38 )
-      {
-        v30 = pSkillNames[2];
-        goto LABEL_106;
-      }
-      if ( v29 == 39 )
-      {
-        v30 = pSkillNames[3];
-        goto LABEL_106;
-      }
-    }
-LABEL_100:
-    v30 = pGlobalTXT_LocalizationStrings[127];
-    goto LABEL_106;
-  }
-LABEL_107:
-  pDialogueWindow->_41D08F(a2, 1, 0, 2);
-  result = pDialogueWindow->pNumPresenceButton;
-  dword_F8B1E0 = pDialogueWindow->pNumPresenceButton;
-  return result;
-}
 
 
 //----- (004B3A72) --------------------------------------------------------
@@ -12161,7 +11782,7 @@
     do
     {
      // if ( pParty->field_777C[9 * (v49 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
-	 if ( pParty->field_777C[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID);
+	 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID);
       {
         v50 = dword_F8B168[v49];
         v51 = 152 - v50->uTextureHeight;
@@ -12194,7 +11815,7 @@
     do
     {
       //if ( pParty->field_777C[9 * (v122 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 54] )
-	if ( pParty->field_777C[(unsigned int)window_SpeakInHouse->ptr_1C][v122+1].uItemID);
+	if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v122+1].uItemID);
       {
         v54 = dword_F8B168[v122 + 6];
         v55 = 306 - v54->uTextureHeight;
@@ -12225,7 +11846,7 @@
     do
     {
      // if ( pParty->field_C59C[9 * (v49 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
-	if (pParty->Recipes_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID)
+	if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID)
       {
         v58 = dword_F8B168[v49];
         v59 = 152 - v58->uTextureHeight;
@@ -12258,7 +11879,7 @@
     do
     {
       //if ( pParty->Spell_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v49] + 778] )  //weak
-		if (pParty->Recipes_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uAttributes)
+		if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uAttributes)
       {
         v62 = dword_F8B168[v122 + 6];
         v63 = 306 - v62->uTextureHeight;
@@ -12295,7 +11916,7 @@
     {
       do
       {
-        if ( pParty->field_777C[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID); //9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
+        if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID); //9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
           ++v117;
         ++v66;
       }
@@ -12306,7 +11927,7 @@
       do
       {
         //if ( pParty->field_C59C[9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
-	  if (pParty->Recipes_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID)
+	  if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID)
           ++v117;
         ++v66;
       }
@@ -12340,10 +11961,10 @@
       v117 = v71;
       v72 = (int)window_SpeakInHouse->ptr_1C;
      // v73 = 9 * (v71 + 12 * v72);
-      v74 = (ItemGen *)&pParty->field_777C[v72][v71];
+      v74 = (ItemGen *)&pParty->StandartItemsInShops[v72][v71];
       if ( dword_F8B19C != 2 )
        // v74 = (ItemGen *)&pParty->field_C59C[v73 + 724];
-	      v74 =&pParty->Recipes_Item[v72][v71];
+	      v74 =&pParty->SpecialItemsInShop[v72][v71];
       if ( v67 && Str )
       {
         v10 = pGlobalTXT_LocalizationStrings[181];// "Steal %24"
@@ -13439,92 +13060,6 @@
 
 
 
-//----- (004B8F94) --------------------------------------------------------
-void  sub_4B8F94()
-{
-  GUIWindow *v0; // edi@1
-  signed int v1; // ebp@1
-  int v2; // ebx@1
-  signed int v3; // esi@1
-  int v4; // eax@3
-  int v5; // ebx@3
-  int v6; // ecx@3
-  bool v7; // eax@5
-  bool v8; // ST1C_4@5
-  int v9; // eax@5
-  int v10; // eax@10
-  void *result; // eax@15
-  signed int v12; // [sp-4h] [bp-18h]@7
-
-  v0 = window_SpeakInHouse;
-  v1 = 0;
-  v2 = (int)&window_SpeakInHouse->ptr_1C;
-  v3 = (signed int)window_SpeakInHouse->ptr_1C;
-  //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)ptr_507BC0->ptr_1C]] )
-  if ( _4F063C_smthn_by_2da_uType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] )
-  {
-    while ( v3 > 14 )
-    {
-      if ( v3 <= 28 )
-      {
-        v7 = v1 > 3;
-        v8 = v7;
-        v9 = 5 * (v7 + 2 * v3 - 30);
-        v3 = (signed int)v0->ptr_1C;
-        v5 = word_4F06D8[v9];
-        v6 = word_4F05AE[5 * (v8 + 2 * v3) + rand() % 4];
-        goto LABEL_13;
-      }
-      if ( v3 <= 41 )
-      {
-        v5 = word_4F07B6[v3];
-        v12 = 22;
-        goto LABEL_12;
-      }
-      if ( v3 <= 53 )
-      {
-        if ( v1 >= 6 )
-        {
-          v5 = word_4F07B6[v3 + 1];
-          v12 = 44;
-LABEL_12:
-          v6 = v12;
-LABEL_13:
-          pItemsTable->GenerateItem(v5, v6,&pParty->Recipes_Item[v3][v1]);//(ItemGen *)&pParty->field_C59C[9 * (v1 + 12 * v3) + 724]);
-          v0 = window_SpeakInHouse;
-          v2 = (int)&window_SpeakInHouse->ptr_1C;
-         // pParty->field_C59C[9 * (v1 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 729] = 1;
-		  pParty->Recipes_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v1].uAttributes= 1;
-          goto LABEL_14;
-        }
-       // auto _a = (ItemGen *)&pParty->field_C59C[9 * (v1 + 12 * v3) + 724];
-		 auto _a =&pParty->Recipes_Item[v3][v1];
-        _a->Reset();
-	//	v2 = (int)&v0->ptr_1C;
-		//v10 = rand();
-	//	v0 = window_SpeakInHouse;
-       // pParty->field_C59C[9 * (v1 + 12 * *(int *)v2) + 724] = v10 % 32 + 740;
-		   pParty->Recipes_Item[(int)v0->ptr_1C][v1].uItemID= rand() % 32 + 740;
-      }
-LABEL_14:
-      v3 = *(int *)v2;
-      ++v1;
-      //if ( v1 >= (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * *(int *)v2]] )
-      if ( v1 >= (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents[*(int *)v2 - 1].uType] )
-        goto LABEL_15;
-    }
-    v4 = 5 * v3;
-    v3 = (signed int)v0->ptr_1C;
-    v5 = word_4F063E[v4];
-    v6 = word_4F063E[5 * v3 + rand() % 4 + 1];
-    goto LABEL_13;
-  }
-LABEL_15:
-  result = v0->ptr_1C;
-  pParty->field_16154[(int)v0->ptr_1C] = 0;
-}
-
-
 //----- (004B6478) --------------------------------------------------------
 int __cdecl sub_4B6478()
 {
--- a/mm7_data.cpp	Mon Feb 25 11:09:55 2013 +0600
+++ b/mm7_data.cpp	Mon Feb 25 11:10:57 2013 +0600
@@ -1620,7 +1620,7 @@
 };
 //__int16 word_4F03FE[777]; // weak
 //__int16 word_4F0400[777]; // weak
-__int16 word_4F0404[] =
+/*__int16 word_4F0404[] =
 {
 	0, 0, 1, 0x17, 0x1B, 0x14, 0x14, 1, 0x17, 0x18, 0x1C,
 	0x14, 2, 0x17, 0x18, 0x19, 0x14, 2, 0x1B, 0x1B, 0x1A, 0x1A,
@@ -1629,9 +1629,9 @@
 	3, 0x1C, 0x1C, 0x19, 0x19, 2, 0x17, 0x17, 0x18, 0x18,
 	3, 0x17, 0x17, 0x1A, 0x1A, 2, 0x1E, 0x1A, 0x1A, 0x1A, 2, 0x1C,
 	0x19, 0x1C, 0x1D, 0, 0
-};
+};*/
 //__int16 word_4F0498[777]; // weak
-__int16 word_4F0498[] =
+/*__int16 word_4F0498[] =
 {
 1, 0x23, 0x23, 0x26, 0x26, 1, 0x1F, 0x1F, 0x1F, 0x22, 1, 0x23, 0x23,
 0x26, 0x26, 1, 0x1F, 0x1F, 0x20, 0x22, 2, 0x23, 0x23,
@@ -1643,9 +1643,9 @@
 0x22, 0x22, 3, 0x23, 0x23, 0x26, 0x26, 3, 0x1F, 0x1F,
 0x20, 0x20, 3, 0x23, 0x23, 0x26, 0x26, 3, 0x20, 0x20, 0x20,
 0x21, 3, 0x23, 0x23, 0x26, 0x26, 3, 0x1F, 0x1F, 0x1F, 0x20
-};
+};*/
 //__int16 word_4F0576[777]; // weak
-__int16 word_4F0576[] =
+/*__int16 word_4F0576[] =
 {
 0x23, 0x23, 0x26, 0x26, 3, 0x21, 0x1F, 0x20, 0x22, 3, 0x23, 0x23,
 0x26, 0x26, 3, 0x21, 0x1F, 0x20, 0x22, 4, 0x23, 0x23, 0x26, 0x26,
@@ -1656,18 +1656,16 @@
 0xA2, 0xA1, 0xA0, 2, 0, 0x0A3, 0x0A3, 0xA2, 0xA1, 0xA0,
 3, 0, 0xA3, 0xA3, 0xA2, 0xA1, 0xA0, 3, 0, 0xA3, 0xA3,
 0xA2, 0xA1, 0xA0
-};
+};*/
 
-__int16 word_4F0578[777]; // weak
-__int16 word_4F05AE[777]; // weak
-char _4F063C_smthn_by_2da_uType[31]={ // weak
-0, 6, 8, 12, 12, 0, 0, 0, 0, 0, 0, 0, 2, 0, 25, 0, 30,
-0, 20, 0, 20, 0, 2, 0, 23, 0, 24, 0, 28, 0, 20};
-__int16 word_4F063E[290];
-__int16 word_4F06D8[22];
+//__int16 word_4F0578[777]; // weak
+//__int16 word_4F05AE[777]; // weak
+
+//__int16 word_4F063E[290];
+//__int16 word_4F06D8[22];
 __int16 word_4F0704[40];
 __int16 word_4F0754[49];
-__int16 word_4F07B6[88];
+//__int16 word_4F07B6[88];
 __int16 word_4F0866[14];
 __int16 _4F0882_evt_VAR_PlayerItemInHands_vals[54]=
 {
--- a/mm7_data.h	Mon Feb 25 11:09:55 2013 +0600
+++ b/mm7_data.h	Mon Feb 25 11:10:57 2013 +0600
@@ -1000,17 +1000,17 @@
 extern const char *off_4F03B8[]; // idb
 //extern __int16 word_4F03FE[]; // weak
 //extern __int16 word_4F0400[]; // weak
-extern __int16 word_4F0404[];
-extern __int16 word_4F0498[]; // weak
+//extern __int16 word_4F0404[];
+//extern __int16 word_4F0498[]; // weak
 extern __int16 word_4F0576[]; // weak
-extern __int16 word_4F0578[]; // weak
-extern __int16 word_4F05AE[]; // weak
-extern char _4F063C_smthn_by_2da_uType[31]; // weak
-extern __int16 word_4F063E[290];
-extern __int16 word_4F06D8[22];
+
+//extern __int16 word_4F05AE[]; // weak
+extern char uItemsAmountPerShopType[]; // weak
+//extern __int16 word_4F063E[290];
+//extern __int16 word_4F06D8[22];
 extern __int16 word_4F0704[40];
 extern __int16 word_4F0754[49];
-extern __int16 word_4F07B6[88];
+//extern __int16 word_4F07B6[88];
 extern __int16 word_4F0866[14];
 extern __int16 _4F0882_evt_VAR_PlayerItemInHands_vals[54];
 extern int dword_4F08EC[]; // weak
@@ -2308,7 +2308,7 @@
 const char *__fastcall ContractSelectText(int pEventNumber);
 char __cdecl SimpleHouseAndBoatsDialog();
 struct GUIButton *__fastcall sub_4B36CC(int a1, unsigned int a2);
-int __thiscall sub_4B3703(void *_this);
+int sub_4B3703(int _this);
 int __thiscall sub_4B3A72(int a1); // idb
 int __fastcall sub_4B3AD4(signed int a1);
 int __fastcall sub_4B3B42(signed int a1);
@@ -2330,8 +2330,7 @@
 void __cdecl sub_4B7911();
 void __cdecl _4B7D7E_bank();
 void __cdecl TavernDialog();
-void *__cdecl GenerateShopItems();
-void sub_4B8F94();
+
 char *__cdecl WeaponShopDialog();
 POINT *__cdecl AlchemistDialog();
 void __cdecl ArmorShopDialog();
@@ -2342,7 +2341,7 @@
 void __cdecl ArenaFight();
 struct Texture *__cdecl sub_4BC8D5();
 struct GUIButton *__cdecl UI_CreateEndConversationButton();
-void __fastcall DrawLearnSkillDialog(signed int uMessageParam);
+void __fastcall sub_4BCACC_bounties(signed int a1);
 signed int __cdecl sub_4BD8B5();
 bool __fastcall sub_4BDAAF(ItemGen *a1, int _2da_idx);
 void __cdecl sub_4BDB56_buy_skill____();