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

Levelup City Implementation #2281

Merged
merged 6 commits into from
Aug 12, 2023

Conversation

Phong940253
Copy link
Contributor

@Phong940253 Phong940253 commented Jul 30, 2023

Description

See #2267.
Levelup City Implementation.
requires placing the StatuePromoteExcel.json file in /resources/ExcelBinOutput

Issues fixed by this PR

Fix level Statue of the Seven always shows 1.

Type of changes

  • Bug fix
  • New feature
  • Enhancement
  • Documentation

Checklist:

  • My code follows the style guidelines of this project
  • My pull request is unique and no other pull requests have been opened for these changes
  • I have read the Contributing note and Code of conduct
  • I am responsible for any copyright issues with my code if it occurs in the future.

@akbaryahya
Copy link

hmm have you tried this on the old account? (after Implementation) because it doesn't seem to be able to handle the null getProperty n setProperty, maybe it should have been if their old account should have been set with a defultf value.

get data

00:59:30 <ERROR:GameServerPacketHandler> Error handle
java.lang.NullPointerException: Cannot invoke "java.lang.Integer.intValue()" because the return value of "java.util.Map.get(Object)" is null
        at emu.grasscutter.game.player.Player.getProperty(Player.java:815)
        at emu.grasscutter.game.managers.SotSManager.getCurrentLevel(SotSManager.java:257)
        at emu.grasscutter.server.packet.send.PacketGetSceneAreaRsp.<init>(PacketGetSceneAreaRsp.java:27)
        at emu.grasscutter.server.packet.recv.HandlerGetSceneAreaReq.handle(HandlerGetSceneAreaReq.java:17)
        at emu.grasscutter.server.game.GameServerPacketHandler.handle(GameServerPacketHandler.java:87)
        at emu.grasscutter.server.game.GameSession.handleReceive(GameSession.java:190)
        at emu.grasscutter.server.game.GameSessionManager$1.lambda$handleReceive$0(GameSessionManager.java:79)
        at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174)
        at io.netty.channel.DefaultEventLoop.run(DefaultEventLoop.java:54)
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.base/java.lang.Thread.run(Thread.java:833)

set data

03:26:46 <ERROR:GameServerPacketHandler> Error handle
java.lang.NullPointerException: Cannot invoke "java.lang.Integer.intValue()" because the return value of "java.util.Map.get(Object)" is null
        at emu.grasscutter.game.player.Player.setPropertyWithSanityCheck(Player.java:1651)
        at emu.grasscutter.game.player.Player.setProperty(Player.java:807)
        at emu.grasscutter.game.managers.SotSManager.setCurrentCrystal(SotSManager.java:240)
        at emu.grasscutter.game.managers.SotSManager.levelUpSotS(SotSManager.java:312)
        at emu.grasscutter.server.packet.recv.HandlerLevelupCityReq.handle(HandlerLevelupCityReq.java:19)
        at emu.grasscutter.server.game.GameServerPacketHandler.handle(GameServerPacketHandler.java:87)
        at emu.grasscutter.server.game.GameSession.handleReceive(GameSession.java:190)
        at emu.grasscutter.server.game.GameSessionManager$1.lambda$handleReceive$0(GameSessionManager.java:79)
        at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174)
        at io.netty.channel.DefaultEventLoop.run(DefaultEventLoop.java:54)
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.base/java.lang.Thread.run(Thread.java:833)

@NotThorny
Copy link
Member

Shouldn't this be using CityLevelupConfigData.json? Looking at your new excel it appears you've at least looked over the original, I believe it would make more sense to use existing resources instead of creating something new that won't exist in future dumps, and also keeps it backwards compatible with all earlier versions and resources.

One other thing is that while this is adding the stamina, it's not adding the correct value of stamina. The player property MAX_STAMINA starts at 10000 (100 stamina) with max 24000 (240 stamina). You're adding the in-game stamina value of 8, which gives the user no actual new stamina. You need to add 800 to MAX_STAMINA property (8 stamina) to match values with the in-game stamina shown.

Then last is old accounts will null pointer with the manager, probably need a check for that.
Other than those appears to be working properly.

@Phong940253
Copy link
Contributor Author

hmm have you tried this on the old account? (after Implementation) because it doesn't seem to be able to handle the null getProperty n setProperty, maybe it should have been if their old account should have been set with a defultf value.

get data

00:59:30 <ERROR:GameServerPacketHandler> Error handle
java.lang.NullPointerException: Cannot invoke "java.lang.Integer.intValue()" because the return value of "java.util.Map.get(Object)" is null
        at emu.grasscutter.game.player.Player.getProperty(Player.java:815)
        at emu.grasscutter.game.managers.SotSManager.getCurrentLevel(SotSManager.java:257)
        at emu.grasscutter.server.packet.send.PacketGetSceneAreaRsp.<init>(PacketGetSceneAreaRsp.java:27)
        at emu.grasscutter.server.packet.recv.HandlerGetSceneAreaReq.handle(HandlerGetSceneAreaReq.java:17)
        at emu.grasscutter.server.game.GameServerPacketHandler.handle(GameServerPacketHandler.java:87)
        at emu.grasscutter.server.game.GameSession.handleReceive(GameSession.java:190)
        at emu.grasscutter.server.game.GameSessionManager$1.lambda$handleReceive$0(GameSessionManager.java:79)
        at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174)
        at io.netty.channel.DefaultEventLoop.run(DefaultEventLoop.java:54)
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.base/java.lang.Thread.run(Thread.java:833)

set data

03:26:46 <ERROR:GameServerPacketHandler> Error handle
java.lang.NullPointerException: Cannot invoke "java.lang.Integer.intValue()" because the return value of "java.util.Map.get(Object)" is null
        at emu.grasscutter.game.player.Player.setPropertyWithSanityCheck(Player.java:1651)
        at emu.grasscutter.game.player.Player.setProperty(Player.java:807)
        at emu.grasscutter.game.managers.SotSManager.setCurrentCrystal(SotSManager.java:240)
        at emu.grasscutter.game.managers.SotSManager.levelUpSotS(SotSManager.java:312)
        at emu.grasscutter.server.packet.recv.HandlerLevelupCityReq.handle(HandlerLevelupCityReq.java:19)
        at emu.grasscutter.server.game.GameServerPacketHandler.handle(GameServerPacketHandler.java:87)
        at emu.grasscutter.server.game.GameSession.handleReceive(GameSession.java:190)
        at emu.grasscutter.server.game.GameSessionManager$1.lambda$handleReceive$0(GameSessionManager.java:79)
        at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174)
        at io.netty.channel.DefaultEventLoop.run(DefaultEventLoop.java:54)
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.base/java.lang.Thread.run(Thread.java:833)

Oh, this happened on the old account so I'll fix it soon

@akbaryahya
Copy link

hmm have you tried this on the old account? (after Implementation) because it doesn't seem to be able to handle the null getProperty n setProperty, maybe it should have been if their old account should have been set with a defultf value.
get data

00:59:30 <ERROR:GameServerPacketHandler> Error handle
java.lang.NullPointerException: Cannot invoke "java.lang.Integer.intValue()" because the return value of "java.util.Map.get(Object)" is null
        at emu.grasscutter.game.player.Player.getProperty(Player.java:815)
        at emu.grasscutter.game.managers.SotSManager.getCurrentLevel(SotSManager.java:257)
        at emu.grasscutter.server.packet.send.PacketGetSceneAreaRsp.<init>(PacketGetSceneAreaRsp.java:27)
        at emu.grasscutter.server.packet.recv.HandlerGetSceneAreaReq.handle(HandlerGetSceneAreaReq.java:17)
        at emu.grasscutter.server.game.GameServerPacketHandler.handle(GameServerPacketHandler.java:87)
        at emu.grasscutter.server.game.GameSession.handleReceive(GameSession.java:190)
        at emu.grasscutter.server.game.GameSessionManager$1.lambda$handleReceive$0(GameSessionManager.java:79)
        at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174)
        at io.netty.channel.DefaultEventLoop.run(DefaultEventLoop.java:54)
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.base/java.lang.Thread.run(Thread.java:833)

set data

03:26:46 <ERROR:GameServerPacketHandler> Error handle
java.lang.NullPointerException: Cannot invoke "java.lang.Integer.intValue()" because the return value of "java.util.Map.get(Object)" is null
        at emu.grasscutter.game.player.Player.setPropertyWithSanityCheck(Player.java:1651)
        at emu.grasscutter.game.player.Player.setProperty(Player.java:807)
        at emu.grasscutter.game.managers.SotSManager.setCurrentCrystal(SotSManager.java:240)
        at emu.grasscutter.game.managers.SotSManager.levelUpSotS(SotSManager.java:312)
        at emu.grasscutter.server.packet.recv.HandlerLevelupCityReq.handle(HandlerLevelupCityReq.java:19)
        at emu.grasscutter.server.game.GameServerPacketHandler.handle(GameServerPacketHandler.java:87)
        at emu.grasscutter.server.game.GameSession.handleReceive(GameSession.java:190)
        at emu.grasscutter.server.game.GameSessionManager$1.lambda$handleReceive$0(GameSessionManager.java:79)
        at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174)
        at io.netty.channel.DefaultEventLoop.run(DefaultEventLoop.java:54)
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.base/java.lang.Thread.run(Thread.java:833)

Oh, this happened on the old account so I'll fix it soon

btw in levelUpSotS maybe you should also add player.getQuestManager().queueEvent(QuestContent.QUEST_CONTENT_CITY_LEVEL_UP, cityId, areaId); (idk this is true or areaId should be level) to trigger quest finish (46901-46902) (Offer the Anemoculus to the Statue /ll)

@Phong940253
Copy link
Contributor Author

Shouldn't this be using CityLevelupConfigData.json? Looking at your new excel it appears you've at least looked over the original, I believe it would make more sense to use existing resources instead of creating something new that won't exist in future dumps, and also keeps it backwards compatible with all earlier versions and resources.

One other thing is that while this is adding the stamina, it's not adding the correct value of stamina. The player property MAX_STAMINA starts at 10000 (100 stamina) with max 24000 (240 stamina). You're adding the in-game stamina value of 8, which gives the user no actual new stamina. You need to add 800 to MAX_STAMINA property (8 stamina) to match values with the in-game stamina shown.

Then last is old accounts will null pointer with the manager, probably need a check for that. Other than those appears to be working properly.

Shouldn't this be using CityLevelupConfigData.json? Looking at your new excel it appears you've at least looked over the original, I believe it would make more sense to use existing resources instead of creating something new that won't exist in future dumps, and also keeps it backwards compatible with all earlier versions and resources.

One other thing is that while this is adding the stamina, it's not adding the correct value of stamina. The player property MAX_STAMINA starts at 10000 (100 stamina) with max 24000 (240 stamina). You're adding the in-game stamina value of 8, which gives the user no actual new stamina. You need to add 800 to MAX_STAMINA property (8 stamina) to match values with the in-game stamina shown.

Then last is old accounts will null pointer with the manager, probably need a check for that. Other than those appears to be working properly.

I've looked in resources but can't find data related to the costItems of each city upgrade level. So I simulated WeaponPromoteExcelConfigData.json . With costItems based on the original game and reward information taken from RewardExcelConfigData.json. If you have any other way to save, please suggest me.

About MAX_STAMINA, I thought the stamina base was 100, and 10000 was due to the unlimited stamina hack so I didn't pay attention to this problem. haha. I will fix it soon.

@NotThorny
Copy link
Member

In CityLevelupConfigData.json, consumeItem is the item taken ("costItem" equivalent), and it includes amount. Example here for level 2 (as first level is given by default) where the item being consumed has id included and 1 is needed.

"level": 2,
"consumeItem": {
            "itemId": 107001,
            "itemNum": 1
        },

@KingRainbow44 KingRainbow44 linked an issue Jul 31, 2023 that may be closed by this pull request
@KingRainbow44 KingRainbow44 merged commit bdc4b5a into Grasscutters:development Aug 12, 2023
2 checks passed
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.

[Bug] i can'nt offer the Anemoculus to the statue
5 participants