Exemplo n.º 1
0
bool GossipSelect_guildmaster(Player *player, Creature *_creature, uint32 sender, uint32 action)
{
	if (sender != GOSSIP_SENDER_MAIN)
		return false;

	switch (action)
	{
		case ACTION_TELE:
			//teleport player to GH
			player->CLOSE_GOSSIP_MENU();
			teleportPlayerToGuildHouse(player, _creature);
			break;
		case ACTION_SHOW_BUYLIST:
			//show list of GHs which currently not occupied
			showBuyList(player, _creature);
			break;
		default:
			if (action > OFFSET_SHOWBUY_FROM)
			{
				showBuyList(player, _creature, action - OFFSET_SHOWBUY_FROM);
			} else if (action > OFFSET_GH_ID_TO_ACTION)
			{
				//player clicked on buy list
				player->CLOSE_GOSSIP_MENU();
				//get guildhouseId from action
				//guildhouseId = action - OFFSET_GH_ID_TO_ACTION
				buyGuildhouse(player, _creature, action - OFFSET_GH_ID_TO_ACTION);
			}
			break;
	}
	
	return true;
}
    bool OnGossipSelect(Player *player, Creature *_creature, uint32 sender, uint32 action)
    {
        player->PlayerTalkClass->ClearMenus();
        if (sender != GOSSIP_SENDER_MAIN)
            return false;

        switch (action)
        {
            case ACTION_TELE:
                player->CLOSE_GOSSIP_MENU();
                teleportPlayerToGuildHouse(player, _creature);
                break;
            case ACTION_SHOW_BUYLIST:
                showBuyList(player, _creature);
                break;
            default:
                if (action > OFFSET_SHOWBUY_FROM)
                {
                    showBuyList(player, _creature, action - OFFSET_SHOWBUY_FROM);
                }
                else if (action > OFFSET_GH_ID_TO_ACTION)
                {
                    player->CLOSE_GOSSIP_MENU();
                    buyGuildhouse(player, _creature, action - OFFSET_GH_ID_TO_ACTION);
                }
                break;
        }
        return true;
    }
Exemplo n.º 3
0
bool OnGossipSelect(Player *player, Creature* pCreature, uint32 sender, uint32 action)
{
		player->PlayerTalkClass->ClearMenus();            /* 11/05/2010 niteowl57:  For 3.3.5a, fix menu functionality  */
	if (sender != GOSSIP_SENDER_MAIN)
		return false;

	switch (action)
	{
		case ACTION_TELE:
			//teleport player to GH
			player->CLOSE_GOSSIP_MENU();
			teleportPlayerToGuildHouse(player, pCreature);
			break;
		case ACTION_SHOW_BUYLIST:
			//show list of GHs which currently not occupied
			showBuyList(player, pCreature);
			break;
		default:
			if (action > OFFSET_SHOWBUY_FROM)
			{
				showBuyList(player, pCreature, action - OFFSET_SHOWBUY_FROM);
			} else if (action > OFFSET_GH_ID_TO_ACTION)
			{
				//player clicked on buy list
				player->CLOSE_GOSSIP_MENU();
				//get guildhouseId from action
				//guildhouseId = action - OFFSET_GH_ID_TO_ACTION
				buyGuildhouse(player, pCreature, action - OFFSET_GH_ID_TO_ACTION);
			}
			break;
	}
	
	return true;
}
Exemplo n.º 4
0
 bool OnGossipSelect(Player *player, Creature *_creature, uint32 sender, uint32 action)
 {
 player->PlayerTalkClass->ClearMenus();
 if (sender != GOSSIP_SENDER_MAIN)
 return false;

 switch (action)
 {
 case ACTION_TELE:
 //teleport player to GH
 player->CLOSE_GOSSIP_MENU();
 teleportPlayerToGuildHouse(player, _creature);
 break;
 case ACTION_SHOW_BUYLIST:
 //show list of GHs which currently not occupied
 showBuyList(player, _creature);
 break;

 case ACTION_SELL_GUILDHOUSE_OPT:
 player->CLOSE_GOSSIP_MENU();
 player->ADD_GOSSIP_ITEM(0, "Yes, Sell my guild", GOSSIP_SENDER_MAIN, ACTION_SELL_GUILDHOUSE_YES);
 player->ADD_GOSSIP_ITEM(0, "No, Close this", GOSSIP_SENDER_MAIN, ACTION_SELL_GUILDHOUSE_NO);
 player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, _creature->GetGUID());
 break;
 
 case ACTION_SELL_GUILDHOUSE_YES:
 sellGuildhouse(player, _creature);
 player->CLOSE_GOSSIP_MENU();
 break;
 
 case ACTION_SELL_GUILDHOUSE_NO:
 player->CLOSE_GOSSIP_MENU();
 break;

 default:
 if (action > OFFSET_SHOWBUY_FROM)
 {
 showBuyList(player, _creature, action - OFFSET_SHOWBUY_FROM);
 }
 else if (action > OFFSET_GH_ID_TO_ACTION)
 {
 //player clicked on buy list
 player->CLOSE_GOSSIP_MENU();

 //get guildhouseId from action
 //guildhouseId = action - OFFSET_GH_ID_TO_ACTION
 buyGuildhouse(player, _creature, action - OFFSET_GH_ID_TO_ACTION);
 }
 break;
 }

 return true;
 }
Exemplo n.º 5
0
bool showBuyList(Player *player, Creature *_creature, uint32 showFromId = 0)
{
	//show not occupied guildhouses

	QueryResult *result;
	result = SD2Database.PQuery("SELECT `id`, `comment` FROM `guildhouses` WHERE `guildId` = 0 AND `id` > %u ORDER BY `id` ASC LIMIT %u",
		showFromId, GOSSIP_COUNT_MAX);

	if (result)
	{
		uint32 guildhouseId = 0;
		std::string comment = "";
		do
		{

			Field *fields = result->Fetch();

			guildhouseId = fields[0].GetInt32();
			comment = fields[1].GetString();
			
			//send comment as a gossip item
			//transmit guildhouseId in Action variable
			player->ADD_GOSSIP_ITEM(ICON_GOSSIP_TABARD, comment, GOSSIP_SENDER_MAIN,
				guildhouseId + OFFSET_GH_ID_TO_ACTION);

		} while (result->NextRow());

		if (result->GetRowCount() == GOSSIP_COUNT_MAX)
		{
			//assume that we have additional page
			//add link to next GOSSIP_COUNT_MAX items
			player->ADD_GOSSIP_ITEM(ICON_GOSSIP_BALOONDOTS, MSG_GOSSIP_NEXTPAGE, GOSSIP_SENDER_MAIN, 
				guildhouseId + OFFSET_SHOWBUY_FROM);
		}

		delete result;

		player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, _creature->GetGUID());

		return true;
	} else
	{
		if (showFromId = 0)
		{
			//all guildhouses are occupied
			_creature->MonsterWhisper(MSG_NOFREEGH, player->GetGUID());
			player->CLOSE_GOSSIP_MENU();
		} else
		{
			//this condition occurs when COUNT(guildhouses) % GOSSIP_COUNT_MAX == 0
			//just show GHs from beginning
			showBuyList(player, _creature, 0);
		}
	}

	return false;
}
Exemplo n.º 6
0
 bool OnGossipSelect(Player *player, Creature *_creature, uint32 sender, uint32 action)
 {
 player->PlayerTalkClass->ClearMenus();
 if (sender != GOSSIP_SENDER_MAIN)
 return false;

 switch (action)
 {
 case ACTION_TELE:
 //teleport player to GH
 CloseGossipMenuFor(player);;
 teleportPlayerToGuildHouse(player, _creature);
 break;
 case ACTION_SHOW_BUYLIST:
 //show list of GHs which currently not occupied
 showBuyList(player, _creature);
 break;
 case ACTION_SELL_GUILDHOUSE:
  sellGuildhouse(player, _creature);
  CloseGossipMenuFor(player);;
 break;
 default:
 if (action > OFFSET_SHOWBUY_FROM)
 {
 showBuyList(player, _creature, action - OFFSET_SHOWBUY_FROM);
 }
 else if (action > OFFSET_GH_ID_TO_ACTION)
 {
 //player clicked on buy list
 CloseGossipMenuFor(player);;

 //get guildhouseId from action
 //guildhouseId = action - OFFSET_GH_ID_TO_ACTION
 buyGuildhouse(player, _creature, action - OFFSET_GH_ID_TO_ACTION);
 }
 break;
 }

 return true;
 }
bool showBuyList(Player *player, Creature *_creature, uint32 showFromId = 0)
{
    QueryResult result;
    result = CharacterDatabase.PQuery("SELECT `id`, `comment` FROM `guildhouses` WHERE `guildId` = 0 AND `id` > %u ORDER BY `id` ASC LIMIT %u",
    showFromId, GOSSIP_COUNT_MAX);

    if (result)
    {
        uint32 guildhouseId = 0;
        std::string comment = "";
        do
        {
            Field *fields = result->Fetch();
            guildhouseId = fields[0].GetInt32();
            comment = fields[1].GetString();
            player->ADD_GOSSIP_ITEM(ICON_GOSSIP_TABARD, comment, GOSSIP_SENDER_MAIN,
            guildhouseId + OFFSET_GH_ID_TO_ACTION);
        }
        while (result->NextRow());

        if (result->GetRowCount() == GOSSIP_COUNT_MAX)
        {
            player->ADD_GOSSIP_ITEM(ICON_GOSSIP_BALOONDOTS, MSG_GOSSIP_NEXTPAGE, GOSSIP_SENDER_MAIN,
            guildhouseId + OFFSET_SHOWBUY_FROM);
        }
        player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, _creature->GetGUID());
        return true;
    }
    else
    {
        if (showFromId = 0)
        {
            _creature->MonsterWhisper(MSG_NOFREEGH, player->GetGUID());
            player->CLOSE_GOSSIP_MENU();
        }
        else
        {
            showBuyList(player, _creature, 0);
        }
    }
    return false;
}