trickerer / Trinity-Bots

NPCBots for TrinityCore and AzerothCore 3.3.5
https://github.com/trickerer/TrinityCore-3.3.5-with-NPCBots/
446 stars 148 forks source link

[TC] [Feature] Compatibility issues with ElunaTrinityWotlk #791

Closed SilenCC closed 1 month ago

SilenCC commented 1 month ago

DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

Description

When patching ElunaTrinityWotlk, it was found that three hunks of two files were rejected. After comparison, it was found that ElunaTrinityWotlk added the content of Eluna in some parts of these two files, resulting in the rejection of npcbot. This is not an issue with NPCBOT, as NPCBOT is a patch for Trinity 335. But it does not compile after the patch. As a beginner, the installation guidelines for Eluna are not very user-friendly, and Eluna automatically merges and updates quickly, which resulted in me using ElunaTrinityWotlk directly for npcbot patching for a long time. After the failure a few days ago, I thought I had made a mistake elsewhere. Until just now, I looked at the rej file and compared it with the patch file. I found that it was within my own ability to make adjustments, so I made the adjustments and compiled successfully.

The two files are: Src/server/name/Spells/Spell.cpp Src/server/worldserver/worldserver.com. dist

Rej Information: Patching file src/server/name/Spells/Spell.cpp Hunk # 1 FAILED at 64 1 out of 32 hunks Failed -- saving returns to file src/server/name/Spells/Spell.cpp.rej

Patching file src/server/worldserver/worldserver.com. dist Hunk # 1 FAILED at 3933 Hunk # 2 FAILED at 3959 2 out of 3 hunks Failed -- saving returns to file src/server/worldserver/worldserver.com. dist.rej

The adjusted position (not directly adjusting the patch file, but adjusting the corresponding positions of spell.cpp and worldserver.com. dist). 01 02 03

TrinityCore or AzerothCore

TrinityCore

Core rev. hash/commit

TrinityCore rev. 8264c1c6b436+ 2024-05-06 01:05:27 +0000 (master branch)

Operating system

Win10

trickerer commented 1 month ago

What patch command arguments do you use? Try using --fuzz 3 (-F 3)

ShamanDart commented 1 month ago

In fact, if there appears to be incompatibility or interference

In my case i install the patch with fuzz 3 or manually for errors without fuzz. I played for a while to find out if there were more errors, but I have only found that the server crashes when wandering BG bot It is active. I use the BG find, and after a few seconds the crash occurs.

I only have this: The server log shows no signs of error, I checked it several times.

unknownworldserver.exe[7-5_5-1-54].txt

trickerer commented 1 month ago

That was step one. Step two is to fix any code level compatibility issues including compilation errors and crashes. If you want me to help you with the latter provide Debug crashlogs (not RelWithDebInfo).

ShamanDart commented 1 month ago

Here we go, i think I have something new. (Sorry, I'm also a newbie)

I compile the server in Debug (I have it in Release) and I try from the Visual Studio, so that's what i found.

I hope it works~~

unknownworldserver.exe[8-5_3-20-11].txt unknownworldserver.exe[8-5_3-20-11].dmp

Screenshot_21

trickerer commented 1 month ago

Eluna seems to assume any BG is created before any call to CreateBaseMap() for its map's id. Try replacing CreateBaseMap with FindBaseMap at botdatamgr.cpp line 364 and see if it breaks anything.

ShamanDart commented 1 month ago

Well~~ replacing functions gave me another error.

Screenshot_23

But i move the "FindBaseMap" in MapManager.h from "Private:" to "Public:" and it works, only in compilate, playing the game crashes again in BG find. But it gave me another result:

unknownworldserver.exe[8-5_14-17-4].txt unknownworldserver.exe[8-5_14-17-4].dmp

Screenshot_24

But I don't know if this was because of the change I made to "Mapmanager.h". Only i move the function.

trickerer commented 1 month ago

Well, scratch that.

Go to ScriptMgr.cpp line 1434 and add an additional condition:

-       if (map->IsBattleground())
+       if (map->IsBattleground() && map->GetInstanceId())

This should prevent trying to manipulate incomplete BG map. It shouldn't break either as there is another call to this hook in CreateBattleground() which is called when BG is actually created.

ShamanDart commented 1 month ago

Good! Now the BG Find Works, i have fun playing vs bots. But finish the BG crashes the server after despawn wanderer bots.

It seems that "OnDestroy" now is the problem, i try add "if (map->IsBattleground() && map->GetInstanceId())" too, but apparently it does nothing or ignore it.

Okay, now what I've gotten:

unknownworldserver.exe[9-5_6-13-40].dmp unknownworldserver.exe[9-5_6-13-40].txt

Screenshot_26


I have a couple of doubts as well:

1) In one of the BG I left early (before all bots spawn) and I got this:

Screenshot_27

that means something bad?


2) Is it possible to configure wanderer bots so that they do not attack anyone other than the player? It seems a bit rude to me that the bot leaves the area deserted for farming.

And make all wanderers regardless of faction, your enemy? and the possibility of them coming in groups, to form a battle strategy and survival.


3) it is also possible spawn overworld wanderers via trigger/script? like: enter in a zone and spawn them, or loot chest, or accept quest.

More specific examples, enter in Gurubashi Arena, and have bots fighting.

In that case could it be possible to combine those ideas with Eluna?


Again, sorry for the inconvenience, i like this project a lot and I am currently resuming my server project, and these things give me enough enthusiasm to try and add to my server. When I saw this project, I thought that combining it with eluna and its possibilities, I thought it would be very fun.

trickerer commented 1 month ago

At this point of execution BG is destroyed already, before the map. Try this at ScriptMgr.cpp line 1466:

-            Battleground* bg = map->ToBattlegroundMap()->GetBG();
-            e->OnBGDestroy(bg, bg->GetTypeID(), bg->GetInstanceID());
+            if (Battleground* bg = map->ToBattlegroundMap()->GetBG())
+                e->OnBGDestroy(bg, bg->GetTypeID(), bg->GetInstanceID());
trickerer commented 1 month ago
  1. No it isn't something bad. If it was these messages would be not debug messages but errors.

2 and 3: Everything is possible but neither is planned, there is a ton of work I have to finish already. This issue is not about new features but compatibility with a 3rd party project.

ShamanDart commented 1 month ago

It Works! cero Crashes.

Thank you so much for patience.

And, i know, sorry for comment ideas in issues. I know too you have a lot of work.

In that Case i try for myself. Maybe if you like i comment on ideas to take into account to improve this enormous project to improve it in the future, i can?

In pull request i think. with or without Eluna

but anyway, thanks again. If I find anything else related to interference and Eluna, I'll open another thread.

trickerer commented 1 month ago

It Works! cero Crashes.

Thank you so much for patience.

And, i know, sorry for comment ideas in issues. I know too you have a lot of work.

In that Case i try for myself. Maybe if you like i comment on ideas to take into account to improve this enormous project to improve it in the future, i can?

In pull request i think. with or without Eluna

but anyway, thanks again. If I find anything else related to interference and Eluna, I'll open another thread.

Sure. Closing now.