Skip to content

Commit

Permalink
Add ProxyType: for DropTables
Browse files Browse the repository at this point in the history
  • Loading branch information
savage13 committed Aug 22, 2024
1 parent 511ea8c commit 4a6ffc0
Show file tree
Hide file tree
Showing 5 changed files with 446 additions and 4 deletions.
172 changes: 172 additions & 0 deletions public/game_files/horn_material.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
{
"Dm_Enemy_Bokoblin_Boss_Senior": "Item_Enemy_133",
"Dm_Enemy_Bokoblin_Junior": "Item_Enemy_77",
"Dm_Enemy_Bokoblin_Middle": "Item_Enemy_78",
"Dm_Enemy_Bokoblin_Senior": "Item_Enemy_79",
"Dm_Enemy_Zombie_Junior_Defense": "Item_Enemy_77",
"Enemy_Bokoblin_Armor_Dark": "Item_Enemy_80",
"Enemy_Bokoblin_Armor_Junior": "Item_Enemy_77",
"Enemy_Bokoblin_Armor_Middle": "Item_Enemy_78",
"Enemy_Bokoblin_Armor_Senior": "Item_Enemy_79",
"Enemy_Bokoblin_Bone_Junior": "Item_Enemy_77",
"Enemy_Bokoblin_Bone_Junior_AllDay": "Item_Enemy_77",
"Enemy_Bokoblin_Bone_Junior_AllDay_AlwaysRespawn": "Item_Enemy_77",
"Enemy_Bokoblin_Bone_Junior_Head": "Item_Enemy_77",
"Enemy_Bokoblin_Bone_Junior_Head_AllDay": "Item_Enemy_77",
"Enemy_Bokoblin_Boss_Dark": "Item_Enemy_134",
"Enemy_Bokoblin_Boss_Junior": "Item_Enemy_64",
"Enemy_Bokoblin_Boss_Middle": "Item_Enemy_132",
"Enemy_Bokoblin_Boss_Senior": "Item_Enemy_133",
"Enemy_Bokoblin_Boss_Senior_NoOrder": "Item_Enemy_133",
"Enemy_Bokoblin_Dark": "Item_Enemy_80",
"Enemy_Bokoblin_Guard_Junior": "Item_Enemy_77",
"Enemy_Bokoblin_Guard_Junior_Ambush": "Item_Enemy_77",
"Enemy_Bokoblin_Guard_Junior_Cliff": "Item_Enemy_77",
"Enemy_Bokoblin_Guard_Junior_Golem_Fort": "Item_Enemy_77",
"Enemy_Bokoblin_Guard_Junior_TreeHouseTop": "Item_Enemy_77",
"Enemy_Bokoblin_Guard_Middle": "Item_Enemy_78",
"Enemy_Bokoblin_Guard_Middle_Ambush": "Item_Enemy_78",
"Enemy_Bokoblin_Guard_Middle_Cliff": "Item_Enemy_78",
"Enemy_Bokoblin_Guard_Middle_TreeHouseTop": "Item_Enemy_78",
"Enemy_Bokoblin_Junior": "Item_Enemy_77",
"Enemy_Bokoblin_Middle": "Item_Enemy_78",
"Enemy_Bokoblin_NoSleep_Junior": "Item_Enemy_77",
"Enemy_Bokoblin_Senior": "Item_Enemy_79",
"Enemy_Bokoblin_Sniper_Junior": "Item_Enemy_77",
"Enemy_CDungeon_Practice": "NoHorn",
"Enemy_Chuchu_Electric_Junior": "Item_Enemy_77",
"Enemy_Chuchu_Electric_Middle": "Item_Enemy_77",
"Enemy_Chuchu_Electric_Middle_Army": "Item_Enemy_77",
"Enemy_Chuchu_Electric_Senior": "Item_Enemy_77",
"Enemy_Chuchu_Fire_Junior": "Item_Enemy_77",
"Enemy_Chuchu_Fire_Middle": "Item_Enemy_77",
"Enemy_Chuchu_Fire_Middle_Army": "Item_Enemy_77",
"Enemy_Chuchu_Fire_Senior": "Item_Enemy_77",
"Enemy_Chuchu_Ice_Junior": "Item_Enemy_77",
"Enemy_Chuchu_Ice_Middle": "Item_Enemy_77",
"Enemy_Chuchu_Ice_Middle_Army": "Item_Enemy_77",
"Enemy_Chuchu_Ice_Senior": "Item_Enemy_77",
"Enemy_Chuchu_Junior": "Item_Enemy_77",
"Enemy_Chuchu_Middle": "Item_Enemy_77",
"Enemy_Chuchu_Senior": "Item_Enemy_77",
"Enemy_Drake": "Item_Enemy_77",
"Enemy_Drake_Electric": "Item_Enemy_77",
"Enemy_Drake_Fire": "Item_Enemy_77",
"Enemy_Drake_Ice": "Item_Enemy_77",
"Enemy_Drake_Mix": "Item_Enemy_77",
"Enemy_Ganondorf": "Item_Enemy_77",
"Enemy_Ganondorf_Miasma": "Item_Enemy_77",
"Enemy_Giant_Bone": "Item_Enemy_142",
"Enemy_Giant_Bone_AllDay": "Item_Enemy_142",
"Enemy_Giant_Bone_Eye": "Item_Enemy_77",
"Enemy_Giant_Bone_Eye_AllDay": "Item_Enemy_77",
"Enemy_Giant_Junior": "Item_Enemy_142",
"Enemy_Giant_Junior_KeyCrystal": "Item_Enemy_142",
"Enemy_Giant_Middle": "Item_Enemy_143",
"Enemy_Giant_Senior": "Item_Enemy_144",
"Enemy_Golem_Fire": "Item_Enemy_77",
"Enemy_Golem_Fire_KeyCrystal": "Item_Enemy_77",
"Enemy_Golem_Fort_A": "Item_Enemy_77",
"Enemy_Golem_Fort_A_Wander": "Item_Enemy_77",
"Enemy_Golem_Ice": "Item_Enemy_77",
"Enemy_Golem_Ice_KeyCrystal": "Item_Enemy_77",
"Enemy_Golem_Junior": "Item_Enemy_77",
"Enemy_Golem_Junior_KeyCrystal": "Item_Enemy_77",
"Enemy_Golem_Little": "Item_Enemy_77",
"Enemy_Golem_Little_Fire": "Item_Enemy_77",
"Enemy_Golem_Little_Ice": "Item_Enemy_77",
"Enemy_Golem_Middle": "Item_Enemy_77",
"Enemy_Golem_Senior": "Item_Enemy_77",
"Enemy_Horablin_Dark": "Item_Enemy_103",
"Enemy_Horablin_Guard_Junior": "Item_Enemy_100",
"Enemy_Horablin_Guard_Middle": "Item_Enemy_101",
"Enemy_Horablin_Junior": "Item_Enemy_100",
"Enemy_Horablin_Middle": "Item_Enemy_101",
"Enemy_Horablin_Senior": "Item_Enemy_102",
"Enemy_LikeLike_Crack": "Item_Enemy_77",
"Enemy_LikeLike_Crack_RagdollShort": "Item_Enemy_77",
"Enemy_LikeLike_Electric": "Item_Enemy_77",
"Enemy_LikeLike_Electric_RagdollShort": "Item_Enemy_77",
"Enemy_LikeLike_Fire": "Item_Enemy_77",
"Enemy_LikeLike_Fire_RagdollShort": "Item_Enemy_77",
"Enemy_LikeLike_Ice": "Item_Enemy_77",
"Enemy_LikeLike_Ice_RagdollShort": "Item_Enemy_77",
"Enemy_LikeLike_Plane": "Item_Enemy_77",
"Enemy_LikeLike_Plane_RagdollShort": "Item_Enemy_77",
"Enemy_LikeLike_Tar": "Item_Enemy_77",
"Enemy_Lizalfos_Bone_Junior": "Item_Enemy_106",
"Enemy_Lizalfos_Bone_Junior_Head": "Item_Enemy_106",
"Enemy_Lizalfos_Dark": "Item_Enemy_109",
"Enemy_Lizalfos_Electric": "Item_Enemy_60",
"Enemy_Lizalfos_Fire": "Item_Enemy_58",
"Enemy_Lizalfos_Fire_GerudoCanyon": "Item_Enemy_58",
"Enemy_Lizalfos_Fire_GerudoCanyon_PopUp": "Item_Enemy_58",
"Enemy_Lizalfos_Guard_Junior": "Item_Enemy_106",
"Enemy_Lizalfos_Guard_Junior_LongVisibility": "Item_Enemy_106",
"Enemy_Lizalfos_Guard_Middle": "Item_Enemy_107",
"Enemy_Lizalfos_Guard_Middle_LongVisibility": "Item_Enemy_107",
"Enemy_Lizalfos_Ice": "Item_Enemy_59",
"Enemy_Lizalfos_Ice_GerudoCanyon": "Item_Enemy_59",
"Enemy_Lizalfos_Ice_GerudoCanyon_Popup": "Item_Enemy_59",
"Enemy_Lizalfos_Junior": "Item_Enemy_106",
"Enemy_Lizalfos_Middle": "Item_Enemy_107",
"Enemy_Lizalfos_Senior": "Item_Enemy_108",
"Enemy_Lynel_Boss": "Item_Enemy_148",
"Enemy_Lynel_Boss_Dark": "Item_Enemy_151",
"Enemy_Lynel_Boss_Middle": "Item_Enemy_149",
"Enemy_Lynel_Boss_Senior": "Item_Enemy_150",
"Enemy_Lynel_Dark": "Item_Enemy_151",
"Enemy_Lynel_Junior": "Item_Enemy_148",
"Enemy_Lynel_Middle": "Item_Enemy_149",
"Enemy_Lynel_Senior": "Item_Enemy_150",
"Enemy_MiddleBoss_Goron": "Item_Enemy_77",
"Enemy_Mogurudo_Baby_Junior": "Item_Enemy_77",
"Enemy_Mogurudo_Junior": "Item_Enemy_186",
"Enemy_Mogurudo_Middle": "Item_Enemy_187",
"Enemy_Mogurudo_Senior": "Item_Enemy_188",
"Enemy_Moriblin_Bone_Junior": "Item_Enemy_89",
"Enemy_Moriblin_Bone_Junior_AllDay": "Item_Enemy_89",
"Enemy_Moriblin_Bone_Junior_AllDay_AlwaysRespawn": "Item_Enemy_89",
"Enemy_Moriblin_Bone_Junior_Head": "Item_Enemy_89",
"Enemy_Moriblin_Bone_Junior_Head_AllDay": "Item_Enemy_89",
"Enemy_Moriblin_Dark": "Item_Enemy_92",
"Enemy_Moriblin_Junior": "Item_Enemy_89",
"Enemy_Moriblin_Junior_LongSight": "Item_Enemy_89",
"Enemy_Moriblin_Junior_Lookout_Cliff": "Item_Enemy_89",
"Enemy_Moriblin_Middle": "Item_Enemy_90",
"Enemy_Moriblin_Senior": "Item_Enemy_91",
"Enemy_Octarock": "Item_Enemy_77",
"Enemy_Octarock_Desert": "Item_Enemy_77",
"Enemy_Octarock_Forest": "Item_Enemy_77",
"Enemy_Octarock_Snow": "Item_Enemy_77",
"Enemy_PhantomGanon": "Item_Enemy_77",
"Enemy_Sandworm": "Item_Enemy_77",
"Enemy_Treant_Bee": "Item_Enemy_77",
"Enemy_Treant_Broadleaf": "Item_Enemy_77",
"Enemy_Treant_D": "Item_Enemy_77",
"Enemy_Treant_E": "Item_Enemy_77",
"Enemy_Zombie_Boss_Junior": "Item_Enemy_77",
"Enemy_Zombie_Boss_Junior_Defense": "Item_Enemy_77",
"Enemy_Zombie_Boss_Junior_ForDungeonBossGerudoBattle": "Item_Enemy_77",
"Enemy_Zombie_Junior": "Item_Enemy_77",
"Enemy_Zombie_Junior_Defense": "Item_Enemy_77",
"Enemy_Zombie_Junior_ForDungeonBossGerudoBattle": "Item_Enemy_77",
"Enemy_Zonau_Golem_Dark": "Item_Enemy_193",
"Enemy_Zonau_Golem_Junior": "Item_Enemy_67",
"Enemy_Zonau_Golem_Junior_ForFirstSmallDungeon": "Item_Enemy_67",
"Enemy_Zonau_Golem_Middle": "Item_Enemy_191",
"Enemy_Zonau_Golem_Senior": "Item_Enemy_192",
"Enemy_Zonau_Robot_Dark": "Item_Enemy_169",
"Enemy_Zonau_Robot_Junior": "Item_Enemy_166",
"Enemy_Zonau_Robot_Junior_Beginning": "Item_Enemy_166",
"Enemy_Zonau_Robot_Junior_Lookout": "Item_Enemy_166",
"Enemy_Zonau_Robot_Junior_Lookout_Mile": "Item_Enemy_166",
"Enemy_Zonau_Robot_Middle": "Item_Enemy_167",
"Enemy_Zonau_Robot_Middle_Lookout": "Item_Enemy_167",
"Enemy_Zonau_Robot_Senior": "Item_Enemy_168",
"Ganondorf_Miasma_Parturition": "Item_Enemy_77",
"MiasmaSwarm": "Item_Enemy_77",
"MiasmaSwarm_DekuTree": "Item_Enemy_77",
"MiasmaSwarm_LastDungeon": "Item_Enemy_77",
"MiasmaTentacle": "Item_Enemy_77"
}
146 changes: 146 additions & 0 deletions src/components/AppMapDetailsObj.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ export default class AppMapDetailsObj extends AppMapDetailsBase<MapMarkerObj | M

private dropTables: { [key: string]: any } = {};
private shopData: { [key: string]: any } = {};
private areaData: { [key: string]: any } = {};
private hornMaterial: { [key: string]: string } = {};
private dropTableChest: { [key: string]: any } = {};

private areaMarkers: L.Path[] = [];
private staticData = staticData;
Expand Down Expand Up @@ -109,6 +112,9 @@ export default class AppMapDetailsObj extends AppMapDetailsBase<MapMarkerObj | M
this.railsWithMarkers = [];
this.selectedRailIdx = -1;
this.shopData = {};
this.areaData = {};
this.hornMaterial = {};
this.dropTableChest = {};
if (this.minObj.objid) {
this.obj = (await MapMgr.getInstance().getObjByObjId(this.minObj.objid))!;
} else {
Expand All @@ -126,7 +132,30 @@ export default class AppMapDetailsObj extends AppMapDetailsBase<MapMarkerObj | M
const dropTableName = this.getDropTableName();
if (dropTableName) {
this.dropTables = await MapMgr.getInstance().getObjDropTables(this.getRankedUpActorNameForObj(this.minObj), dropTableName);
if (this.minObj.name.startsWith("Enemy_LikeLike_")) {
// Enemy_LikeLike_ are the only actors with ProxyType: TBox
// Get the DropActorDropTable from the DropTableElement where
// ProxyType is TBox and ProxySetting is on
const table_name = this.dropTables.items
.filter((elements: any) =>
elements.DropTableElement.some((el: any) => el.IsProxySetting && el.ProxyType == 'TBox')
)
.map((elements: any) => elements.DropActorDropTable).pop()
if (table_name)
this.dropTableChest = await MapMgr.getInstance().getObjDropTables("TBox_Field_Enemy", table_name)
}
if (this.minObj.name.startsWith("Enemy_Sandworm")) {
// Fake a ProxyType: TBox to get the contents of the Molduga Chest
this.dropTableChest = await MapMgr.getInstance().getObjDropTables("TBox_Field_Iron_Sandworm", "Sandworm")
let el = this.dropTables.items.find((el: any) => el.DropActorDropTable == "Sandworm")
if (el) {
el.DropTableElement[0].IsProxySetting = true
el.DropTableElement[0].ProxyType = "TBox"
}
}
}
this.areaData = await this.getAreaData();
this.hornMaterial = await MsgMgr.getInstance().getHornMaterialData();

this.aiGroups = await MapMgr.getInstance().getObjAiGroups(this.obj.map_type, this.obj.map_name, this.obj.hash_id);

Expand Down Expand Up @@ -488,6 +517,123 @@ export default class AppMapDetailsObj extends AppMapDetailsBase<MapMarkerObj | M
return `Items: ${num}`;
}

async getAreaData() {
// @ts-ignore
const fieldarea = this.obj.fieldarea
if (!fieldarea)
return {}
let name = undefined
let num = undefined
for (const key of ["Surface", "Sky", "Cave", "Depths"]) {
if (fieldarea.startsWith(key)) {
num = parseInt(fieldarea.replace(key, ""))
name = key
break
}
}
if (!name || num === undefined) {
return "Proxy Lookup Failed"
}
if (name == "Surface")
name = "Ground"
if (name == "Depths")
name = "MinusField"

const area_data = await MsgMgr.getInstance().getAreaData(name, num);
return area_data
}

getDropTableProxyLength(item: any): number {
// Only need to know if the values is 0, 1, or something larger
if (!Object.keys(this.areaData).length)
return 0
if (item.ProxyType == "WeaponDefault") {
return 1
}
if (item.ProxyType == "LocalSeaFood") {
return 2;
}
if (item.ProxyType == "ZonauBlockMaster") {
return 2;
}
if (item.ProxyType == "EcoSystemRain") {
return 2;
}
if (item.ProxyType == "HornMaterial") {
return 1
}
if (item.ProxyType == "TBox") {
return 2;
}

return 0
}

getDropTableProxyName(item: any) {
if (item.ProxyType == "WeaponDefault") {
return "Weapon"
}
if (item.ProxyType == "LocalSeaFood") {
return "Local Seafood"
}
if (item.ProxyType == "ZonauBlockMaster") {
return "Zonai Capsules"
}
if (item.ProxyType == "EcoSystemRain") {
return "Special Rain Items"
}
if (item.ProxyType == "HornMaterial") {
return "Horn"
}
if (item.ProxyType == "TBox") {
return "Treasure Chest"
}
return ""
}

getDropTableProxy(item: any) {
if (!Object.keys(this.areaData).length)
return ""
if (item.ProxyType == "WeaponDefault" && this.areaData.Weapon) {
let WeaponOrder = ["SmallSword", "LargeSword", "Spear", "Bow"] // Bow never appears
let index = WeaponOrder.indexOf(item.WeaponType)
return this.getName(this.areaData.Weapon[index].name)
}
if (item.ProxyType == "LocalSeaFood" && this.areaData.Seafood && this.areaData.Seafood != "") {
return this.areaData.Seafood.map((fish: any) => {
return { num: fish.num, name: this.getName(fish.name) }
})
}
if (item.ProxyType == "ZonauBlockMaster" && this.areaData.SpObjCapsuleBlockMaster) {
let len = this.areaData.SpObjCapsuleBlockMaster.length
let num = 100.0 / len;
return this.areaData.SpObjCapsuleBlockMaster.map((fish: any) => {
return { num, name: this.getName(fish.name) }
})
}
if (item.ProxyType == "EcoSystemRain" && this.areaData.RainBonusMaterial) {
return this.areaData.RainBonusMaterial.map((wet: any) => {
return { num: wet.num, name: this.getName(wet.name) }
})
}
if (item.ProxyType == "HornMaterial" && this.minObj) {
return this.getName(this.hornMaterial[this.minObj.name] || "Unknown Horn Material")
}
if (item.ProxyType == "TBox" && this.dropTableChest) {
return this.dropTableChest.items[0].DropTableElement.map((v: any) => {
let name = this.getDropItemName(v)
return { num: v.DropProbability, name }
})
}
return "Unknown Proxy Type"
}

getDropItemName(item: any) {
if (item.isProxySetting)
return this.getDropTableProxy(item)
return this.getName(item.DropActorName.split("/").pop().split(".")[0])
}

findItemByHash(group: any[], links: any[], name: string): any {
let hashes = links.map(link => link.DestUnitHashId);
let out = group.find(g => g.data.UnitConfigName == name && hashes.includes(g.hash_id));
Expand Down
32 changes: 28 additions & 4 deletions src/components/AppMapDetailsObj.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,27 @@
<table>
<tr v-for="(item, kitem) in [...group.DropTableElement].sort((a,b) => b.DropProbability - a.DropProbability)" :key="kitem" class="droptable_item">
<td class="drop-probability">{{item.DropProbability}}%</td>
<td>
<span v-if="item.IsProxySetting">{{item.ProxyType}} - {{item.WeaponType}}</span>
<span v-else>{{getName(item.DropActorName.split("/").pop().split(".")[0])}}</span>
</td>
<template v-if="item.IsProxySetting">
<td v-if="getDropTableProxyLength(item) == 1">
<span>{{getDropTableProxy(item)}}</span>
</td>
<td v-else-if="getDropTableProxyLength(item) == 0">
</td>
<td v-else>
<div>{{getDropTableProxyName(item)}}</div>
<table>
<tr v-for="(pitem, ipitem) in getDropTableProxy(item)" :key="ipitem">
<td class="drop-probability-sub">{{pitem.num}}%</td>
<td><span>{{pitem.name}}</span></td>
</tr>
</table>
</td>
</template>
<template v-else>
<td>
<span>{{getDropItemName(item)}}</span>
</td>
</template>
</tr>
</table>
</div>
Expand Down Expand Up @@ -202,5 +219,12 @@
text-align: right;
margin-right: 1em;
}
.drop-probability-sub {
display: inline-block;
width: 2.5em;
text-align: right;
margin-right: 1em;
}
</style>
<script src="./AppMapDetailsObj.ts"></script>
Loading

0 comments on commit 4a6ffc0

Please sign in to comment.