help me mack the warehouse's save in 1 line in ini files
like 1 line for tc wh 1 line for dc wh and it
like 1 line for tc wh 1 line for dc wh and it
public string PackedWHs = "";
public string TCWH1 = "";
public string TCWH2 = "";
public string TCWH3 = "";
public string TCWH4 = "";
public string PCWH1 = "";
public string PCWH2 = "";
public string PCWH3 = "";
public string PCWH4 = "";
public string ACWH1 = "";
public string ACWH2 = "";
public string ACWH3 = "";
public string ACWH4 = "";
public string DCWH1 = "";
public string DCWH2 = "";
public string DCWH3 = "";
public string DCWH4 = "";
public string BIWH1 = "";
public string BIWH2 = "";
public string BIWH3 = "";
public string BIWH4 = "";
public string MAWH1 = "";
public string MAWH2 = "";
public string MAWH3 = "";
public string MAWH4 = "";
public string MWH1 = "";
public string MWH2 = "";
public string MWH3 = "";
public string MWH4 = "";
public void PackWarehouses()
{
if (!MyClient.There)
return;
TCWH1 = "";
TCWH2 = "";
TCWH3 = "";
TCWH4 = "";
PCWH1 = "";
PCWH2 = "";
PCWH3 = "";
PCWH4 = "";
ACWH1 = "";
ACWH2 = "";
ACWH3 = "";
ACWH4 = "";
DCWH1 = "";
DCWH2 = "";
DCWH3 = "";
DCWH4 = "";
BIWH1 = "";
BIWH2 = "";
BIWH3 = "";
BIWH4 = "";
MAWH1 = "";
MAWH2 = "";
MAWH3 = "";
MAWH4 = "";
MWH1 = "";
MWH2 = "";
MWH3 = "";
MWH4 = "";
PackedWHs = "";
uint TCcount = 0;
uint PCcount = 0;
uint ACcount = 0;
uint DCcount = 0;
uint BIcount = 0;
uint MAcount = 0;
uint Mcount = 0;
foreach (string item in TCWH)
{
if (item != null && item != "")
{
if (TCcount >= 0 && TCcount <= 4)
{
if (TCcount < 4)
TCWH1 += item + ":";
else if (TCcount == 4)
TCWH1 += item;
}
if (TCcount >= 5 && TCcount <= 9)
{
if (TCcount < 9)
TCWH2 += item + ":";
else if (TCcount == 9)
TCWH2 += item;
}
if (TCcount >= 10 && TCcount <= 14)
{
if (TCcount < 14)
TCWH3 += item + ":";
else if (TCcount == 14)
TCWH3 += item;
}
if (TCcount >= 15 && TCcount <= 19)
{
if (TCcount < 19)
TCWH4 += item + ":";
else if (TCcount == 19)
TCWH4 += item;
}
TCcount++;
}
else
break;
}
foreach (string item in PCWH)
{
if (item != null && item != "")
{
if (PCcount >= 0 && PCcount <= 4)
{
if (PCcount < 4)
PCWH1 += item + ":";
else if (PCcount == 4)
PCWH1 += item;
}
if (PCcount >= 5 && PCcount <= 9)
{
if (PCcount < 9)
PCWH2 += item + ":";
else if (PCcount == 9)
PCWH2 += item;
}
if (PCcount >= 10 && PCcount <= 14)
{
if (PCcount < 14)
PCWH3 += item + ":";
else if (PCcount == 14)
PCWH3 += item;
}
if (PCcount >= 15 && PCcount <= 19)
{
if (PCcount < 19)
PCWH4 += item + ":";
else if (PCcount == 19)
PCWH4 += item;
}
PCcount++;
}
else
break;
}
foreach (string item in ACWH)
{
if (item != null && item != "")
{
if (ACcount >= 0 && ACcount <= 4)
{
if (ACcount < 4)
ACWH1 += item + ":";
else if (ACcount == 4)
ACWH1 += item;
}
if (ACcount >= 5 && ACcount <= 9)
{
if (ACcount < 9)
ACWH2 += item + ":";
else if (ACcount == 9)
ACWH2 += item;
}
if (ACcount >= 10 && ACcount <= 14)
{
if (ACcount < 14)
ACWH3 += item + ":";
else if (ACcount == 14)
ACWH3 += item;
}
if (ACcount >= 15 && ACcount <= 19)
{
if (ACcount < 19)
ACWH4 += item + ":";
else if (ACcount == 19)
ACWH4 += item;
}
ACcount++;
}
else
break;
}
foreach (string item in DCWH)
{
if (item != null && item != "")
{
if (DCcount >= 0 && DCcount <= 4)
{
if (DCcount < 4)
DCWH1 += item + ":";
else if (DCcount == 4)
DCWH1 += item;
}
if (DCcount >= 5 && DCcount <= 9)
{
if (DCcount < 9)
DCWH2 += item + ":";
else if (DCcount == 9)
DCWH2 += item;
}
if (DCcount >= 10 && DCcount <= 14)
{
if (DCcount < 14)
DCWH3 += item + ":";
else if (DCcount == 14)
DCWH3 += item;
}
if (DCcount >= 15 && DCcount <= 19)
{
if (DCcount < 19)
DCWH4 += item + ":";
else if (DCcount == 19)
DCWH4 += item;
}
DCcount++;
}
else
break;
}
foreach (string item in BIWH)
{
if (item != null && item != "")
{
if (BIcount >= 0 && BIcount <= 4)
{
if (BIcount < 4)
BIWH1 += item + ":";
else if (BIcount == 4)
BIWH1 += item;
}
if (BIcount >= 5 && BIcount <= 9)
{
if (BIcount < 9)
BIWH2 += item + ":";
else if (BIcount == 9)
BIWH2 += item;
}
if (BIcount >= 10 && BIcount <= 14)
{
if (BIcount < 14)
BIWH3 += item + ":";
else if (BIcount == 14)
BIWH3 += item;
}
if (BIcount >= 15 && BIcount <= 19)
{
if (BIcount < 19)
BIWH4 += item + ":";
else if (BIcount == 19)
BIWH4 += item;
}
BIcount++;
}
else
break;
}
foreach (string item in MAWH)
{
if (item != null && item != "")
{
if (MAcount >= 0 && MAcount <= 4)
{
if (MAcount < 4)
MAWH1 += item + ":";
else if (MAcount == 4)
MAWH1 += item;
}
if (MAcount >= 5 && MAcount <= 9)
{
if (MAcount < 9)
MAWH2 += item + ":";
else if (MAcount == 9)
MAWH2 += item;
}
if (MAcount >= 10 && MAcount <= 14)
{
if (MAcount < 14)
MAWH3 += item + ":";
else if (MAcount == 14)
MAWH3 += item;
}
if (MAcount >= 15 && MAcount <= 19)
{
if (MAcount < 19)
MAWH4 += item + ":";
else if (MAcount == 19)
MAWH4 += item;
}
MAcount++;
}
else
break;
}
foreach (string item in MWH)
{
if (item != null && item != "")
{
if (Mcount >= 0 && Mcount <= 4)
{
if (Mcount < 4)
MWH1 += item + ":";
else if (Mcount == 4)
MWH1 += item;
}
if (Mcount >= 5 && Mcount <= 9)
{
if (Mcount < 9)
MWH2 += item + ":";
else if (Mcount == 9)
MWH2 += item;
}
if (Mcount >= 10 && Mcount <= 14)
{
if (Mcount < 14)
MWH3 += item + ":";
else if (Mcount == 14)
MWH3 += item;
}
if (Mcount >= 15 && Mcount <= 19)
{
if (Mcount < 19)
MWH4 += item + ":";
else if (Mcount == 19)
MWH4 += item;
}
Mcount++;
}
else
break;
}
}
public void UnPackWarehouses()
{
Ready = false;
string Warehouse_TC = TCWH1 + ":" + TCWH2 + ":" + TCWH3 + ":" + TCWH4;
string Warehouse_PC = PCWH1 + ":" + PCWH2 + ":" + PCWH3 + ":" + PCWH4;
string Warehouse_AC = ACWH1 + ":" + ACWH2 + ":" + ACWH3 + ":" + ACWH4;
string Warehouse_DC = DCWH1 + ":" + DCWH2 + ":" + DCWH3 + ":" + DCWH4;
string Warehouse_BI = BIWH1 + ":" + BIWH2 + ":" + BIWH3 + ":" + BIWH4;
string Warehouse_MA = MAWH1 + ":" + MAWH2 + ":" + MAWH3 + ":" + MAWH4;
string Warehouse_M = MWH1 + ":" + MWH2 + ":" + MWH3 + ":" + MWH4;
PackedWHs = Warehouse_TC + ";" + Warehouse_PC + ";" + Warehouse_AC + ";" + Warehouse_DC + ";" + Warehouse_BI + ";" + Warehouse_MA + ";" + Warehouse_M;
string[] Warehouses = PackedWHs.Split(';');
byte count = 0;
foreach (string wh in Warehouses)
{
string[] Items = wh.Split(':');
if (Items.Length < 1)
if (wh.Length > 1)
AddWHItem(wh, (uint)General.Rand.Next(300000), count);
foreach (string item in Items)
{
if (item != "")
{
AddWHItem(item, (uint)General.Rand.Next(300000), count);
}
}
count++;
}
Ready = true;
}
Charr.PackWarehouses();
Save.IniWriteValue("TCWarehouse", "WH1", Charr.TCWH1);
Save.IniWriteValue("TCWarehouse", "WH2", Charr.TCWH2);
Save.IniWriteValue("TCWarehouse", "WH3", Charr.TCWH3);
Save.IniWriteValue("TCWarehouse", "WH4", Charr.TCWH4);
Save.IniWriteValue("PCWarehouse", "WH1", Charr.PCWH1);
Save.IniWriteValue("PCWarehouse", "WH2", Charr.PCWH2);
Save.IniWriteValue("PCWarehouse", "WH3", Charr.PCWH3);
Save.IniWriteValue("PCWarehouse", "WH4", Charr.PCWH4);
Save.IniWriteValue("ACWarehouse", "WH1", Charr.ACWH1);
Save.IniWriteValue("ACWarehouse", "WH2", Charr.ACWH2);
Save.IniWriteValue("ACWarehouse", "WH3", Charr.ACWH3);
Save.IniWriteValue("ACWarehouse", "WH4", Charr.ACWH4);
Save.IniWriteValue("DCWarehouse", "WH1", Charr.DCWH1);
Save.IniWriteValue("DCWarehouse", "WH2", Charr.DCWH2);
Save.IniWriteValue("DCWarehouse", "WH3", Charr.DCWH3);
Save.IniWriteValue("DCWarehouse", "WH4", Charr.DCWH4);
Save.IniWriteValue("BIWarehouse", "WH1", Charr.BIWH1);
Save.IniWriteValue("BIWarehouse", "WH2", Charr.BIWH2);
Save.IniWriteValue("BIWarehouse", "WH3", Charr.BIWH3);
Save.IniWriteValue("BIWarehouse", "WH4", Charr.BIWH4);
Save.IniWriteValue("MAWarehouse", "WH1", Charr.MAWH1);
Save.IniWriteValue("MAWarehouse", "WH2", Charr.MAWH2);
Save.IniWriteValue("MAWarehouse", "WH3", Charr.MAWH3);
Save.IniWriteValue("MAWarehouse", "WH4", Charr.MAWH4);
Save.IniWriteValue("MWarehouse", "WH1", Charr.MWH1);
Save.IniWriteValue("MWarehouse", "WH2", Charr.MWH2);
Save.IniWriteValue("MWarehouse", "WH3", Charr.MWH3);
Save.IniWriteValue("MWarehouse", "WH4", Charr.MWH4);
Quote:
Me and Tao have both posted inventory saves. EXTREMELY similar to warehouse.
Tao's:
[Only registered and activated users can see links. Click Here To Register...]
Mine:
[Only registered and activated users can see links. Click Here To Register...]
Mine #2:
[Only registered and activated users can see links. Click Here To Register...]
Old Warehouse Code (Not coded very well):
Variables:
Pack:Code:public string PackedWHs = ""; public string TCWH1 = ""; public string TCWH2 = ""; public string TCWH3 = ""; public string TCWH4 = ""; public string PCWH1 = ""; public string PCWH2 = ""; public string PCWH3 = ""; public string PCWH4 = ""; public string ACWH1 = ""; public string ACWH2 = ""; public string ACWH3 = ""; public string ACWH4 = ""; public string DCWH1 = ""; public string DCWH2 = ""; public string DCWH3 = ""; public string DCWH4 = ""; public string BIWH1 = ""; public string BIWH2 = ""; public string BIWH3 = ""; public string BIWH4 = ""; public string MAWH1 = ""; public string MAWH2 = ""; public string MAWH3 = ""; public string MAWH4 = ""; public string MWH1 = ""; public string MWH2 = ""; public string MWH3 = ""; public string MWH4 = "";
Unpack:Code:public void PackWarehouses() { if (!MyClient.There) return; TCWH1 = ""; TCWH2 = ""; TCWH3 = ""; TCWH4 = ""; PCWH1 = ""; PCWH2 = ""; PCWH3 = ""; PCWH4 = ""; ACWH1 = ""; ACWH2 = ""; ACWH3 = ""; ACWH4 = ""; DCWH1 = ""; DCWH2 = ""; DCWH3 = ""; DCWH4 = ""; BIWH1 = ""; BIWH2 = ""; BIWH3 = ""; BIWH4 = ""; MAWH1 = ""; MAWH2 = ""; MAWH3 = ""; MAWH4 = ""; MWH1 = ""; MWH2 = ""; MWH3 = ""; MWH4 = ""; PackedWHs = ""; uint TCcount = 0; uint PCcount = 0; uint ACcount = 0; uint DCcount = 0; uint BIcount = 0; uint MAcount = 0; uint Mcount = 0; foreach (string item in TCWH) { if (item != null && item != "") { if (TCcount >= 0 && TCcount <= 4) { if (TCcount < 4) TCWH1 += item + ":"; else if (TCcount == 4) TCWH1 += item; } if (TCcount >= 5 && TCcount <= 9) { if (TCcount < 9) TCWH2 += item + ":"; else if (TCcount == 9) TCWH2 += item; } if (TCcount >= 10 && TCcount <= 14) { if (TCcount < 14) TCWH3 += item + ":"; else if (TCcount == 14) TCWH3 += item; } if (TCcount >= 15 && TCcount <= 19) { if (TCcount < 19) TCWH4 += item + ":"; else if (TCcount == 19) TCWH4 += item; } TCcount++; } else break; } foreach (string item in PCWH) { if (item != null && item != "") { if (PCcount >= 0 && PCcount <= 4) { if (PCcount < 4) PCWH1 += item + ":"; else if (PCcount == 4) PCWH1 += item; } if (PCcount >= 5 && PCcount <= 9) { if (PCcount < 9) PCWH2 += item + ":"; else if (PCcount == 9) PCWH2 += item; } if (PCcount >= 10 && PCcount <= 14) { if (PCcount < 14) PCWH3 += item + ":"; else if (PCcount == 14) PCWH3 += item; } if (PCcount >= 15 && PCcount <= 19) { if (PCcount < 19) PCWH4 += item + ":"; else if (PCcount == 19) PCWH4 += item; } PCcount++; } else break; } foreach (string item in ACWH) { if (item != null && item != "") { if (ACcount >= 0 && ACcount <= 4) { if (ACcount < 4) ACWH1 += item + ":"; else if (ACcount == 4) ACWH1 += item; } if (ACcount >= 5 && ACcount <= 9) { if (ACcount < 9) ACWH2 += item + ":"; else if (ACcount == 9) ACWH2 += item; } if (ACcount >= 10 && ACcount <= 14) { if (ACcount < 14) ACWH3 += item + ":"; else if (ACcount == 14) ACWH3 += item; } if (ACcount >= 15 && ACcount <= 19) { if (ACcount < 19) ACWH4 += item + ":"; else if (ACcount == 19) ACWH4 += item; } ACcount++; } else break; } foreach (string item in DCWH) { if (item != null && item != "") { if (DCcount >= 0 && DCcount <= 4) { if (DCcount < 4) DCWH1 += item + ":"; else if (DCcount == 4) DCWH1 += item; } if (DCcount >= 5 && DCcount <= 9) { if (DCcount < 9) DCWH2 += item + ":"; else if (DCcount == 9) DCWH2 += item; } if (DCcount >= 10 && DCcount <= 14) { if (DCcount < 14) DCWH3 += item + ":"; else if (DCcount == 14) DCWH3 += item; } if (DCcount >= 15 && DCcount <= 19) { if (DCcount < 19) DCWH4 += item + ":"; else if (DCcount == 19) DCWH4 += item; } DCcount++; } else break; } foreach (string item in BIWH) { if (item != null && item != "") { if (BIcount >= 0 && BIcount <= 4) { if (BIcount < 4) BIWH1 += item + ":"; else if (BIcount == 4) BIWH1 += item; } if (BIcount >= 5 && BIcount <= 9) { if (BIcount < 9) BIWH2 += item + ":"; else if (BIcount == 9) BIWH2 += item; } if (BIcount >= 10 && BIcount <= 14) { if (BIcount < 14) BIWH3 += item + ":"; else if (BIcount == 14) BIWH3 += item; } if (BIcount >= 15 && BIcount <= 19) { if (BIcount < 19) BIWH4 += item + ":"; else if (BIcount == 19) BIWH4 += item; } BIcount++; } else break; } foreach (string item in MAWH) { if (item != null && item != "") { if (MAcount >= 0 && MAcount <= 4) { if (MAcount < 4) MAWH1 += item + ":"; else if (MAcount == 4) MAWH1 += item; } if (MAcount >= 5 && MAcount <= 9) { if (MAcount < 9) MAWH2 += item + ":"; else if (MAcount == 9) MAWH2 += item; } if (MAcount >= 10 && MAcount <= 14) { if (MAcount < 14) MAWH3 += item + ":"; else if (MAcount == 14) MAWH3 += item; } if (MAcount >= 15 && MAcount <= 19) { if (MAcount < 19) MAWH4 += item + ":"; else if (MAcount == 19) MAWH4 += item; } MAcount++; } else break; } foreach (string item in MWH) { if (item != null && item != "") { if (Mcount >= 0 && Mcount <= 4) { if (Mcount < 4) MWH1 += item + ":"; else if (Mcount == 4) MWH1 += item; } if (Mcount >= 5 && Mcount <= 9) { if (Mcount < 9) MWH2 += item + ":"; else if (Mcount == 9) MWH2 += item; } if (Mcount >= 10 && Mcount <= 14) { if (Mcount < 14) MWH3 += item + ":"; else if (Mcount == 14) MWH3 += item; } if (Mcount >= 15 && Mcount <= 19) { if (Mcount < 19) MWH4 += item + ":"; else if (Mcount == 19) MWH4 += item; } Mcount++; } else break; } }
Save:Code:public void UnPackWarehouses() { Ready = false; string Warehouse_TC = TCWH1 + ":" + TCWH2 + ":" + TCWH3 + ":" + TCWH4; string Warehouse_PC = PCWH1 + ":" + PCWH2 + ":" + PCWH3 + ":" + PCWH4; string Warehouse_AC = ACWH1 + ":" + ACWH2 + ":" + ACWH3 + ":" + ACWH4; string Warehouse_DC = DCWH1 + ":" + DCWH2 + ":" + DCWH3 + ":" + DCWH4; string Warehouse_BI = BIWH1 + ":" + BIWH2 + ":" + BIWH3 + ":" + BIWH4; string Warehouse_MA = MAWH1 + ":" + MAWH2 + ":" + MAWH3 + ":" + MAWH4; string Warehouse_M = MWH1 + ":" + MWH2 + ":" + MWH3 + ":" + MWH4; PackedWHs = Warehouse_TC + ";" + Warehouse_PC + ";" + Warehouse_AC + ";" + Warehouse_DC + ";" + Warehouse_BI + ";" + Warehouse_MA + ";" + Warehouse_M; string[] Warehouses = PackedWHs.Split(';'); byte count = 0; foreach (string wh in Warehouses) { string[] Items = wh.Split(':'); if (Items.Length < 1) if (wh.Length > 1) AddWHItem(wh, (uint)General.Rand.Next(300000), count); foreach (string item in Items) { if (item != "") { AddWHItem(item, (uint)General.Rand.Next(300000), count); } } count++; } Ready = true; }
Remember, I coded this a long time ago, its uber shitty.Code:Charr.PackWarehouses(); Save.IniWriteValue("TCWarehouse", "WH1", Charr.TCWH1); Save.IniWriteValue("TCWarehouse", "WH2", Charr.TCWH2); Save.IniWriteValue("TCWarehouse", "WH3", Charr.TCWH3); Save.IniWriteValue("TCWarehouse", "WH4", Charr.TCWH4); Save.IniWriteValue("PCWarehouse", "WH1", Charr.PCWH1); Save.IniWriteValue("PCWarehouse", "WH2", Charr.PCWH2); Save.IniWriteValue("PCWarehouse", "WH3", Charr.PCWH3); Save.IniWriteValue("PCWarehouse", "WH4", Charr.PCWH4); Save.IniWriteValue("ACWarehouse", "WH1", Charr.ACWH1); Save.IniWriteValue("ACWarehouse", "WH2", Charr.ACWH2); Save.IniWriteValue("ACWarehouse", "WH3", Charr.ACWH3); Save.IniWriteValue("ACWarehouse", "WH4", Charr.ACWH4); Save.IniWriteValue("DCWarehouse", "WH1", Charr.DCWH1); Save.IniWriteValue("DCWarehouse", "WH2", Charr.DCWH2); Save.IniWriteValue("DCWarehouse", "WH3", Charr.DCWH3); Save.IniWriteValue("DCWarehouse", "WH4", Charr.DCWH4); Save.IniWriteValue("BIWarehouse", "WH1", Charr.BIWH1); Save.IniWriteValue("BIWarehouse", "WH2", Charr.BIWH2); Save.IniWriteValue("BIWarehouse", "WH3", Charr.BIWH3); Save.IniWriteValue("BIWarehouse", "WH4", Charr.BIWH4); Save.IniWriteValue("MAWarehouse", "WH1", Charr.MAWH1); Save.IniWriteValue("MAWarehouse", "WH2", Charr.MAWH2); Save.IniWriteValue("MAWarehouse", "WH3", Charr.MAWH3); Save.IniWriteValue("MAWarehouse", "WH4", Charr.MAWH4); Save.IniWriteValue("MWarehouse", "WH1", Charr.MWH1); Save.IniWriteValue("MWarehouse", "WH2", Charr.MWH2); Save.IniWriteValue("MWarehouse", "WH3", Charr.MWH3); Save.IniWriteValue("MWarehouse", "WH4", Charr.MWH4);
But hey? All of LOTF is uber shitty, so it should fit in just fine.
Quote:
for (byte i = 0; i < 5; i++)
{
for (byte n = 0; n < 20; n++)
{
Extra.Item I2 = new Extra.Item();
I.ReadStruct("CharInfo", "Warehouse" + i + "_" + n, &I2, (uint)sizeof(Extra.Item));
if (I2.ID != 0)
{
if (i == 0)
C.TCWarehouse.Add(I2);
if (i == 1)
C.PCWarehouse.Add(I2);
if (i == 2)
C.ACWarehouse.Add(I2);
if (i == 3)
C.DCWarehouse.Add(I2);
if (i == 4)
C.BIWarehouse.Add(I2);
}
}
}
for (byte n = 0; n < 40; n++)
{
Extra.Item I2 = new Extra.Item();
I.ReadStruct("CharInfo", "Warehouse" + 5 + "_" + n, &I2, (uint)sizeof(Extra.Item));
if (I2.ID != 0)
C.MAWarehouse.Add(I2);
}
great lectureQuote:
First, culo, you're an idiot, gtfo.
Second, at the thread starter, seriously? If you can't convert your source to ini, then don't. Chances are your server will just use more memory and be slower with your crappy ini use. If you can't do this, why even try to start a server? You've asked how to do this for like everything, at least try for yourself... And I mean try, not just be like "oh.. idk c# at all rly... lemme go ask."
Third, emme's code is better, but it can be improved... Not like he even wrote it, it's still tanel's. Hybrids warehouse code is probably the best way I can think of to actually do warehouses, if you can understand it(how it works/what it would do) in his stickied thread about what you should know before starting a server. Maybe half of you should go actually f*cking read it.