| 2371 | } |
| 2372 | |
| 2373 | Corpse *Corpse::LoadCharacterCorpse( |
| 2374 | const CharacterCorpsesRepository::CharacterCorpses &cc, |
| 2375 | const glm::vec4 &position |
| 2376 | ) |
| 2377 | { |
| 2378 | if (!cc.id) { |
| 2379 | LogCorpses("Unable to create a corpse entity for character corpse_id [{}]", cc.id); |
| 2380 | return nullptr; |
| 2381 | } |
| 2382 | |
| 2383 | const auto &items = CharacterCorpseItemsRepository::GetWhere( |
| 2384 | database, |
| 2385 | fmt::format( |
| 2386 | "`corpse_id` = {}", |
| 2387 | cc.id |
| 2388 | ) |
| 2389 | ); |
| 2390 | |
| 2391 | LootItems item_list; |
| 2392 | for (auto &i: items) { |
| 2393 | item_list.push_back( |
| 2394 | new LootItem{ |
| 2395 | .item_id = i.item_id, |
| 2396 | .equip_slot = static_cast<int16>(i.equip_slot), |
| 2397 | .charges = static_cast<uint16>(i.charges), |
| 2398 | .lootslot = 0, |
| 2399 | .aug_1 = i.aug_1, |
| 2400 | .aug_2 = i.aug_2, |
| 2401 | .aug_3 = i.aug_3, |
| 2402 | .aug_4 = i.aug_4, |
| 2403 | .aug_5 = i.aug_5, |
| 2404 | .aug_6 = static_cast<uint32>(i.aug_6), |
| 2405 | .attuned = static_cast<bool>(i.attuned) |
| 2406 | } |
| 2407 | ); |
| 2408 | } |
| 2409 | |
| 2410 | auto c = new Corpse( |
| 2411 | cc.id, |
| 2412 | cc.charid, |
| 2413 | cc.charname.c_str(), |
| 2414 | &item_list, |
| 2415 | cc.copper, |
| 2416 | cc.silver, |
| 2417 | cc.gold, |
| 2418 | cc.platinum, |
| 2419 | position, |
| 2420 | cc.size, |
| 2421 | cc.gender, |
| 2422 | cc.race, |
| 2423 | cc.class_, |
| 2424 | cc.deity, |
| 2425 | cc.level, |
| 2426 | cc.texture, |
| 2427 | cc.helm_texture, |
| 2428 | cc.exp, |
| 2429 | cc.gm_exp, |
| 2430 | static_cast<KilledByTypes>(cc.killed_by), |
no test coverage detected