diff --git a/.gitignore b/.gitignore index e8ed5d28..4ddbe5ab 100644 --- a/.gitignore +++ b/.gitignore @@ -399,3 +399,4 @@ test.cpp /Adventures in Lestoria/packkey.cpp /x64/Release/Adventures in Lestoria.zip /x64/Release/Adventures in Lestoria_web.zip +/x64/Release/AdventuresInLestoria_web.zip diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index cefac87c..4b6c74ca 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.cpp +++ b/Adventures in Lestoria/AdventuresInLestoria.cpp @@ -3228,7 +3228,7 @@ const std::weak_ptrAiL::GetLoadoutItem(int slot){ void AiL::RestockLoadoutItems(){ for(int i=0;iActualName); + SetLoadoutItem(i,GetLoadoutItem(i).lock()->ActualName()); } } } diff --git a/Adventures in Lestoria/Item.cpp b/Adventures in Lestoria/Item.cpp index 80cf9dba..c331d90a 100644 --- a/Adventures in Lestoria/Item.cpp +++ b/Adventures in Lestoria/Item.cpp @@ -843,6 +843,7 @@ void Inventory::UnequipItem(EquipSlot slot){ game->GetPlayer()->RecalculateEquipStats(); }; EquipSlot Inventory::GetSlotEquippedIn(const std::weak_ptrit){ + if(it.expired()||!it.lock()->IsEquippable())return EquipSlot::NONE; for(int i=int(EquipSlot::HELMET);i<=int(EquipSlot::RING2);i<<=1){ EquipSlot slot=EquipSlot(i); std::weak_ptrequip=GetEquip(slot); diff --git a/Adventures in Lestoria/Merchant.cpp b/Adventures in Lestoria/Merchant.cpp index 9b81b52e..8988e4a9 100644 --- a/Adventures in Lestoria/Merchant.cpp +++ b/Adventures in Lestoria/Merchant.cpp @@ -205,9 +205,30 @@ void Merchant::SellItem(std::weak_ptritem,uint32_t 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;iGetLoadoutSize();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); 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; }; diff --git a/Adventures in Lestoria/Player.cpp b/Adventures in Lestoria/Player.cpp index b8df54d2..c7744e51 100644 --- a/Adventures in Lestoria/Player.cpp +++ b/Adventures in Lestoria/Player.cpp @@ -568,20 +568,6 @@ void Player::Update(float fElapsedTime){ #pragma region Warrior switch(GetState()){ 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); if(GetSwordSwingTimer()<=0){ SetSwordSwingTimer(0); diff --git a/Adventures in Lestoria/TODO.txt b/Adventures in Lestoria/TODO.txt index 14551783..9fbfa697 100644 --- a/Adventures in Lestoria/TODO.txt +++ b/Adventures in Lestoria/TODO.txt @@ -33,4 +33,5 @@ feature to lock accesoires to protect them from selling would be nice Gorbit99's viewport PGEX Original Nico Sprite -Inventory scroll bar doesn't reset its size \ No newline at end of file +Inventory scroll bar doesn't reset its size +Address selling of items that are in equipment slots and loadout slots. \ No newline at end of file diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 8fd422d0..befd7c58 100644 --- a/Adventures in Lestoria/Version.h +++ b/Adventures in Lestoria/Version.h @@ -38,8 +38,8 @@ All rights reserved. #pragma once #define VERSION_MAJOR 0 #define VERSION_MINOR 4 -#define VERSION_PATCH 1 -#define VERSION_BUILD 7857 +#define VERSION_PATCH 2 +#define VERSION_BUILD 7870 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/Warrior.cpp b/Adventures in Lestoria/Warrior.cpp index 97ab9254..2564e95f 100644 --- a/Adventures in Lestoria/Warrior.cpp +++ b/Adventures in Lestoria/Warrior.cpp @@ -80,13 +80,16 @@ bool Warrior::AutoAttack(){ } if(closest!=nullptr){ closest->Hurt(int(GetAttack()*"Warrior.Auto Attack.DamageMult"_F),OnUpperLevel(),GetZ()); + float dirToEnemy=geom2d::line(GetPos(),closest->GetPos()).vector().polar().y; + SetAnimationBasedOnTargetingDirection(dirToEnemy); + }else{ + float dirToMouse=geom2d::line(GetPos(),GetWorldAimingLocation()).vector().polar().y; + SetAnimationBasedOnTargetingDirection(dirToMouse); } attack_cooldown_timer=ATTACK_COOLDOWN-GetAttackRecoveryRateReduction(); swordSwingTimer="Warrior.Auto Attack.SwordSwingTime"_F; - float dirToEnemy=geom2d::line(GetPos(),closest->GetPos()).vector().polar().y; SetState(State::SWING_SWORD); - SetAnimationBasedOnTargetingDirection(dirToEnemy); SoundEffect::PlaySFX("Warrior Auto Attack",SoundEffect::CENTERED); } return true; diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index e4743997..81db2a51 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ