Add player money functions. Implement Merchant transaction functions. Add Function Priming classes.

This commit is contained in:
2023-12-17 23:37:37 -06:00
parent 2b3c1ea1b4
commit f1aa872717
19 changed files with 350 additions and 93 deletions
+7 -1
View File
@@ -202,6 +202,10 @@ bool Crawler::OnUserCreate(){
utils::datafile::INITIAL_SETUP_COMPLETE=true;
ValidateGameStatus(); //Checks to make sure everything has been initialized properly.
Merchant::RandomizeTravelingMerchant();
Merchant&myMerchant=Merchant::GetCurrentTravelingMerchant();
const std::vector<Item>&itemsAvailable=myMerchant.GetShopItems();
return true;
}
@@ -1725,6 +1729,7 @@ void Crawler::ChangePlayerClass(Class cl){
Ability itemAbility1=player->useItem1;
Ability itemAbility2=player->useItem2;
Ability itemAbility3=player->useItem3;
uint32_t oldMoney=player->money;
switch(cl){
case WARRIOR:{
player.reset(NEW Warrior(player.get()));
@@ -1750,6 +1755,7 @@ void Crawler::ChangePlayerClass(Class cl){
player->SetBaseStat(ItemAttribute::attack,DATA.GetProperty(player->GetClassName()+".BaseAtk").GetInt());
player->hpGrowthRate=float(DATA.GetProperty(player->GetClassName()+".HealthGrowthRate").GetReal());
player->atkGrowthRate=float(DATA.GetProperty(player->GetClassName()+".AtkGrowthRate").GetReal());
player->money=oldMoney;
sig::Animation::SetupPlayerAnimations();
GetPlayer()->UpdateIdleAnimation(DOWN);
GetPlayer()->SetItem1UseFunc(itemAbility1);
@@ -2239,7 +2245,7 @@ void Crawler::SetLoadoutItem(int slot,std::string itemName){
bool Crawler::UseLoadoutItem(int slot){
if(slot<0||slot>loadout.size()-1)ERR("Invalid inventory slot "+std::to_string(slot)+", please choose a slot in range (0-"+std::to_string(loadout.size()-1)+").");
if(GetLoadoutItem(slot).Amt()>0){
Inventory::UseItem(loadout[slot].Name());
Inventory::UseItem(loadout[slot].ActualName());
GetLoadoutItem(slot).OnUseAction();
GetLoadoutItem(slot).amt--;
return true;