Remove sold items from equipment slots and loadout slots if they exist there so they no longer linger. Relase Build 7870. Game Version 0.4.2
This commit is contained in:
parent
75fd63dbcd
commit
a8ec34c12b
1
.gitignore
vendored
1
.gitignore
vendored
@ -399,3 +399,4 @@ test.cpp
|
|||||||
/Adventures in Lestoria/packkey.cpp
|
/Adventures in Lestoria/packkey.cpp
|
||||||
/x64/Release/Adventures in Lestoria.zip
|
/x64/Release/Adventures in Lestoria.zip
|
||||||
/x64/Release/Adventures in Lestoria_web.zip
|
/x64/Release/Adventures in Lestoria_web.zip
|
||||||
|
/x64/Release/AdventuresInLestoria_web.zip
|
||||||
|
@ -3228,7 +3228,7 @@ const std::weak_ptr<Item>AiL::GetLoadoutItem(int slot){
|
|||||||
void AiL::RestockLoadoutItems(){
|
void AiL::RestockLoadoutItems(){
|
||||||
for(int i=0;i<GetLoadoutSize();i++){
|
for(int i=0;i<GetLoadoutSize();i++){
|
||||||
if(!ISBLANK(GetLoadoutItem(i))){
|
if(!ISBLANK(GetLoadoutItem(i))){
|
||||||
SetLoadoutItem(i,GetLoadoutItem(i).lock()->ActualName);
|
SetLoadoutItem(i,GetLoadoutItem(i).lock()->ActualName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -843,6 +843,7 @@ void Inventory::UnequipItem(EquipSlot slot){
|
|||||||
game->GetPlayer()->RecalculateEquipStats();
|
game->GetPlayer()->RecalculateEquipStats();
|
||||||
};
|
};
|
||||||
EquipSlot Inventory::GetSlotEquippedIn(const std::weak_ptr<Item>it){
|
EquipSlot Inventory::GetSlotEquippedIn(const std::weak_ptr<Item>it){
|
||||||
|
if(it.expired()||!it.lock()->IsEquippable())return EquipSlot::NONE;
|
||||||
for(int i=int(EquipSlot::HELMET);i<=int(EquipSlot::RING2);i<<=1){
|
for(int i=int(EquipSlot::HELMET);i<=int(EquipSlot::RING2);i<<=1){
|
||||||
EquipSlot slot=EquipSlot(i);
|
EquipSlot slot=EquipSlot(i);
|
||||||
std::weak_ptr<Item>equip=GetEquip(slot);
|
std::weak_ptr<Item>equip=GetEquip(slot);
|
||||||
|
@ -205,9 +205,30 @@ void Merchant::SellItem(std::weak_ptr<Item>item,uint32_t amt){
|
|||||||
}
|
}
|
||||||
totalCost=item.lock()->SellValue()*amt;
|
totalCost=item.lock()->SellValue()*amt;
|
||||||
|
|
||||||
|
//If the item is equipped on our character, remove it.
|
||||||
|
EquipSlot equippedItemSlot=Inventory::GetSlotEquippedIn(item);
|
||||||
|
if(equippedItemSlot!=EquipSlot::NONE)Inventory::UnequipItem(equippedItemSlot);
|
||||||
|
|
||||||
|
int foundLoadoutSlot=-1;
|
||||||
|
//If the item exists in our loadout, remove it.
|
||||||
|
for(int i=0;i<game->GetLoadoutSize();i++){
|
||||||
|
if(!ISBLANK(game->GetLoadoutItem(i))&&game->GetLoadoutItem(i).lock()->ActualName()==item.lock()->ActualName()){
|
||||||
|
game->ClearLoadoutItem(i);
|
||||||
|
if(foundLoadoutSlot!=-1)ERR("WARNING! Found two loadout item slots with the same item! THIS SHOULD NOT BE HAPPENING!")
|
||||||
|
foundLoadoutSlot=i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string itemName=item.lock()->ActualName(); //We need the item name since our reference to the item is about to be deleted.
|
||||||
|
|
||||||
Inventory::RemoveItem(item,amt);
|
Inventory::RemoveItem(item,amt);
|
||||||
game->GetPlayer()->SetMoney(game->GetPlayer()->GetMoney()+totalCost);
|
game->GetPlayer()->SetMoney(game->GetPlayer()->GetMoney()+totalCost);
|
||||||
|
|
||||||
|
//If we still have some in our inventory, we'll add them back in.
|
||||||
|
if(Inventory::GetItemCount(itemName)>0){
|
||||||
|
game->SetLoadoutItem(foundLoadoutSlot,itemName);
|
||||||
|
}
|
||||||
|
|
||||||
sellFunctionPrimed=false;
|
sellFunctionPrimed=false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -568,20 +568,6 @@ void Player::Update(float fElapsedTime){
|
|||||||
#pragma region Warrior
|
#pragma region Warrior
|
||||||
switch(GetState()){
|
switch(GetState()){
|
||||||
case State::SWING_SWORD:{
|
case State::SWING_SWORD:{
|
||||||
switch(GetFacingDirection()){
|
|
||||||
case UP:{
|
|
||||||
UpdateAnimation("WARRIOR_SWINGSWORD_N");
|
|
||||||
}break;
|
|
||||||
case DOWN:{
|
|
||||||
UpdateAnimation("WARRIOR_SWINGSWORD_S");
|
|
||||||
}break;
|
|
||||||
case LEFT:{
|
|
||||||
UpdateAnimation("WARRIOR_SWINGSWORD_W");
|
|
||||||
}break;
|
|
||||||
case RIGHT:{
|
|
||||||
UpdateAnimation("WARRIOR_SWINGSWORD_E");
|
|
||||||
}break;
|
|
||||||
}
|
|
||||||
SetSwordSwingTimer(GetSwordSwingTimer()-fElapsedTime);
|
SetSwordSwingTimer(GetSwordSwingTimer()-fElapsedTime);
|
||||||
if(GetSwordSwingTimer()<=0){
|
if(GetSwordSwingTimer()<=0){
|
||||||
SetSwordSwingTimer(0);
|
SetSwordSwingTimer(0);
|
||||||
|
@ -33,4 +33,5 @@ feature to lock accesoires to protect them from selling would be nice
|
|||||||
Gorbit99's viewport PGEX
|
Gorbit99's viewport PGEX
|
||||||
Original Nico Sprite
|
Original Nico Sprite
|
||||||
|
|
||||||
Inventory scroll bar doesn't reset its size
|
Inventory scroll bar doesn't reset its size
|
||||||
|
Address selling of items that are in equipment slots and loadout slots.
|
@ -38,8 +38,8 @@ All rights reserved.
|
|||||||
#pragma once
|
#pragma once
|
||||||
#define VERSION_MAJOR 0
|
#define VERSION_MAJOR 0
|
||||||
#define VERSION_MINOR 4
|
#define VERSION_MINOR 4
|
||||||
#define VERSION_PATCH 1
|
#define VERSION_PATCH 2
|
||||||
#define VERSION_BUILD 7857
|
#define VERSION_BUILD 7870
|
||||||
|
|
||||||
#define stringify(a) stringify_(a)
|
#define stringify(a) stringify_(a)
|
||||||
#define stringify_(a) #a
|
#define stringify_(a) #a
|
||||||
|
@ -80,13 +80,16 @@ bool Warrior::AutoAttack(){
|
|||||||
}
|
}
|
||||||
if(closest!=nullptr){
|
if(closest!=nullptr){
|
||||||
closest->Hurt(int(GetAttack()*"Warrior.Auto Attack.DamageMult"_F),OnUpperLevel(),GetZ());
|
closest->Hurt(int(GetAttack()*"Warrior.Auto Attack.DamageMult"_F),OnUpperLevel(),GetZ());
|
||||||
|
float dirToEnemy=geom2d::line<float>(GetPos(),closest->GetPos()).vector().polar().y;
|
||||||
|
SetAnimationBasedOnTargetingDirection(dirToEnemy);
|
||||||
|
}else{
|
||||||
|
float dirToMouse=geom2d::line<float>(GetPos(),GetWorldAimingLocation()).vector().polar().y;
|
||||||
|
SetAnimationBasedOnTargetingDirection(dirToMouse);
|
||||||
}
|
}
|
||||||
attack_cooldown_timer=ATTACK_COOLDOWN-GetAttackRecoveryRateReduction();
|
attack_cooldown_timer=ATTACK_COOLDOWN-GetAttackRecoveryRateReduction();
|
||||||
swordSwingTimer="Warrior.Auto Attack.SwordSwingTime"_F;
|
swordSwingTimer="Warrior.Auto Attack.SwordSwingTime"_F;
|
||||||
|
|
||||||
float dirToEnemy=geom2d::line<float>(GetPos(),closest->GetPos()).vector().polar().y;
|
|
||||||
SetState(State::SWING_SWORD);
|
SetState(State::SWING_SWORD);
|
||||||
SetAnimationBasedOnTargetingDirection(dirToEnemy);
|
|
||||||
SoundEffect::PlaySFX("Warrior Auto Attack",SoundEffect::CENTERED);
|
SoundEffect::PlaySFX("Warrior Auto Attack",SoundEffect::CENTERED);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user