• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ GET_LOWGUID_PART函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GET_LOWGUID_PART函数的典型用法代码示例。如果您正苦于以下问题:C++ GET_LOWGUID_PART函数的具体用法?C++ GET_LOWGUID_PART怎么用?C++ GET_LOWGUID_PART使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GET_LOWGUID_PART函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: strtok

bool ChatHandler::HandleItemCommand(const char* args, WorldSession *m_session)
{
	char* pitem = strtok((char*)args, " ");
	if (!pitem)
		return false;

	uint64 guid = m_session->GetPlayer()->GetSelection();
	if(guid == 0)
	{
		SystemMessage(m_session, "No selection.");
		return true;
	}

	Creature * pCreature = m_session->GetPlayer()->GetMapMgr()->GetCreature(GET_LOWGUID_PART(guid));
	if(!pCreature)
	{
		SystemMessage(m_session, "You should select a creature.");
		return true;
	}

	uint32 item = atoi(pitem);
	int amount = -1;

	char* pamount = strtok(NULL, " ");
	if (pamount)
		amount = atoi(pamount);

	if (amount == -1)
	{
		SystemMessage(m_session, "You need to specify an amount.");
		return true;
	}

	uint32 costid = 0;
	char * pcostid = strtok(NULL, " ");
	if ( pcostid )
		costid = atoi( pcostid );

	ItemExtendedCostEntry * ec = ( costid > 0 ) ? dbcItemExtendedCost.LookupEntryForced( costid ) : NULL;
	if ( costid > 0 && dbcItemExtendedCost.LookupEntryForced( costid ) == NULL )
	{
		SystemMessage( m_session, "You've entered invalid extended cost id." );
		return true;
	}

	ItemPrototype* tmpItem = ItemPrototypeStorage.LookupEntry(item);

	std::stringstream sstext;
	if(tmpItem)
	{
		std::stringstream ss;
		ss << "INSERT INTO vendors VALUES ('" << pCreature->GetUInt32Value(OBJECT_FIELD_ENTRY) << "', '" << item << "', '" << amount << "', 0, 0, " << costid << " )" << '\0';
		WorldDatabase.Execute( ss.str().c_str() );

		pCreature->AddVendorItem( item, amount, ec );

		sstext << "Item '" << item << "' '" << tmpItem->Name1 << "' Added to list";
		if ( costid > 0 )
			sstext << "with extended cost " << costid;
		sstext << '\0';
	}
	else
	{
		sstext << "Item '" << item << "' Not Found in Database." << '\0';
	}

	sGMLog.writefromsession(m_session, "added item %u to vendor %u", item, pCreature->GetEntry());
	SystemMessage(m_session,  sstext.str().c_str());

	return true;
}
开发者ID:AegisEmu,项目名称:AegisEmu,代码行数:71,代码来源:Level2.cpp


示例2: HandleAuctionSellItem

void WorldSession::HandleAuctionSellItem( WorldPacket & recv_data )
{
	if (!_player->IsInWorld())
		return;

	uint64 guid,item;
	uint32 bid,buyout,etime;	// etime is in minutes

	recv_data >> guid >> item;
	recv_data >> bid >> buyout >> etime;

	Creature * pCreature = _player->GetMapMgr()->GetCreature(GET_LOWGUID_PART(guid));
	if(  !pCreature || !pCreature->auctionHouse )
		return;		// NPC doesnt exist or isnt an auctioneer

	// Get item
	Item * pItem = _player->GetItemInterface()->GetItemByGUID(item);
	if( !pItem || pItem->IsSoulbound() || pItem->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_CONJURED ) )
	{
		WorldPacket data(SMSG_AUCTION_COMMAND_RESULT, 8);
		data << uint32(0);
		data << uint32(AUCTION_CREATE);
		data << uint32(AUCTION_ERROR_ITEM);
		SendPacket(&data);
		return;
	};

	AuctionHouse * ah = pCreature->auctionHouse;

	uint32 item_worth = pItem->GetProto()->SellPrice * pItem->GetUInt32Value(ITEM_FIELD_STACK_COUNT);
	uint32 item_deposit = (uint32)(item_worth * ah->deposit_percent) * (uint32)(etime / 240.0f); // deposit is per 4 hours

	if (_player->GetUInt32Value(PLAYER_FIELD_COINAGE) < item_deposit)	// player cannot afford deposit
	{
		WorldPacket data(SMSG_AUCTION_COMMAND_RESULT, 8);
		data << uint32(0);
		data << uint32(AUCTION_CREATE);
		data << uint32(AUCTION_ERROR_MONEY);
		SendPacket(&data);
		return;
	}

	pItem = _player->GetItemInterface()->SafeRemoveAndRetreiveItemByGuid(item, false);
	if (!pItem){
		WorldPacket data(SMSG_AUCTION_COMMAND_RESULT, 8);
		data << uint32(0);
		data << uint32(AUCTION_CREATE);
		data << uint32(AUCTION_ERROR_ITEM);
		SendPacket(&data);
		return;
	};

	if( pItem->IsInWorld() )
	{
		pItem->RemoveFromWorld();
	}

	pItem->SetOwner(NULL);
	pItem->m_isDirty = true;
	pItem->SaveToDB(INVENTORY_SLOT_NOT_SET, 0, true, NULL);

	// Create auction
	Auction * auct = new Auction;
	auct->BuyoutPrice = buyout;
	auct->ExpiryTime = (uint32)UNIXTIME + (etime * 60);
	auct->HighestBid = bid;
	auct->HighestBidder = 0;	// hm
	auct->Id = sAuctionMgr.GenerateAuctionId();
	auct->Owner = _player->GetLowGUID();
	auct->pItem = pItem;
	auct->Deleted = false;
	auct->DeletedReason = 0;
	auct->DepositAmount = item_deposit;

	// remove deposit
	_player->ModUnsigned32Value(PLAYER_FIELD_COINAGE, -(int32)item_deposit);

	// Add and save auction to DB
	ah->AddAuction(auct);
	auct->SaveToDB(ah->GetID());

	// Send result packet
	WorldPacket data(SMSG_AUCTION_COMMAND_RESULT, 8);
	data << auct->Id;
	data << uint32(AUCTION_CREATE);
	data << uint32(AUCTION_ERROR_NONE);
	SendPacket(&data);
}
开发者ID:Chero,项目名称:abcwow,代码行数:88,代码来源:AuctionHouse.cpp


示例3: ARCEMU_ASSERT

void Spell::FillTargetMap(uint32 i)
{
	//Spell::prepare() has already a m_caster->IsInWorld() check so if now the caster is no more in world something bad happened.
	ARCEMU_ASSERT(m_caster->IsInWorld());

	uint32 TargetType = 0;
	TargetType |= GetTargetType(m_spellInfo->EffectImplicitTargetA[i], i);

	//never get info from B if it is 0 :P
	if(m_spellInfo->EffectImplicitTargetB[i] != 0)
		TargetType |= GetTargetType(m_spellInfo->EffectImplicitTargetB[i], i);

	if(TargetType & SPELL_TARGET_NOT_IMPLEMENTED)
		return;
	if(TargetType & SPELL_TARGET_NO_OBJECT)  //summon spells that appear infront of caster
	{
		HandleTargetNoObject();
		return;
	}


	//always add this guy :P
	if(!(TargetType & (SPELL_TARGET_AREA | SPELL_TARGET_AREA_SELF | SPELL_TARGET_AREA_CURTARGET | SPELL_TARGET_AREA_CONE | SPELL_TARGET_OBJECT_SELF | SPELL_TARGET_OBJECT_PETOWNER)))
	{
		Object* target = m_caster->GetMapMgr()->_GetObject(m_targets.m_unitTarget);
		AddTarget(i, TargetType, target);
	}

	if(TargetType & SPELL_TARGET_OBJECT_SELF)
		AddTarget(i, TargetType, m_caster);
	if(TargetType & (SPELL_TARGET_AREA | SPELL_TARGET_AREA_SELF))  //targetted aoe
		AddAOETargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets);
	//TODO: arcemu, doesn't support summon slots?
	/*if (TargetType & SPELL_TARGET_OBJECT_CURTOTEMS && u_caster != NULL)
		for (uint32 i=1; i<5; ++i) //totem slots are 1, 2, 3, 4
			AddTarget(i, TargetType, u_caster->m_summonslot[i]);*/
	if(TargetType & SPELL_TARGET_OBJECT_CURPET && p_caster != NULL)
		AddTarget(i, TargetType, p_caster->GetSummon());
	if(TargetType & SPELL_TARGET_OBJECT_PETOWNER)
	{
		uint64 guid = m_targets.m_unitTarget;
		if(GET_TYPE_FROM_GUID(guid) == HIGHGUID_TYPE_PET)
		{
			Pet* p = m_caster->GetMapMgr()->GetPet(GET_LOWGUID_PART(guid));

			if(p != NULL)
				AddTarget(i, TargetType, p->GetPetOwner());
		}
	}
	//targets party, not raid
	if((TargetType & SPELL_TARGET_AREA_PARTY) && !(TargetType & SPELL_TARGET_AREA_RAID))
	{
		if(p_caster == NULL && !m_caster->IsPet() && (!m_caster->IsCreature() || !m_caster->IsTotem()))
			AddAOETargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets); //npcs
		else
			AddPartyTargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets); //players/pets/totems
	}
	if(TargetType & SPELL_TARGET_AREA_RAID)
	{
		if(p_caster == NULL && !m_caster->IsPet() && (!m_caster->IsCreature() || !m_caster->IsTotem()))
			AddAOETargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets); //npcs
		else
			AddRaidTargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets, (TargetType & SPELL_TARGET_AREA_PARTY) ? true : false); //players/pets/totems
	}
	if(TargetType & SPELL_TARGET_AREA_CHAIN)
		AddChainTargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets);
	//target cone
	if(TargetType & SPELL_TARGET_AREA_CONE)
		AddConeTargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets);

	if(TargetType & SPELL_TARGET_OBJECT_SCRIPTED)
		AddScriptedOrSpellFocusTargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets);
}
开发者ID:Selenah,项目名称:ArcEmu,代码行数:73,代码来源:SpellTarget.cpp


示例4: HandleGenerateWaypoints

bool ChatHandler::HandleGenerateWaypoints(const char* args, WorldSession * m_session)
{
    Creature* cr = m_session->GetPlayer()->GetMapMgr()->GetCreature(GET_LOWGUID_PART(m_session->GetPlayer()->GetSelection()));
    if(!cr)
    {
        SystemMessage(m_session, "You should select a creature.");
        return true;
    }

    if( cr->m_spawn == NULL )
    {
        SystemMessage(m_session, "You cannot add waypoints to a creature that is not saved.");
        return true;
    }

    if(cr->GetAIInterface() == NULL)
    {
        SystemMessage(m_session, "Creature was not initialized correctly.");
        return true;
    }

    if(cr->GetAIInterface()->GetWayPointsCount())//ALREADY HAVE WAYPOINTS
    {
        SystemMessage(m_session, "The creature already has waypoints");
        return false;
    }

    if(m_session->GetPlayer()->waypointunit != NULL)
    {
        SystemMessage(m_session, "You are already showing waypoints, hide them first.");
        return true;
    }

    if(!cr->GetSQL_id())
    {
        SystemMessage(m_session, "This creature did not get a valid spawn_id.");
        return true;
    }

    uint32 r;
    uint32 n;
    if(sscanf(args, "%u %u", &r, &n) != 2)
    {
        SystemMessage(m_session, "Randomly generate wps params: range count");
        return true;
    }

    for(uint32 i = 0; i < n; i++)
    {
        float ang = rand()/100.0f;
        float ran = (RandomUInt(r*10))/10.0f;
        while(ran < 1)
        {
            ran = (RandomUInt(r*10))/10.0f;
        }

        float x = cr->GetPositionX()+ran*sin(ang);
        float y = cr->GetPositionY()+ran*cos(ang);
        float z = cr->GetCHeightForPosition(true, x, y, cr->GetPositionZ());

        WayPoint* wp = new WayPoint;
        wp->id = (uint32)cr->GetAIInterface()->GetWayPointsCount()+1;
        wp->x = x;
        wp->y = y;
        wp->z = z;
        wp->orientation = 0.0f;
        wp->waittime = 5000;
        wp->flags = 0;
        wp->forwardInfo = NULL;
        wp->backwardInfo = NULL;
        cr->GetAIInterface()->addWayPoint(wp);
    }

    cr->GetAIInterface()->setMoveType(1);
    m_session->GetPlayer()->waypointunit = cr->GetAIInterface();
    cr->GetAIInterface()->showWayPoints(m_session->GetPlayer(),cr->GetAIInterface()->WayPointsShowingBackwards());
    return true;
}
开发者ID:Sandshroud,项目名称:Sandshroud-Prodigy,代码行数:78,代码来源:WayPointCommands.cpp


示例5: HandleGossipHelloOpcode

//////////////////////////////////////////////////////////////
/// This function handles CMSG_GOSSIP_HELLO:
//////////////////////////////////////////////////////////////
void WorldSession::HandleGossipHelloOpcode( WorldPacket & recv_data )
{
	if(!_player->IsInWorld()) return;
	uint64 guid;
	list<QuestRelation *>::iterator it;
	std::set<uint32> ql;

	recv_data >> guid;
	Creature *qst_giver = _player->GetMapMgr()->GetCreature(GET_LOWGUID_PART(guid));
	if(!qst_giver) 
		return;

	//stop when talked to for 3 min
	if(qst_giver->GetAIInterface())
		qst_giver->GetAIInterface()->StopMovement(180000);
 
	// unstealth meh
	if( _player->IsStealth() )
		_player->RemoveAllAuraType( SPELL_AURA_MOD_STEALTH );

	// reputation
	_player->Reputation_OnTalk(qst_giver->m_factionDBC);

	DEBUG_LOG( "WORLD: Received CMSG_GOSSIP_HELLO from %u",GUID_LOPART(guid) );

	GossipScript * Script = qst_giver->GetCreatureName() ? qst_giver->GetCreatureName()->gossip_script : NULL;
	if(!Script)
		return;

	if (qst_giver->isQuestGiver() && qst_giver->HasQuests())
	{
		WorldPacket data;
		data.SetOpcode(SMSG_GOSSIP_MESSAGE);
		Script->GossipHello(qst_giver, _player, false);
		if(!_player->CurrentGossipMenu)
			return;

		_player->CurrentGossipMenu->BuildPacket(data);
		uint32 count=0;//sQuestMgr.ActiveQuestsCount(qst_giver, GetPlayer());
		size_t pos=data.wpos();
		data << uint32(count);
		for (it = qst_giver->QuestsBegin(); it != qst_giver->QuestsEnd(); ++it)
		{
			uint32 status = sQuestMgr.CalcQuestStatus(qst_giver, GetPlayer(), *it);
			if (status >= QMGR_QUEST_CHAT)
			{
				if (!ql.count((*it)->qst->id) )
				{	
					ql.insert((*it)->qst->id);
					count++;
					data << (*it)->qst->id;
					/*data << status;//sQuestMgr.CalcQuestStatus(qst_giver, GetPlayer(), *it);
					data << uint32(0);*/
					switch(status)
					{
					case QMGR_QUEST_NOT_FINISHED:
						data << uint32(4) << uint32(0);
						break;

					case QMGR_QUEST_FINISHED:
						data << uint32(4) << uint32(1);
						break;

					case QMGR_QUEST_CHAT:
						data << QMGR_QUEST_AVAILABLE << uint32(0);
						break;

					default:
						data << status << uint32(0);
						break;
					}

					LocalizedQuest * lq = (language>0) ? sLocalizationMgr.GetLocalizedQuest((*it)->qst->id,language):NULL;
					if(lq)
						data << lq->Title;
					else
						data << (*it)->qst->title;
				}
			}
		}
		data.wpos(pos);
		data << count;
		SendPacket(&data);
		DEBUG_LOG( "WORLD: Sent SMSG_GOSSIP_MESSAGE" );
	}
	else
	{
		Script->GossipHello(qst_giver, _player, true);
	}
}
开发者ID:Centraly,项目名称:SummitEmu,代码行数:93,代码来源:NPCHandler.cpp


示例6: getSelectedChar

bool ChatHandler::HandleQuestFinishCommand(const char * args, WorldSession * m_session)
{
	if(!*args) return false;

	Player *plr = getSelectedChar(m_session, true);
	if(!plr)
	{
		plr = m_session->GetPlayer();
		SystemMessage(m_session, "Auto-targeting self.");
	}

	uint32 quest_id = atol(args);
	std::string recout = "|cff00ff00";

	Quest * qst = QuestStorage.LookupEntry(quest_id);
	if(qst)
	{
		if (plr->HasFinishedQuest(quest_id))
			recout += "Player has already completed that quest.\n\n";
		else
		{
			QuestLogEntry * IsPlrOnQuest = plr->GetQuestLogForEntry(quest_id);
			if (IsPlrOnQuest)
			{	
				uint32 giver_id = 0;
				std::string my_query = "";

				my_query = "SELECT id FROM creature_quest_starter WHERE quest = " + string(args);
				QueryResult *creatureResult = WorldDatabase.Query(my_query.c_str());

				if(creatureResult)
				{
					Field *creatureFields = creatureResult->Fetch();
					giver_id = creatureFields[0].GetUInt32();
					delete creatureResult;
				}
				else
				{
					my_query = "SELECT id FROM gameobject_quest_starter WHERE quest = " + string(args);
					QueryResult *objectResult = WorldDatabase.Query(my_query.c_str());
					if(objectResult)
					{
						Field *objectFields = objectResult->Fetch();
						giver_id = objectFields[0].GetUInt32();
						delete objectResult;
					}
				}

				if(giver_id == 0)
					SystemMessage(m_session, "Unable to find quest giver creature or object.");
				else
				{
					// I need some way to get the guid without targeting the creature or looking through all the spawns...
					Object *quest_giver;

					for(uint32 guid=1; guid < plr->GetMapMgr()->m_CreatureArraySize; guid++)
					{
						Creature *pCreature = plr->GetMapMgr()->GetCreature(GET_LOWGUID_PART(guid));
						if(pCreature)
						{
							if(pCreature->GetEntry() == giver_id) //found creature
							{
								quest_giver = (Object*)pCreature;
								guid = plr->GetMapMgr()->m_CreatureArraySize;
							}
						}
					}

					if(quest_giver)
					{
						GreenSystemMessage(m_session, "Found a quest_giver creature.");
						//WorldPacket data;
						//sQuestMgr.BuildOfferReward(&data, qst, quest_giver, 1);
						//m_session->SendPacket(&data);
						sQuestMgr.GiveQuestRewardReputation(plr, qst, quest_giver);
					}
					else
						RedSystemMessage(m_session, "Unable to find quest_giver object.");
				}

				sQuestMgr.GenerateQuestXP(plr, qst);
				sQuestMgr.BuildQuestComplete(plr, qst);

				IsPlrOnQuest->Finish();
				recout += "Player was on that quest, but has now completed it.";
			}
			else
				recout += "The quest has now been completed for that player.";

			plr->AddToFinishedQuests(quest_id);
		}
	}
	else
	{
		recout += "Quest Id [";
		recout += args;
		recout += "] was not found and unable to add it to the player's quest log.";
	}

	recout += "\n\n";
//.........这里部分代码省略.........
开发者ID:AwkwardDev,项目名称:Summit,代码行数:101,代码来源:QuestCommands.cpp


示例7: atol

bool ChatHandler::HandleQuestListCommand(const char * args, WorldSession * m_session)
{
	uint32 quest_giver = 0;
	if(*args)
		quest_giver = atol(args);
	else
	{
		uint64 guid = m_session->GetPlayer()->GetSelection();
		if (guid == 0)
		{
			SystemMessage(m_session, "You must target an npc or specify an id.");
			return true;
		}

		Creature *unit = m_session->GetPlayer()->GetMapMgr()->GetCreature(GET_LOWGUID_PART(guid));
		if(unit)
		{
			if (!unit->isQuestGiver())
			{
				SystemMessage(m_session, "Unit is not a valid quest giver.");
				return true;
			}

			if (!unit->HasQuests())
			{
				SystemMessage(m_session, "NPC does not have any quests.");
				return true;
			}

			quest_giver = unit->GetEntry();
		}
	}

	string recout = "|cff00ff00Quest matches: id: title\n\n";
	SendMultilineMessage(m_session, recout.c_str());

	uint32 count = 0;
	uint32 quest_id = 0;
	Quest * qst;
	Field *fields;

	if(quest_giver == 0)
	{
		Player *plr = getSelectedChar(m_session, true);
		if(!plr)
		{
			plr = m_session->GetPlayer();
			SystemMessage(m_session, "Auto-targeting self.");
		}

		if(plr)
		{
			if(plr->HasQuests())
			{
				QueryResult *playerResult = CharacterDatabase.Query("SELECT quest_id FROM questlog WHERE player_guid=%u", plr->GetLowGUID());
				if(playerResult)
				{
					do 
					{
						fields = playerResult->Fetch();
						quest_id = fields[0].GetUInt32();

						qst = QuestStorage.LookupEntry(quest_id);

						string qid  = MyConvertIntToString(quest_id);
						const char * qname = qst->title;

						recout = "|cff00ccff";
						recout += qid.c_str();
						recout += ": ";
						recout += qname;
						recout += "\n";

						SendMultilineMessage(m_session, recout.c_str());

						count++;
						
						if(count == 25)
						{
							RedSystemMessage(m_session, "More than 25 results returned. aborting.");
							break;
						}

					} while(playerResult->NextRow());

					delete playerResult;
				}
			}
		}
	}
	else
	{
		QueryResult *creatureResult = WorldDatabase.Query("SELECT quest FROM creature_quest_starter WHERE id = %u", quest_giver);

		if(!creatureResult)
		{
			recout = "|cff00ccffNo quests found for the specified NPC id.\n\n";
			SendMultilineMessage(m_session, recout.c_str());
			return true;
		}
//.........这里部分代码省略.........
开发者ID:AwkwardDev,项目名称:Summit,代码行数:101,代码来源:QuestCommands.cpp


示例8: HandleAuctionSellItem

void WorldSession::HandleAuctionSellItem(WorldPacket& recv_data)
{
    CHECK_INWORLD_RETURN

    uint64 auctioneer, bid, buyout;
    uint32 itemsCount, etime;
    recv_data >> auctioneer;
    recv_data >> itemsCount;

    uint64 itemGUIDs[MAX_AUCTION_ITEMS]; // 160 slot = 4x 36 slot bag + backpack 16 slot
    uint32 count[MAX_AUCTION_ITEMS];
    
    for (uint32 i = 0; i < itemsCount; ++i)
    {
        recv_data >> itemGUIDs[i];
        recv_data >> count[i];

        if (!itemGUIDs[i] || !count[i] || count[i] > 1000)
            return;
    }

    recv_data >> bid;
    recv_data >> buyout;
    recv_data >> etime;

    if (!bid || !etime)
        return;

    Creature* pCreature = _player->GetMapMgr()->GetCreature(GET_LOWGUID_PART(auctioneer));
    if (!pCreature || !pCreature->auctionHouse)
        return;        // NPC doesn't exist or isn't an auctioneer

    AuctionHouse* ah = pCreature->auctionHouse;

    etime *= MINUTE;

    switch (etime)
    {
    case 1 * MIN_AUCTION_TIME:
    case 2 * MIN_AUCTION_TIME:
    case 4 * MIN_AUCTION_TIME:
        break;
    default:
        return;
    }

    Item* items[MAX_AUCTION_ITEMS];

    uint32 finalCount = 0;

    for (uint32 i = 0; i < itemsCount; ++i)
    {
        Item* item = _player->GetItemInterface()->GetItemByGUID(itemGUIDs[i]);

        if (!item)
        {
            _player->SendAuctionCommandResult(NULL, AUCTION_CREATE, ERR_AUCTION_ITEM_NOT_FOUND);
            return;
        }


        items[i] = item;
        finalCount += count[i];
    }

    if (!finalCount)
    {
        _player->SendAuctionCommandResult(NULL, AUCTION_CREATE, ERR_AUCTION_DATABASE_ERROR);
        return;
    }

    for (uint32 i = 0; i < itemsCount; ++i)
    {
        Item* item = items[i];

        if (item->GetStackCount() < finalCount)
        {
            _player->SendAuctionCommandResult(NULL, AUCTION_CREATE, ERR_AUCTION_DATABASE_ERROR);
            return;
        }
    }

    for (uint32 i = 0; i < itemsCount; ++i)
    {
        Item* item = items[i];
        uint32 auctionTime = uint32(etime);

        AuctionHouse* ah = pCreature->auctionHouse;

        uint32 item_worth = item->GetProto()->SellPrice * item->GetStackCount();
        uint32 item_deposit = (uint32)(item_worth * ah->deposit_percent) * (uint32)(etime / 240.0f); // deposit is per 4 hours

        if (!_player->HasGold((uint64)item_deposit))
        {
            _player->SendAuctionCommandResult(NULL, AUCTION_CREATE, ERR_AUCTION_NOT_ENOUGHT_MONEY);
            return;
        }

        _player->TakeGold(-int32(item_deposit));

//.........这里部分代码省略.........
开发者ID:beyourself,项目名称:AscEmu_CATA,代码行数:101,代码来源:AuctionHouse.cpp


示例9: SystemMessage

bool ChatHandler::HandleDeleteCommand(const char* args, WorldSession* m_session)
{

	uint64 guid = m_session->GetPlayer()->GetSelection();
	if(guid == 0)
	{
		SystemMessage(m_session, "No selection.");
		return true;
	}

	Creature* unit = m_session->GetPlayer()->GetMapMgr()->GetCreature(GET_LOWGUID_PART(guid));
	if(!unit)
	{
		SystemMessage(m_session, "You should select a creature.");
		return true;
	}
	if(unit->IsPet())
	{
		SystemMessage(m_session, "You can't delete a pet.");
		return true;
	}
	sGMLog.writefromsession(m_session, "used npc delete, sqlid %u, creature %s, pos %f %f %f", unit->GetSQL_id(), unit->GetCreatureInfo()->Name, unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ());

	unit->GetAIInterface()->hideWayPoints(m_session->GetPlayer());

	unit->DeleteFromDB();

	if(unit->IsSummon())
	{
		unit->Delete();
	}
	else
	{

		if(unit->m_spawn)
		{
			uint32 cellx = uint32(((_maxX - unit->m_spawn->x) / _cellSize));
			uint32 celly = uint32(((_maxY - unit->m_spawn->y) / _cellSize));

			if(cellx <= _sizeX && celly <= _sizeY)
			{
				CellSpawns* sp = unit->GetMapMgr()->GetBaseMap()->GetSpawnsList(cellx, celly);
				if(sp != NULL)
				{
					for(CreatureSpawnList::iterator itr = sp->CreatureSpawns.begin(); itr != sp->CreatureSpawns.end(); ++itr)
						if((*itr) == unit->m_spawn)
						{
							sp->CreatureSpawns.erase(itr);
							break;
						}
				}
				delete unit->m_spawn;
				unit->m_spawn = NULL;
			}
		}

		unit->RemoveFromWorld(false, true);
	}

	BlueSystemMessage(m_session, "Creature deleted");

	return true;
}
开发者ID:Antares84,项目名称:arcemu,代码行数:63,代码来源:Level2.cpp


示例10: HandleAuctionPlaceBid

void WorldSession::HandleAuctionPlaceBid(WorldPacket& recv_data)
{
    CHECK_INWORLD_RETURN

    uint64 guid;
    recv_data >> guid;

    uint32 auction_id, price;
    recv_data >> auction_id >> price;

    Creature* pCreature = _player->GetMapMgr()->GetCreature(GET_LOWGUID_PART(guid));
    if (!pCreature || !pCreature->auctionHouse)
        return;

    // Find Item
    AuctionHouse* ah = pCreature->auctionHouse;
    Auction* auct = ah->GetAuction(auction_id);
    if (auct == 0 || !auct->Owner || !_player)
    {
        SendAuctionPlaceBidResultPacket(0, ERR_AUCTION_DATABASE_ERROR);
        return;
    }

    if (auct->Owner == _player->GetGUID())
    {
        SendAuctionPlaceBidResultPacket(0, ERR_AUCTION_BID_OWN);
        return;
    }
    if (auct->HighestBid > price && price != auct->BuyoutPrice)
    {
        //HACK: Don't know the correct error code...
        SendAuctionPlaceBidResultPacket(0, ERR_AUCTION_DATABASE_ERROR);
        return;
    }

    if (!_player->HasGold(price))
    {
        SendAuctionPlaceBidResultPacket(0, ERR_AUCTION_NOT_ENOUGHT_MONEY);
        return;
    }

    _player->ModGold(-(int32)price);
    if (auct->HighestBidder != 0)
    {
        // Return the money to the last highest bidder.
        char subject[100];
        snprintf(subject, 100, "%u:0:0", (int)auct->pItem->GetEntry());
        sMailSystem.SendAutomatedMessage(AUCTION, ah->GetID(), auct->HighestBidder, subject, "", auct->HighestBid, 0, 0, MAIL_STATIONERY_AUCTION);

        // Do not send out bid notification, when current highest bidder and new bidder are the same player..
        if (auct->HighestBidder != (uint32)_player->GetLowGUID())
            ah->SendAuctionOutBidNotificationPacket(auct, _player->GetGUID(), price);
    }

    if (auct->BuyoutPrice == price)
    {
        auct->HighestBidder = _player->GetLowGUID();
        auct->HighestBid = price;

        // we used buyout on the item.
        ah->QueueDeletion(auct, AUCTION_REMOVE_WON);

        SendAuctionPlaceBidResultPacket(auct->Id, ERR_AUCTION_OK);
        ah->SendAuctionBuyOutNotificationPacket(auct);
    }
    else
    {
        // update most recent bid
        auct->HighestBidder = _player->GetLowGUID();
        auct->HighestBid = price;
        auct->UpdateInDB();

        SendAuctionPlaceBidResultPacket(auct->Id, ERR_AUCTION_OK);
    }

    ah->SendAuctionList(_player, &recv_data);
}
开发者ID:beyourself,项目名称:AscEmu_CATA,代码行数:77,代码来源:AuctionHouse.cpp


示例11: HandleGenerateWaypoints

bool ChatHandler::HandleGenerateWaypoints(const char* args, WorldSession * m_session)
{
	Creature * cr = 
		m_session->GetPlayer()->GetMapMgr()->GetCreature(GET_LOWGUID_PART(m_session->GetPlayer()->GetSelection()));
	if(!cr)
	{
		SystemMessage(m_session, "You should select a creature.");
		return true;
	}
	if(cr->GetAIInterface()->GetWayPointsCount())//ALREADY HAVE WAYPOINTS
	{	
		SystemMessage(m_session, "The creature already has waypoints");
		return false;
	}
	if(m_session->GetPlayer()->waypointunit != NULL)
	{
		SystemMessage(m_session, "You are already showing waypoints, hide them first.");
		return true;
	}

	if(!cr->GetSQL_id())
		return false;
	char* pR = strtok((char*)args, " ");
	if(!pR)
	{
		SystemMessage(m_session, "Randomly generate wps params: range count");
		return true;
	}
	int r = atoi(pR);
	char *pC=strtok(NULL, " ");
	if(!pC)
	{
		SystemMessage(m_session, "Randomly generate wps params: range count");
		return true;
	}
	int n = atol(pC);

	for(int i=0;i<n;i++)
	{
		float ang = rand()/100.0f;
		float ran = (rand()%(r*10))/10.0f;
		while(ran<1)
		{
			ran = (rand()%(r*10))/10.0f;
		}

		float x = cr->GetPositionX()+ran*sin(ang);
		float y = cr->GetPositionY()+ran*cos(ang);
		float z = cr->GetMapMgr()->GetBaseMap()->GetLandHeight(x,y);
		 
		WayPoint* wp = new WayPoint;
		wp->id = (uint32)cr->GetAIInterface()->GetWayPointsCount()+1;
		wp->x = x;
		wp->y = y;
		wp->z = z;
		wp->waittime = 5000;
		wp->flags = 0;
		wp->forwardemoteoneshot = 0;
		wp->forwardemoteid = 0;
		wp->backwardemoteoneshot = 0;
		wp->backwardemoteid = 0;
		wp->forwardskinid = 0;
		wp->backwardskinid = 0;
		
		cr->GetAIInterface()->addWayPoint(wp);
	}

	if(cr->m_spawn && cr->m_spawn->movetype != 1)		/* move random */
	{
		cr->m_spawn->movetype = 1;
		cr->GetAIInterface()->m_moveType = 1;
		WorldDatabase.Execute("UPDATE creature_spawns SET movetype = 1 WHERE id = %u", cr->GetSQL_id());
	}
	m_session->GetPlayer()->waypointunit = cr->GetAIInterface();
	cr->GetAIInterface()->showWayPoints(m_session->GetPlayer(),cr->GetAIInterface()->m_WayPointsShowBackwards);
	
	return true;
}
开发者ID:AwkwardDev,项目名称:ascent_classic,代码行数:78,代码来源:WayPoints.cpp


示例12: GET_TYPE_FROM_GUID

/*Loot type MUST be
1-corpse, go
2-skinning/herbalism/minning
3-Fishing
*/
void Player::SendLoot(uint64 guid, uint8 loot_type, uint32 mapid)
{
	Group* m_Group = m_playerInfo->m_Group;

	if(!IsInWorld())
		return;

	Loot* pLoot = NULL;
	uint32 guidtype = GET_TYPE_FROM_GUID(guid);

	int8 loot_method;

	if(m_Group != NULL)
		loot_method = m_Group->GetMethod();
	else
		loot_method = PARTY_LOOT_FFA;

	if(guidtype == HIGHGUID_TYPE_UNIT)
	{
		Creature* pCreature = GetMapMgr()->GetCreature(GET_LOWGUID_PART(guid));
		if(!pCreature)return;
		pLoot = &pCreature->loot;
		m_currentLoot = pCreature->GetGUID();

	}
	else if(guidtype == HIGHGUID_TYPE_GAMEOBJECT)
	{
		GameObject* pGO = GetMapMgr()->GetGameObject(GET_LOWGUID_PART(guid));
		if(!pGO)return;
		pGO->SetByte(GAMEOBJECT_BYTES_1, 0, 0);
		pLoot = &pGO->loot;
		m_currentLoot = pGO->GetGUID();
	}
	else if((guidtype == HIGHGUID_TYPE_PLAYER))
	{
		Player* p = GetMapMgr()->GetPlayer((uint32)guid);
		if(!p)return;
		pLoot = &p->loot;
		m_currentLoot = p->GetGUID();
	}
	else if((guidtype == HIGHGUID_TYPE_CORPSE))
	{
		Corpse* pCorpse = objmgr.GetCorpse((uint32)guid);
		if(!pCorpse)return;
		pLoot = &pCorpse->loot;
		m_currentLoot = pCorpse->GetGUID();
	}
	else if((guidtype == HIGHGUID_TYPE_ITEM))
	{
		Item* pItem = GetItemInterface()->GetItemByGUID(guid);
		if(!pItem)
			return;
		pLoot = pItem->loot;
		m_currentLoot = pItem->GetGUID();
	}

	if(!pLoot)
	{
		// something whack happened.. damn cheaters..
		return;
	}

	// add to looter set
	pLoot->looters.insert(GetLowGUID());

	WorldPacket data, data2(32);
	data.SetOpcode(SMSG_LOOT_RESPONSE);


	m_lootGuid = guid;


	data << uint64(guid);
	data << uint8(loot_type);  //loot_type;
	data << uint32(pLoot->gold);
	data << uint8(0);   //loot size reserve


	std::vector<__LootItem>::iterator iter = pLoot->items.begin();
	uint32 count = 0;
	uint8 slottype = 0;

	for(uint32 x = 0; iter != pLoot->items.end(); iter++, x++)
	{
		if(iter->iItemsCount == 0)
			continue;

		LooterSet::iterator itr = iter->has_looted.find(GetLowGUID());
		if(iter->has_looted.end() != itr)
			continue;

		ItemPrototype* itemProto = iter->item.itemproto;
		if(!itemProto)
			continue;

//.........这里部分代码省略.........
开发者ID:Carbinfibre,项目名称:ArcPro,代码行数:101,代码来源:PlayerPacketWrapper.cpp


示例13: HandleAuctionPlaceBid

void WorldSession::HandleAuctionPlaceBid( WorldPacket & recv_data )
{
	if(!_player->IsInWorld())
		return;

	uint64 guid;
	recv_data >> guid;

	uint32 auction_id, price;
	recv_data >> auction_id >> price;

	Creature * pCreature = _player->GetMapMgr()->GetCreature(GET_LOWGUID_PART(guid));
	if(!pCreature || !pCreature->auctionHouse || price == 0)
		return;

	// Find Item
	AuctionHouse * ah = pCreature->auctionHouse;
	Auction * auct = ah->GetAuction(auction_id);
	if(auct == 0 || !auct->Owner || !_player || auct->Owner == _player->GetGUID())
		return;

	if(auct->HighestBid > price && price != auct->BuyoutPrice)
		return;

	if(_player->GetUInt32Value(PLAYER_FIELD_COINAGE) < price)
		return;

	_player->ModUnsigned32Value(PLAYER_FIELD_COINAGE, -((int32)price));
	if(auct->HighestBidder != 0)
	{
		// Return the money to the last highest bidder.
		char subject[100];
		snprintf(subject, 100, "%u:0:0", (int)auct->pItem->GetEntry());
		sMailSystem.SendAutomatedMessage(AUCTION, ah->GetID(), auct->HighestBidder, subject, "", auct->HighestBid,
			0, 0, 62);
	}

	if(auct->BuyoutPrice == price)
	{
		auct->HighestBidder = _player->GetLowGUID();
		auct->HighestBid = price;

		// we used buyout on the item.
		ah->QueueDeletion(auct, AUCTION_REMOVE_WON);

		// send response packet
		WorldPacket data(SMSG_AUCTION_COMMAND_RESULT, 12);
		data << auct->Id << uint32(AUCTION_CANCEL) << uint32(0) << uint32(0);
		SendPacket(&data);
	}
	else
	{
		// update most recent bid
		auct->HighestBidder = _player->GetLowGUID();
		auct->HighestBid = price;
		auct->UpdateInDB();

		// send response packet
		WorldPacket data(SMSG_AUCTION_COMMAND_RESULT, 12);
		data << auct->Id << uint32(AUCTION_CANCEL) << uint32(0);
		SendPacket(&data);
	}
}
开发者ID:AwkwardDev,项目名称:Summit,代码行数:63,代码来源:AuctionHouse.cpp


示例14: SystemMessage

bool ChatHandler::HandleQuestAddStartCommand(const char * args, WorldSession * m_session)
{
	if(!*args) return false;

	uint64 guid = m_session->GetPlayer()->GetSelection();
	if (guid == 0)
	{
		SystemMessage(m_session, "You must target an npc.");
		return false;
	}

	Creature *unit = m_session->GetPlayer()->GetMapMgr()->GetCreature(GET_LOWGUID_PART(guid));
	if(!unit)
	{
		SystemMessage(m_session, "You must target an npc.");
		return false;
	}

	if (!unit->isQuestGiver())
	{
		SystemMessage(m_session, "Unit is not a valid quest giver.");
		return false;
	}

	uint32 quest_id = atol(args);
	Quest * qst = QuestStorage.LookupEntry(quest_id);

	if (qst == NULL)
	{
		SystemMessage(m_session, "Invalid quest selected, unable to add quest to the specified NPC.");
		return false;
	}

	std::string quest_giver = MyConvertIntToString(unit->GetEntry());

	std::string my_query1 = "SELECT id FROM creature_quest_starter WHERE id = " + quest_giver + " AND quest = " + string(args);
	QueryResult *selectResult1 = WorldDatabase.Query(my_query1.c_str());
	if (selectResult1)
	{
		delete selectResult1;
		SystemMessage(m_session, "Quest was already found for the specified NPC.");
	}
	else
	{
		std::string my_insert1 = "INSERT INTO creature_quest_starter (id, quest) VALUES (" + quest_giver + "," + string(args) + ")";
		QueryResult *insertResult1 = WorldDatabase.Query(my_insert1.c_str());
		if (insertResult1)
			delete insertResult1;
	}

	std::string my_query2 = "SELECT id FROM gameobject_quest_starter WHERE id = " + quest_giver + " AND quest = " + string(args);
	QueryResult *selectResult2 = WorldDatabase.Query(my_query2.c_str());
	if (selectResult2)
		delete selectResult2;
	else
	{
		std::string my_insert2 = "INSERT INTO gameobject_quest_starter (id, quest) VALUES (" + quest_giver + "," + string(args) + ")";
		QueryResult *insertResult2 = WorldDatabase.Query(my_insert2.c_str());
		if (insertResult2)
			delete insertResult2;
	}

	sQuestMgr.LoadExtraQuestStuff();

	QuestRelation *qstrel = new QuestRelation;
	qstrel->qst = qst;
	qstrel->type = QUESTGIVER_QUEST_START;
	uint8 qstrelid = (uint8)unit->GetQuestRelation(quest_id);
	unit->FindQuest(quest_id, qstrelid);
	unit->AddQuest(qstrel);
	unit->_LoadQuests();

	const char * qname = qst->title;

	std::string recout = "|cff00ff00Added Quest to NPC as starter: ";
	recout += "|cff00ccff";
	recout += qname;
	recout += "\n\n";
	SendMultilineMessage(m_session, recout.c_str());

	return true;
}
开发者ID:AwkwardDev,项目名称:Summit,代码行数:82,代码来源:QuestCommands.cpp


示例15: HandleTrainerBuySpellOpcode

void WorldSession::HandleTrainerBuySpellOpcode(WorldPacket& recvPacket)
{
	if(!_player->IsInWorld()) return;
	uint64 Guid;
	uint32 TeachingSpellID;

	recvPacket >> Guid >> TeachingSpellID;
	Creature *pCreature = _player->GetMapMgr()->GetCreature(GET_LOWGUID_PART(Guid));
	if(pCreature == 0) return;

	Trainer *pTrainer = pCreature->GetTrainer();
	if(pTrainer == 0 || !CanTrainAt(_player, pTrainer)) return;

	TrainerSpell * pSpell=NULL;
	for(vector<TrainerSpell>::iterator itr = pTrainer->Spells.begin(); itr != pTrainer->Spells.end(); ++itr)
	{
		if( ( itr->pCastRealSpell && itr->pCastRealSpell->Id == TeachingSpellID ) ||
			( itr->pLearnSpell && itr->pLearnSpell->Id == TeachingSpellID ) )
		{
			pSpell = &(*itr);
		}
	}
	
	if(pSpell == NULL)
		return;

	if(TrainerGetSpellStatus(pSpell) > 0) return;
	
	_player->ModUnsigned32Value(PLAYER_FIELD_COINAGE, -(int32)pSpell->Cost);

	if( pSpell->pCastSpell)
	{
		// Cast teaching spell on player
		pCreature->CastSpell(_player, pSpell->pCastSpell, true);
	}

	if( pSpell->pLearnSpell )
	{
		packetSMSG_PLAY_SPELL_VISUAL pck;
		pck.guid = pCreature->GetGUID();
		pck.visualid = 0x5b3;
		_player->OutPacketToSet( SMSG_PLAY_SPELL_VISUAL, sizeof(packetSMSG_PLAY_SPELL_VISUAL), &pck, true );

		pck.guid = _player->GetGUID();
		pck.visualid = 0x16a;
		_player->OutPacketToSet( 0x1F7, sizeof(packetSMSG_PLAY_SPELL_VISUAL), &pck, true );

		// add the spell
		_player->addSpell( pSpell->pLearnSpell->Id );

		uint32 i;
		for( i = 0; i < 3; ++i)
		{
			if(pSpell->pLearnSpell->Effect[i] == SPELL_EFFECT_PROFICIENCY || pSpell->pLearnSpell->Effect[i] == SPELL_EFFECT_LEARN_SPELL ||
				pSpell->pLearnSpell->Effect[i] == SPELL_EFFECT_WEAPON)
			{
				_player->CastSpell(_player, pSpell->pLearnSpell, true);
				break;
			}
		}

		for( i = 0; i < 3; ++i)
		{
			if( pSpell->pLearnSpell->Effect[i] == SPELL_EFFECT_SKILL )
			{
				uint32 skill = pSpell->pLearnSpell->EffectMiscValue[i];
				uint32 val = (pSpell->pLearnSpell->EffectBasePoints[i]+1) * 75;
				if( val > 350 )
					val = 350;

				if( _player->_GetSkillLineMax(skill) >= val )
					return;

				if( skill == SKILL_RIDING )
					_player->_AddSkillLine( skill, val, val );
				else
				{
					if( _player->_HasSkillLine(skill) )
						_player->_ModifySkillMaximum(skill, val);
					else
						_player->_AddSkillLine( skill, 1, val);
				}
			}
		}
	}

	if(pSpell->DeleteSpell)
	{
		// Remove old spell.
		if( pSpell->pLearnSpell )
			_player->removeSpell(pSpell->DeleteSpell, true, true, pSpell->pLearnSpell->Id);
		else if(pSpell->pCastSpell)
			_player->removeSpell(pSpell->DeleteSpell, true, true, pSpell->pCastRealSpell->Id);
		else
			_player->removeSpell(pSpell->DeleteSpell,true,false,0);
	}
}
开发者ID:Centraly,项目名称:SummitEmu,代码行数:97,代码来源:NPCHandler.cpp


示例16: CHECK_PACKET_SIZE

// Charter part
void WorldSession::HandleCharterBuy(WorldPacket & recv_data)
{
	CHECK_PACKET_SIZE(recv_data, 8+8+4+1+5*8+2+1+4+4);

	uint64 creature_guid;
	uint64 unk1, unk3, unk4, unk5, unk6, unk7;
	uint32 unk2;
	std::string name;
	uint16 unk8;
	uint8  unk9;
	uint32 arena_index;
	uint32 unk10;

	uint8 error;

	recv_data >> creature_guid;                             // NPC GUID
	recv_data >> unk1;                                      // 0
	recv_data >> unk2;                                      // 0
	recv_data >> name;                                      // name

	// recheck
	CHECK_PACKET_SIZE(recv_data, 8+8+4+(name.size()+1)+5*8+2+1+4+4);

	recv_data >> unk3;                                      // 0
	recv_data >> unk4;                                      // 0
	recv_data >> unk5;                                      // 0
	recv_data >> unk6;                                      // 0
	recv_data >> unk7;                                      // 0
	recv_data >> unk8;                                      // 0
	recv_data >> unk9;                                      // 0
	recv_data >> arena_index;                               // index
	recv_data >> unk10;                                     // 0

	Creature* crt = _player->GetMapMgr()->GetCreature(GET_LOWGUID_PART(creature_guid));
	if(!crt)
	{
		Disconnect();
		return;
	}

	if( arena_index >= NUM_CHARTER_TYPES )
		return;

	if( crt->IsArenaOrganizer() ) // All arena organizers should be allowed to create arena charter's
	{
		uint32 arena_type = arena_index - 1;
		if(arena_type > 2)
			return;

		if(_player->m_playerInfo->arenaTeam[arena_type])
		{
			SendNotification("You are already in an arena team.");
			return;
		}

		if(_player->m_playerInfo->charterId[arena_index] != 0)
		{
			SendNotification("You already have an arena charter of this type.");
			return;
		}

		ArenaTeam * t = objmgr.GetArenaTeamByName(name, arena_type);
		if(t != NULL)
		{
			sChatHandler.SystemMessage(this,"That name is already in use.");
			return;
		}

		if(objmgr.GetCharterByName(name, (CharterTypes)arena_index))
		{
			sChatHandler.SystemMessage(this,"That name is already in use.");
			return;
		}

		static uint32 item_ids[] = {ARENA_TEAM_CHARTER_2v2, ARENA_TEAM_CHARTER_3v3, ARENA_TEAM_CHARTER_5v5};
		static uint32 costs[] = {ARENA_TEAM_CHARTER_2v2_COST,ARENA_TEAM_CHARTER_3v3_COST,ARENA_TEAM_CHARTER_5v5_COST};

		if(_player->GetUInt32Value(PLAYER_FIELD_COINAGE) < costs[arena_type] && !sWorld.free_arena_teams)
			return;			// error message needed here

		ItemPrototype * ip = ItemPrototypeStorage.LookupEntry(item_ids[arena_type]);
		ASSERT(ip);
		SlotResult res = _player->GetItemInterface()->FindFreeInventorySlot(ip);
		if(res.Result == 0)
		{
			_player->GetItemInterface()->BuildInventoryChangeError(NULL, NULL, INV_ERR_INVENTORY_FULL);
			return;
		}

		error = _player->GetItemInterface()->CanReceiveItem(ip,1, NULL);
		if(error)
		{
			_player->GetItemInterface()->BuildInventoryChangeError(NULL,NULL,error);
		}
		else
		{
			// Create the item and charter
			Item* i = objmgr.CreateItem(item_ids[arena_type], _player);
			Charter * c = objmgr.CreateCharter(_player->GetLowGUID(), (CharterTypes)arena_index);
//.........这里部分代码省略.........
开发者ID:arcticdev,项目名称:arctic-test,代码行数:101,代码来源:GuildHandler.cpp


示例17: HandleTrainerBuySpellOpcode

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GET_LOW_WORD函数代码示例发布时间:2022-05-30
下一篇:
C++ GET_LOCK函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap