[c++] npc arena rating vendor

Here is a little script i don’t know if it’s will work try and feed back about.

you must set npc vendor flag to your creature.


#include "ScriptPCH.h"


enum arenarating 

{

	arenarating = 0 //Change value

};


class Rating_Vendor : public CreatureScript

{

public:

	Rating_Vendor() : CreatureScript("Rating_Vendor"){}


	bool OnGossipHello(Player* player, Creature* creature)

	{

		{

			player->PrepareQuestMenu(creature->GetGUID());

			player->SendPreparedQuest(creature->GetGUID());

		}

		player->ADD_GOSSIP_ITEM(1, "Arena Rating Vendor", GOSSIP_SENDER_MAIN, 3200);

		player->ADD_GOSSIP_ITEM(0, "nevermind", GOSSIP_SENDER_MAIN, 3199);

		player->PlayerTalkClass->SendGossipMenu(1, creature->GetGUID());

		return true;

	}

	bool OnGossipSelect(Player* player, Creature* creature, uint32 Sender, uint32 Actions)

	{

		player->PlayerTalkClass->ClearMenus();


		if (player->isInCombat())

		{


			player->CLOSE_GOSSIP_MENU();

			creature->MonsterWhisper(IN_COMBAT, player->GetGUID());


			return true;

		}


		if(Sender == GOSSIP_SENDER_MAIN)

		{

			switch(Actions)

			{

				break;


			case 3200:

				if (player->GetArenaPersonalRating(ARENA_TYPE_2v2) >= arenarating)

				{

					player->GetSession()->SendListInventory(creature->GetGUID());

					return true;

				}else{

						//ChatHandler(player).PSendSysMessage("[Vendor System] You need atleast %u rating in personalarenateam to buy this item!",arenarating);

						player->CLOSE_GOSSIP_MENU();

						return false;

					 }

				break;


			case 3199:

				player->CLOSE_GOSSIP_MENU();

				break;

			}

		}

		return true;

	}


};


void AddSC_Rating_Vendor()

    {

	new Rating_Vendor();

    }
if (player->GetArenaPersonalRating(ARENA_TYPE_2v2) >= arenarating && player->GetArenaPersonalRating(ARENA_TYPE_3v3) >= arenarating && player->GetArenaPersonalRating(ARENA_TYPE_5v5) >= arenarating)

This actually means the player has to have a personal arena rating >= arenarating in ALL brackets at the same tme. I’m not sure thats what you intend to do.

[CODE] }else{

    if (player->GetArenaPersonalRating(ARENA_TYPE_2v2) < arenarating && player->GetArenaPersonalRating(ARENA_TYPE_3v3) < arenarating && player->GetArenaPersonalRating(ARENA_TYPE_5v5) < arenarating)[/CODE]

This part is pretty much redundant. The else reflects the negation of the condition that came directly before it, so you need not check again with negation.

Updated