Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add : Sum upgrade system #1476

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Add : Sum upgrade system #1476

wants to merge 4 commits into from

Conversation

Bari77
Copy link
Collaborator

@Bari77 Bari77 commented Jul 2, 2021

No description provided.

@codecov
Copy link

codecov bot commented Jul 2, 2021

Codecov Report

Merging #1476 (ac677b7) into master (8cdaed2) will increase coverage by 0.58%.
The diff coverage is 87.17%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1476      +/-   ##
==========================================
+ Coverage   35.43%   36.01%   +0.58%     
==========================================
  Files         240      244       +4     
  Lines        7372     7449      +77     
  Branches      561      568       +7     
==========================================
+ Hits         2612     2683      +71     
- Misses       4646     4652       +6     
  Partials      114      114              
Impacted Files Coverage Δ
...vices/NRunService/Handlers/ProbabilityUIHandler.cs 0.00% <0.00%> (ø)
....PacketHandlers/Command/CreateItemPacketHandler.cs 0.00% <ø> (ø)
...ject/Services/InventoryService/InventoryService.cs 65.68% <100.00%> (+2.89%) ⬆️
...ces/ItemGenerationService/ItemGenerationService.cs 76.78% <100.00%> (+6.67%) ⬆️
...radeService/SumUpgradeService/SumUpgradeService.cs 100.00% <100.00%> (ø)
...meObject/Services/UpgradeService/UpgradeService.cs 100.00% <100.00%> (ø)
...re.PacketHandlers/Upgrades/UpgradePacketHandler.cs 100.00% <100.00%> (ø)
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8cdaed2...ac677b7. Read the comment docs.

InventoryItemInstance? RemoveItemAmountFromInventory(short amount, Guid id);

List<InventoryItemInstance?> RemoveItemAmountFromInventory(short amount, short vnum);
Copy link
Member

Choose a reason for hiding this comment

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

You don’t need that if you have the load by vnum and amount

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
//
Copy link
Member

Choose a reason for hiding this comment

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

All those comment change make it harder to review

@@ -84,6 +84,25 @@ private byte GetMaxSlot(NoscorePocketType pocket)
return retItem;
}

public List<InventoryItemInstance?> LoadByVNumAndAmount(short vnum, short amount)
Copy link
Member

Choose a reason for hiding this comment

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

Wonder if we need the amount getting all the item for a vnum is perfectly fine

amount -= item.ItemInstance!.Amount;
if (amount <= 0)
{
break;
Copy link
Member

Choose a reason for hiding this comment

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

Return instead of break

@@ -486,6 +507,23 @@ public bool EnoughPlace(List<IItemInstance> itemInstances, NoscorePocketType typ
return null;
}

public List<InventoryItemInstance?> RemoveItemAmountFromInventory(short amount, short vnum)
{
var result = new List<InventoryItemInstance?>();
Copy link
Member

Choose a reason for hiding this comment

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

This whole thing is useless

@@ -155,13 +156,15 @@ public override async Task ExecuteAsync(CreateItemPacket createItemPacket, Clien
case EquipmentType.SecondaryWeapon:
wearable.SetRarityPoint();
break;

Copy link
Member

Choose a reason for hiding this comment

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

Seems like all those thing would be better in the item creation service not sure why I put it here. Can be moved to replace the other thing using polymorphism over switch will be better

var targetSlot = session.Character.InventoryService.LoadBySlotAndType((byte)upgradePacket.Slot2, (NoscorePocketType)upgradePacket.InventoryType);

await session.SendPacketsAsync(await _sumUpgradeService.SumItemInstanceAsync(session, sourceSlot, targetSlot));
break;
Copy link
Member

Choose a reason for hiding this comment

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

You want to log default

@@ -219,7 +220,62 @@ public void MoveHalfSlotAndMergeThemWithOverflow()
Assert.IsTrue((destinationItem?.ItemInstance?.Amount == 999) && (destinationItem.Slot == 1));
}

//TODO RemoveItemAmountFromInventory
[TestMethod]
public void RemoveItemAmountFromInventoryByGuidWithoutRemove()
Copy link
Member

Choose a reason for hiding this comment

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

Naming could be bettrr

@@ -219,7 +220,62 @@ public void MoveHalfSlotAndMergeThemWithOverflow()
Assert.IsTrue((destinationItem?.ItemInstance?.Amount == 999) && (destinationItem.Slot == 1));
}

//TODO RemoveItemAmountFromInventory
Copy link
Member

Choose a reason for hiding this comment

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

You remove todo but it was here for the other one not for yours 😂 still need to be tested. Moreover yours will disapear for the load one

}

[TestMethod]
public async Task Test_UpgradePacketSum1Async()
Copy link
Member

Choose a reason for hiding this comment

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

Need to test glove with boots, sum > 6, sum of different resistance

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