Loading...   


diff --git a/zone/corpse.cpp b/zone/corpse.cpp
index 031bdce..60236c0 100644
--- a/zone/corpse.cpp
+++ b/zone/corpse.cpp
@@ -95,8 +95,11 @@ Corpse* Corpse::LoadFromDBData(uint32 in_dbid, uint32 in_charid, char* in_charna
 		ItemList itemlist;
 		ServerLootItem_Struct* tmp = 0;
 		for (unsigned int i=0; i < dbpcs->itemcount; i++) {
-			tmp = new ServerLootItem_Struct;
+			tmp = new ServerLootItem_Struct; // trying to keep track of the differences of this one and the one below..ARGH!!!
 			memcpy(tmp, &dbpcs->items[i], sizeof(player_lootitem::ServerLootItem_Struct));
+			// temp conversion code
+			tmp->lootslot = CalcServerFromCorpse(tmp->lootslot);
+			// end temp
 			itemlist.push_back(tmp);
 		}
 
@@ -147,6 +150,9 @@ Corpse* Corpse::LoadFromDBData(uint32 in_dbid, uint32 in_charid, char* in_charna
 		for (unsigned int i=0; i < dbpc->itemcount; i++) {
 			tmp = new ServerLootItem_Struct;
 			memcpy(tmp, &dbpc->items[i], sizeof(player_lootitem::ServerLootItem_Struct));
+			// temp conversion code
+			tmp->lootslot = CalcServerFromCorpse(tmp->lootslot);
+			// end temp
 			itemlist.push_back(tmp);
 		}
 
@@ -600,6 +609,9 @@ bool Corpse::Save() {
 	end = itemlist.end();
 	for(; cur != end; ++cur) {
 		ServerLootItem_Struct* item = *cur;
+		// temp conversion code
+		item->lootslot = CalcCorpseFromServer(item->lootslot);
+		// end temp
 		memcpy((char*) &dbpc->items[x++], (char*) item, sizeof(player_lootitem::ServerLootItem_Struct));
 	}
 
@@ -2062,6 +2075,56 @@ void Corpse::LoadPlayerCorpseDecayTime(uint32 dbid){
 		safe_delete_array(query);
 }
 
+uint32 Corpse::CalcCorpseFromServer(int16 server_slot) {
+	switch (server_slot) {
+	case MainPowerSource:
+		return 9999;
+	case MainGeneral9:
+		return 9997;
+	case MainGeneral10:
+		return 9998;
+	case MainCursor:
+		return 30;
+	case MainAmmo:
+	case MainGeneral1:
+	case MainGeneral2:
+	case MainGeneral3:
+	case MainGeneral4:
+	case MainGeneral5:
+	case MainGeneral6:
+	case MainGeneral7:
+	case MainGeneral8:
+		return server_slot - 1;
+	default:
+		return server_slot;
+	}
+}
+
+int16 Corpse::CalcServerFromCorpse(uint32 corpse_slot) {
+	switch (corpse_slot) {
+	case 9999:
+		return MainPowerSource;
+	case 9997:
+		return MainGeneral9;
+	case 9998:
+		return MainGeneral10;
+	case 30:
+		return MainCursor;
+	case 21: // old SLOT_AMMO
+	case 22: // old PERSONAL_BEGIN
+	case 23:
+	case 24:
+	case 25:
+	case 26:
+	case 27:
+	case 28:
+	case 29: // old PERSONAL_END
+		return corpse_slot + 1;
+	default:
+		return corpse_slot;
+	}
+}
+
 /*
 void Corpse::CastRezz(uint16 spellid, Mob* Caster){
 	if(Rezzed()){

Raw Paste Data