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

pull/35/head
sigonasr2 9 months ago
parent 84e713b9a2
commit 613e2be21f
  1. 1
      .gitignore
  2. 2
      Adventures in Lestoria/AdventuresInLestoria.cpp
  3. 1
      Adventures in Lestoria/Item.cpp
  4. 21
      Adventures in Lestoria/Merchant.cpp
  5. 14
      Adventures in Lestoria/Player.cpp
  6. 1
      Adventures in Lestoria/TODO.txt
  7. 4
      Adventures in Lestoria/Version.h
  8. 7
      Adventures in Lestoria/Warrior.cpp
  9. BIN
      x64/Release/Adventures in Lestoria.exe

1
.gitignore vendored

@ -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

@ -3228,7 +3228,7 @@ const std::weak_ptr<Item>AiL::GetLoadoutItem(int slot){
void AiL::RestockLoadoutItems(){
for(int i=0;i<GetLoadoutSize();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();
};
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){
EquipSlot slot=EquipSlot(i);
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;
//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);
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;
};

@ -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);

@ -34,3 +34,4 @@ Gorbit99's viewport PGEX
Original Nico Sprite
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
#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

@ -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<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();
swordSwingTimer="Warrior.Auto Attack.SwordSwingTime"_F;
float dirToEnemy=geom2d::line<float>(GetPos(),closest->GetPos()).vector().polar().y;
SetState(State::SWING_SWORD);
SetAnimationBasedOnTargetingDirection(dirToEnemy);
SoundEffect::PlaySFX("Warrior Auto Attack",SoundEffect::CENTERED);
}
return true;

Loading…
Cancel
Save