Skip to content

Comments

Create new feature "equipment".#143

Closed
Tbotas wants to merge 1 commit intoIdleon-Companion:masterfrom
Tbotas:equipment-component
Closed

Create new feature "equipment".#143
Tbotas wants to merge 1 commit intoIdleon-Companion:masterfrom
Tbotas:equipment-component

Conversation

@Tbotas
Copy link

@Tbotas Tbotas commented Jul 27, 2021

Create a new feature "equipment".
Adds a page to select user equipment.
Adds multiple components to select and manage characters equipments.
Adds assets for the equipments.

Create a new feature "equipment".
Adds a page to select user equipment.
Adds multiple components to select and manage characters equipments.
Adds assets for the equipments.
Copy link
Collaborator

@adapap adapap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thank you for adding in all of the data for this and wiring it up to characters. I left a lot of Vue-related suggestions. My most important comment is to change the way that the assets are handled, because this breaks other places that use existing equipment images.

Comment on lines +6 to +10
<img
class="equipment-img border border-secondary me-3 mt-3"
:src="Assets.EquipmentImage(curSlot.name, selectedTypeRef)"
data-bs-toggle="modal"
data-bs-target="#equipment-selector"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be changed in the redesign to use Quasar's q-popup-proxy. Not blocking, just letting you know so that you don't spend too much time on UI before 2.0 launches, which will make these things a lot easier!

Comment on lines +68 to +83
<label for="equipment-luck">Luck</label>
<input
id="equipment-luck"
class="equipment-input"
type="number"
:min="0"
v-model.number="curSlot.luck"
/>
<label for="equipment-reach">Reach</label>
<input
id="equipment-reach"
class="equipment-input"
type="number"
:min="0"
v-model.number="curSlot.reach"
/>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would love to replace all of these with a v-for loop. Add a variable in setup to keep track of these different fields, or just iterate on curSlot.

Comment on lines +178 to +183
watch(selectedIdRef, () => {

if (curCharacter.value && (!curSlot!.value || Object.keys(curSlot!.value).length === 0)) { // Tests if object exists and is not {}
curSlot!.value = EquipmentUtilities.getEmptyEquipment();
}
})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It sounds like curSlot would be better suited as a Vue computed property. This automatically updates the value if any of these dependencies change. In general, prefer computed over watch unless you need explicit side-effects.

Comment on lines +207 to +209
// FIXME: This is an ugly but working way to deep-clone an object...
this.curSlot = JSON.parse(JSON.stringify(newEquipment));
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine for now. Redesign will include lodash which has lodash.cloneDeep. Still seems like you want a computed property though, you can configure get and set to make getters/setters.

@@ -42,6 +43,7 @@ export class Character {
public statues: Record<string, number>;
public constellations: Record<string, boolean>;
public starSigns: Record<string, boolean>;
public equipment: Record<string, Equipment>;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make the key here more explicit? I'd expect equipment to have a static key type such as "helmet" | "chest" | "pants" | "ring1" | ....

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like EquipmentType could be a starting point?

Comment on lines +101 to +112
<div class="flex-row">
<EquipmentsIcon
v-bind:equipmentType="EquipmentType.FishingLine"
v-bind:equipmentId="'fishingline'"
@clicked="equipmentSelected"
/>
<EquipmentsIcon
v-bind:equipmentType="EquipmentType.FishingWeight"
v-bind:equipmentId="'fishingweight'"
@clicked="equipmentSelected"
/>
</div>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth having a prop or something for these non-standard cases? It actually might be better to move these to a separate component/logic since it's not equippable in the same way as other equipment. (can you even see this from the equip menu in-game?)

Comment on lines +118 to +122
<EquipmentsIcon
v-bind:equipmentType="EquipmentType.Food"
v-bind:equipmentId="'food1'"
@clicked="equipmentSelected"
/>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing here. Consider a different component/implementation for food since it can't be upgraded/have different base stats, just bonus multipliers.

Comment on lines +221 to +229
<span class="stat-line">Stats for the current equipment : </span>
<span class="stat-line">Weapon Power : {{ curEquipmentStats.weaponPower }}</span>
<span class="stat-line">Speed : {{ curEquipmentStats.speed }}</span>
<span class="stat-line">Defense : {{ curEquipmentStats.defense }}</span>
<span class="stat-line">Strength : {{ curEquipmentStats.strength }}</span>
<span class="stat-line">Agility : {{ curEquipmentStats.agility }}</span>
<span class="stat-line">Wisdom : {{ curEquipmentStats.wisdom }}</span>
<span class="stat-line">Luck : {{ curEquipmentStats.luck }}</span>
<span class="stat-line">Reach : {{ curEquipmentStats.reach }}</span>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v-for is a powerful friend. Use it frequently!


let curEquipmentStats = EquipmentUtilities.getCurrentSlotStats();

let currentTab = ref(<number>0);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(nit): I think ref<Number>(0) is a better definition, since it binds the type of the ref value.

};
const defaultTab = 'Characters';
const defaultTab = 'Equipment';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Navigation is changing in redesign but I don't think this should be the default? This feature will probably get moved to the character page since it's related to each character rather than a standalone feature.

@adapap adapap mentioned this pull request Nov 7, 2021
@adapap
Copy link
Collaborator

adapap commented Nov 7, 2021

Superceded by #204

@adapap adapap closed this Jan 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants