• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

[SOLVED] ongossipselect

Status
Not open for further replies.

yvoms

Exalted Member
I have applied rochet2's item and player gossip,
However the below script does not seem to be functionizing, i've been told to debug it however i have no clue on how to do so.
Could anyone please assist me with this, and tell me what i've done wrong?

Code:
#include "ScriptPCH.h"

class Teleportert : public ItemScript
{
public:
	Teleportert() : ItemScript("Teleportert") { }

	bool OnUse(Player* player, Item* item, SpellCastTargets const& targets) override
	{
		if (player->IsInCombat())
		{
			player->GetSession()->SendNotification("You are in combat!");
			player->CLOSE_GOSSIP_MENU();
			return false; //laat de onderstaande menu's niet zien.
		}
		player->PlayerTalkClass->ClearMenus();
		player->GetSession()->SendNotification("DEBUG: Teleporter active!");
		player->ADD_GOSSIP_ITEM(0, "|cff4169E1|TInterface\\icons\\INV_Misc_Bag_FelclothBag:30|t The Mall|r", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
		player->ADD_GOSSIP_ITEM(0, "|cff4169E1|TInterface\\icons\\Achievement_Leader_King_Varian_Wrynn:30|t Alliance Capital Cities|r", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
		player->ADD_GOSSIP_ITEM(0, "|cffFF0000|TInterface\\icons\\Achievement_Leader_Sylvanas:30|t Horde Capital Cities|r", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3);
		player->ADD_GOSSIP_ITEM(0, "|cffFFFF00|TInterface\\icons\\Temp:30|t Neutral Capital Cities|r", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4);
		player->ADD_GOSSIP_ITEM(0, "|cff4169E1|TInterface\\icons\\ACHIEVEMENT_BOSS_KINGYMIRON_01:30|t Dungeons|r", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5);
		player->ADD_GOSSIP_ITEM(0, "|cff4169E1|TInterface\\icons\\Achievement_Dungeon_Icecrown_Frostmourne:30|t Raids|r", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6);
		player->ADD_GOSSIP_ITEM(0, "|cffFF0000|TInterface\\icons\\Achievement_FeatsOfStrength_Gladiator_10:30|t PvP Areas|r", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7);
		player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, item->GetGUID());
		return true; //laat de onderstaande acties/menu's werken/zien.
	}

	void OnGossipSelect(Player* player, Item* item, uint32 sender, uint32 action) override
	{
		player->PlayerTalkClass->ClearMenus();
		player->GetSession()->SendNotification("DEBUG: ONGOSSIPSELECT");
		switch (action)
		{
		case GOSSIP_ACTION_INFO_DEF + 1:
			player->GetSession()->SendNotification("TEST 1 COMPLETED");
			player->CLOSE_GOSSIP_MENU();
			break;
		case GOSSIP_ACTION_INFO_DEF + 2:
			player->GetSession()->SendNotification("TEST 2 COMPLETED");
			player->CLOSE_GOSSIP_MENU();
			break;
		case GOSSIP_ACTION_INFO_DEF + 3:
			player->GetSession()->SendNotification("TEST 3 COMPLETED");
			player->CLOSE_GOSSIP_MENU();
			break;
		case GOSSIP_ACTION_INFO_DEF + 4:
			player->GetSession()->SendNotification("TEST 4 COMPLETED");
			player->CLOSE_GOSSIP_MENU();
			break;
		case GOSSIP_ACTION_INFO_DEF + 5:
			player->GetSession()->SendNotification("TEST 5 COMPLETED");
			player->CLOSE_GOSSIP_MENU();
			break;
		case GOSSIP_ACTION_INFO_DEF + 6:
			player->GetSession()->SendNotification("TEST 6 COMPLETED");
			player->CLOSE_GOSSIP_MENU();
			break;
		case GOSSIP_ACTION_INFO_DEF + 7:
			player->GetSession()->SendNotification("TEST 7 COMPLETED");
			player->CLOSE_GOSSIP_MENU();
			break;
		}
		player->CLOSE_GOSSIP_MENU();
	}
};

void AddSC_Teleportert()
{
	new Teleportert();
}
when i am ingame it does show me the
player->GetSession()->SendNotification("DEBUG: Teleporter active!");
when i right click the hearthstone(im using the default hearthstone yes)
But it does not show the
player->GetSession()->SendNotification("DEBUG: ONGOSSIPSELECT");

I've tried multiple different ways of doing it, however it shows the main menu, but ongossipselect does not seem to execute.
 

slp13at420

Mad Scientist
I did notice each case wasn't contained inside bracket's `{}`

Code:
		case GOSSIP_ACTION_INFO_DEF + 1:
            [COLOR="#A9A9A9"]{[/COLOR]
                player->GetSession()->SendNotification("TEST 1 COMPLETED");
                player->CLOSE_GOSSIP_MENU();
                break;
	    [COLOR="#A9A9A9"]}[/COLOR]

but im new to the core C++ soooooo lol

this case doesn't use brackets since its only 1 line:
Code:
 line 177 Player.cpp
       case RACE_HUMAN:    SetTaximaskNode(2);  break;     // Human
but since there is more than 1 case or `line` inside this switch(race) they are contained inside `{}`.

lol I think
 
Last edited:

Tommy

Founder
A Void does not require openings closings or returns, it does it itself ^^

Well that's just confusing. You mean a "case", not "void". However, in most cases that is untrue. When you initialize a variable in a case it is required to have open and close brackets for the case.

I believe the script is irrelevant right now since you need to supply us with your core changes so we can see if you did them correctly or not.

Future advice:

If all of your cases have "player->CLOSE_GOSSIP_MENU();" in them, just add "player->CLOSE_GOSSIP_MENU();" below the switch statement. You already have it like that -- remove the "player->CLOSE_GOSSIP_MENU();" in the cases.
 

yvoms

Exalted Member
Well that's just confusing. You mean a "case", not "void". However, in most cases that is untrue. When you initialize a variable in a case it is required to have open and close brackets for the case.

I believe the script is irrelevant right now since you need to supply us with your core changes so we can see if you did them correctly or not.

Future advice:

If all of your cases have "player->CLOSE_GOSSIP_MENU();" in them, just add "player->CLOSE_GOSSIP_MENU();" below the switch statement. You already have it like that -- remove the "player->CLOSE_GOSSIP_MENU();" in the cases.

i will do that, thanks for the suggestion, I tought it was a void that made it like that, not the cases, sorry for giving the wrong information :p
 

yvoms

Exalted Member
[MENTION=1]Tommy[/MENTION], its the basic trinitycore on the latest revision, with rochet2's item gossip and transmog added, nothing else :3
 
Last edited:

Tommy

Founder
[MENTION=1]Tommy[/MENTION], its the basic trinitycore on the latest revision, with rochet2's item gossip and transmog added, nothing else :3
https://bitbucket.org/yvoms/phoenix

Well, I asked for the diffs when merging all of this because something could've gone wrong, but I guess the repo link will do. As far as I saw, everything is fine via your source unless I missed something. Though, since you have Eluna, why are you not using it?
 

Rochet2

Moderator / Eluna Dev
Since you have eluna and the player item gossip patch, they could not have merged without problems.
The way you solved the conflicts between them makes all item gossip be handled by eluna and nothing gets to the C++ scripts.
Need to fix the code in mischandler.
 

yvoms

Exalted Member
Solved, Seems eluna engine and item gossip weren't working together removed eluna, and it seems to work now.
 
Status
Not open for further replies.
Top