TrinityCore / TrinityCore

TrinityCore Open Source MMO Framework (master = 11.0.5.57388, 3.3.5 = 3.3.5a.12340, cata classic = 4.4.1.57294)
http://www.trinitycore.org
GNU General Public License v2.0
9.61k stars 6.06k forks source link

[3.3.5][6.x] Core/Instance: instance->GetPlayers(); issue #16932

Closed n4ndo closed 7 years ago

n4ndo commented 8 years ago

Description: instance->GetPlayers(); Current behaviour: When called from "void OnCreatureCreate(Creature* creature)" in Scripts, "players" is allways empty. Expected behaviour:

                    Map::PlayerList const &players = instance->GetPlayers();
                    if (!players.isEmpty())
                        if (Player* player = players.begin()->GetSource())
                            TeamInInstance = player->GetTeam();

"TeamInInstance" should be filled

Any help or suggestions will be grateful

Branch(es): 335/6x 335 TC hash/commit: 7834d33 TDB version: 60 Operating system: Linux

jackpoz commented 8 years ago

isn't that OnCreatureCreate() is called when there are no players yet in the instance ?

n4ndo commented 8 years ago

Hello @jackpoz, so how exactly works this part? https://github.com/TrinityCore/TrinityCore/blob/3.3.5/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp#L187

cuz in that case =>

     if (TeamInInstance == ALLIANCE)

never be true.

Thanks for your time.

Ovahlord commented 8 years ago

It's an additional check in case that void OnPlayerEnter(Player* player) override is not going to work properly for example if you enter the instance by logging in for example.

n4ndo commented 8 years ago

i see, so i dont understand why testing as ally, everytime i have Garrosh instead Varian :/

GM mode should affect?

ghost commented 8 years ago

GM mode (GM ON) invalidates testing because the player character will not have the right faction value.

n4ndo commented 8 years ago

So weird, just re-test.

  1. .instance unbind all
  2. .gm off
  3. join as team alliance

Garrosh appear. :/

I also try do some test like:

http://pastebin.com/543B91LR

Aokromes commented 8 years ago

cannot reproduce:

http://i.imgur.com/Cb1xRE4.jpg

n4ndo commented 8 years ago

Hello, well, after some tests, i change GameType option in worldserver.conf from 1 to 0 and the problem is now solved, but.... any ideas why happen this?

Thank you.

Aokromes commented 8 years ago

Dunno, my gametype is 1.

jackpoz commented 8 years ago

this issue is no longer about instance->GetPlayers() returning an empty container ? did you debug the code to ensure it was actually returning an empty container ?

n4ndo commented 8 years ago

Hello, this happen with:

     GridUnload = 0
ghost commented 8 years ago

Right. GridUnload = 0 is not the default setting, so this could explain why others could not replicate it.

jackpoz commented 8 years ago

Please stop @'ing me or I'll block you. I already get notifications about issues I subscribe to.

ghost commented 7 years ago

@n4ndo : is this issue still valid? If it is no longer showing up with default settings, it should be closed.

n4ndo commented 7 years ago

Hello @tkrokli i still have GridUnload = 1, if you want i can test this again.

ghost commented 7 years ago

Yes. please. If you can test with one of the new commits and confirm that it still is the same with default settings, it would be useful in order to keep the issue up to date so we know it hasn't changed yet.

I presume you know that issues should be confirmed on straight, unmodified TC source with no addons.

Keader commented 7 years ago

Any news @n4ndo ?

Aokromes commented 7 years ago

No answer after near 4 months, closing, if this bug is still valid plz open a new ticket with one updated core.