您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ GET_LOWGUID_PART函数代码示例

51自学网 2021-06-01 20:51:27
  C++
这篇教程C++ GET_LOWGUID_PART函数代码示例写得很实用,希望能帮到您。

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

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


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例12: GET_TYPE_FROM_GUID

/*Loot type MUST be1-corpse, go2-skinning/herbalism/minning3-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,


示例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,


示例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,


示例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,


示例16: CHECK_PACKET_SIZE

// Charter partvoid 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,


示例17: HandleTrainerBuySpellOpcode

void WorldSession::HandleTrainerBuySpellOpcode(WorldPacket& recvPacket){	if(!_player->IsInWorld()) return;    ////////////////////////////////////////////////////////////////////////////////    // As of 3.1.3 the client sends this when buying a spell    //    // {CLIENT} Packet: (0x01B2) CMSG_TRAINER_BUY_SPELL PacketSize = 12 TimeStamp = 39035859    // A0 85 00 06 7A 00 30 F1 2D 85 00 00     //    // Structure:    // uint64 GUID     - GUID of the trainer    // uint32 spellid  - ID of the spell being bought    ////////////////////////////////////////////////////////////////////////////////	uint64 Guid;	uint32 TeachingSpellID;	recvPacket >> Guid >> TeachingSpellID;	Creature *pCreature = _player->GetMapMgr()->GetCreature(GET_LOWGUID_PART(Guid));	/////////////////////////////////////////// Checks //////////////////////////////////////        if(pCreature == NULL) return;	Trainer *pTrainer = pCreature->GetTrainer();	if(pTrainer == NULL || !CanTrainAt(_player, pTrainer)) return;    // Check if the trainer offers that spell	TrainerSpell * pSpell = NULL;	for(vector<TrainerSpell>::iterator itr = pTrainer->Spells.begin(); itr != pTrainer->Spells.end(); ++itr)	{		if( ( itr->pCastSpell && itr->pCastSpell->Id == TeachingSpellID ) ||			( itr->pLearnSpell && itr->pLearnSpell->Id == TeachingSpellID ) )		{			pSpell = &(*itr);		}	}	    // If the trainer doesn't offer it, this is probably some packet mangling    if(pSpell == NULL){        // Disconnecting the player        this->Disconnect();		return;    }    // We can't learn it	if(TrainerGetSpellStatus(pSpell) > 0)         return;//////////////////////////////////////////// Teaching ////////////////////////////////////		_player->ModUnsigned32Value(PLAYER_FIELD_COINAGE, -(int32)pSpell->Cost);	if( pSpell->pCastSpell)	{        _player->CastSpell( _player, pSpell->pCastSpell->Id, true );    }    else	{/////////////////////////////////////// Showing the learning spellvisuals//////////////            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( SMSG_PLAY_SPELL_IMPACT, sizeof(packetSMSG_PLAY_SPELL_VISUAL), &pck, true );///////////////////////////////////////////////////////////////////////////////////////                // add the spell itself		_player->addSpell( pSpell->pLearnSpell->Id );    }	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);	}	_player->_UpdateSkillFields();    /////////////////////////////////////////////////////////////////////////////////    // As of 3.1.3 this is sent after buying the spell    //     //    // {SERVER} Packet: (0x01B3) SMSG_TRAINER_BUY_SUCCEEDED PacketSize = 12 TimeStamp = 39035968    // A0 85 00 06 7A 00 30 F1 2D 85 00 00     //     // structure:    ////.........这里部分代码省略.........
开发者ID:xiaofeng,项目名称:Arcemu,代码行数:101,


示例18: data

void LootRoll::Finalize(){	if( !mLootLock.AttemptAcquire() ) // only one finalization, please. players on different maps can roll, too, so this is needed.	{		sEventMgr.RemoveEvents(this);		return;	}	sEventMgr.RemoveEvents(this);	// this we will have to finalize with groups types.. for now	// we'll just assume need before greed. person with highest roll	// in need gets the item.	uint32 highest = 0;	int8 hightype = -1;	uint64 player = 0;	WorldPacket data(34);	for(std::map<uint32, uint32>::iterator itr = m_NeedRolls.begin(); itr != m_NeedRolls.end(); itr++)	{		if(itr->second > highest)		{			highest = itr->second;			player = itr->first;			hightype = NEED;		}	}	if(!highest)	{		for(std::map<uint32, uint32>::iterator itr = m_GreedRolls.begin(); itr != m_GreedRolls.end(); itr++)		{			if(itr->second > highest)			{				highest = itr->second;				player = itr->first;				hightype = GREED;			}		}	}	Loot * pLoot = 0;	uint32 guidtype = GET_TYPE_FROM_GUID(_guid);	if( guidtype == HIGHGUID_TYPE_UNIT )	{		Creature* pc = _mgr->GetCreature(GET_LOWGUID_PART(_guid));		if(pc) pLoot = &pc->m_loot;	}	else if( guidtype == HIGHGUID_TYPE_GAMEOBJECT )	{		GameObject* go = _mgr->GetGameObject(GET_LOWGUID_PART(_guid));		if(go) pLoot = &go->m_loot;	}	if(!pLoot)	{		delete this;		return;	}	if(_slotid >= pLoot->items.size())	{		delete this;		return;	}	pLoot->items.at(_slotid).roll = NULL;	uint32 itemid = pLoot->items.at(_slotid).item.itemproto->ItemId;	uint32 amt = pLoot->items.at(_slotid).iItemsCount;	if(!amt)	{		delete this;		return;	}	Player* _player = (player) ? _mgr->GetPlayer((uint32)player) : NULL;	if(!player || !_player)	{		/* all passed */		data.Initialize(SMSG_LOOT_ALL_PASSED);		data << _guid << _groupcount << _itemid << _randomsuffixid << _randompropertyid;		set<uint32>::iterator pitr = m_passRolls.begin();		while(_player == NULL && pitr != m_passRolls.end())			_player = _mgr->GetPlayer( (*(pitr++)) );		if( _player != NULL )		{			if(_player->InGroup())				_player->GetGroup()->SendPacketToAll(&data);			else				_player->GetSession()->SendPacket(&data);		}		/* item can now be looted by anyone :) */		pLoot->items.at(_slotid).passed = true;		delete this;		return;//.........这里部分代码省略.........
开发者ID:Refuge89,项目名称:Arc_Mind,代码行数:101,


示例19: GET_TYPE_FROM_GUID

///////////////////////////////////////////////////////////////// This function handles CMSG_GOSSIP_SELECT_OPTION://////////////////////////////////////////////////////////////void WorldSession::HandleGossipSelectOptionOpcode( WorldPacket & recv_data ){	if(!_player->IsInWorld()) return;	//WorldPacket data;	uint32 option;	uint32 unk24;	uint64 guid;	int8 extra=0;	recv_data >> guid >> unk24 >> option;	sLog.outDetail("WORLD: CMSG_GOSSIP_SELECT_OPTION Option %i Guid %.8X", option, guid );	GossipScript * Script= NULL;	Object * qst_giver= NULL;	uint32 guidtype = GET_TYPE_FROM_GUID(guid);	if(guidtype==HIGHGUID_TYPE_UNIT)	{		Creature *crt = _player->GetMapMgr()->GetCreature(GET_LOWGUID_PART(guid));		if(!crt)			return;		qst_giver=crt;		Script=crt->GetCreatureInfo()?crt->GetCreatureInfo()->gossip_script:NULL;	}	else if(guidtype==HIGHGUID_TYPE_ITEM)	{		Item * pitem = _player->GetItemInterface()->GetItemByGUID(guid);		if(pitem== NULL)			return;		qst_giver=pitem;		Script=pitem->GetProto()->gossip_script;	}	else if(guidtype==HIGHGUID_TYPE_GAMEOBJECT)	{        GameObject *gobj = _player->GetMapMgr()->GetGameObject(GET_LOWGUID_PART(guid));		if(!gobj)			return;        		qst_giver=gobj;        Script=gobj->GetInfo()->gossip_script;    }	if(!Script||!qst_giver)		return;	uint32 IntId = 1;	if(_player->CurrentGossipMenu)	{		GossipMenuItem item = _player->CurrentGossipMenu->GetItem(option);		IntId = item.IntId;		extra = item.Extra;	}	if(extra)	{		string str;		if(recv_data.rpos()!=recv_data.wpos())			recv_data >> str;		Script->GossipSelectOption(qst_giver, _player, option, IntId, str.c_str());	}	else
开发者ID:xiaofeng,项目名称:Arcemu,代码行数:67,


示例20: SystemMessage

bool ChatHandler::HandleWPAddCommand(const char* args, WorldSession *m_session){    uint64 guid = m_session->GetPlayer()->GetSelection();    if (guid == 0)    {        SystemMessage(m_session, "No Selection");        return true;    }    AIInterface* ai = NULL;    Creature* pCreature = NULLCREATURE;    Player* p = m_session->GetPlayer();    if(p->waypointunit != NULL)    {        SystemMessage(m_session, "Using Previous Unit.");        ai = p->waypointunit;        if(!ai)        {            SystemMessage(m_session, "Invalid Creature, please select another one.");            return true;        }        pCreature = TO_CREATURE(ai->GetUnit());        if(!pCreature)        {            SystemMessage(m_session, "Invalid Creature, please select another one.");            return true;        }    }    else    {        pCreature = m_session->GetPlayer()->GetMapMgr()->GetCreature(GET_LOWGUID_PART(guid));        if(!pCreature)        {            SystemMessage(m_session, "You should select a creature.");            return true;        }        if( pCreature->m_spawn == NULL )        {            SystemMessage(m_session, "You cannot add waypoints to a creature that is not saved.");            return true;        }        ai = pCreature->GetAIInterface();    }    char* pWaitTime = strtok((char*)args, " ");    uint32 WaitTime = (pWaitTime)? atoi(pWaitTime) : 10000;    char* pFlags = strtok(NULL, " ");    uint32 Flags = (pFlags)? atoi(pFlags) : 0 ;    char* pForwardEmoteId = strtok(NULL, " ");    uint32 ForwardEmoteId = (pForwardEmoteId)? atoi(pForwardEmoteId) : 0;    char* pBackwardEmoteId = strtok(NULL, " ");    uint32 BackwardEmoteId = (pBackwardEmoteId)? atoi(pBackwardEmoteId) : 0;    char* pForwardSkinId = strtok(NULL, " ");    uint32 ForwardSkinId = (pForwardSkinId)? atoi(pForwardSkinId) : pCreature->GetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID);    char* pBackwardSkinId = strtok(NULL, " ");    uint32 BackwardSkinId = (pBackwardSkinId)? atoi(pBackwardSkinId) : pCreature->GetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID);    char* pForwardEmoteOneShot = strtok(NULL, " ");    uint32 ForwardEmoteOneShot = (pForwardEmoteOneShot)? atoi(pForwardEmoteOneShot) : 1;    char* pBackwardEmoteOneShot = strtok(NULL, " ");    uint32 BackwardEmoteOneShot = (pBackwardEmoteOneShot)? atoi(pBackwardEmoteOneShot) : 1;    char* pForwardStandState = strtok(NULL, " ");    uint32 ForwardStandState = (pForwardStandState)? atoi(pForwardStandState) : 0;    char* pBackwardStandState = strtok(NULL, " ");    uint32 BackwardStandState = (pBackwardStandState)? atoi(pBackwardStandState) : 0;    char* pForwardSpellToCast = strtok(NULL, " ");    uint32 ForwardSpellToCast = (pForwardSpellToCast)? atoi(pForwardSpellToCast) : 0;    char* pBackwardSpellToCast = strtok(NULL, " ");    uint32 BackwardSpellToCast = (pBackwardSpellToCast)? atoi(pBackwardSpellToCast) : 0;    WayPoint* wp = new WayPoint;    bool showing = ai->WayPointsShowing();    wp->id = (uint32)ai->GetWayPointsCount()+1;    wp->x = p->GetPositionX();    wp->y = p->GetPositionY();    wp->z = p->GetPositionZ();    wp->orientation = p->GetOrientation();    wp->waittime = WaitTime;    wp->flags = Flags;    wp->forwardInfo = new ConditionalData(((ForwardEmoteOneShot > 0) ? true : false), ForwardEmoteId, ForwardSkinId, (ForwardStandState > 8 ? 0 : ForwardStandState), ForwardSpellToCast, "");    if(wp->forwardInfo->EmoteID == 0        && wp->forwardInfo->SkinID == 0        && wp->forwardInfo->StandState == 0        && wp->forwardInfo->SpellToCast == 0        && wp->forwardInfo->SayText.length() == 0)    {        delete wp->forwardInfo;        wp->forwardInfo = NULL;    }    wp->backwardInfo = new ConditionalData(((BackwardEmoteOneShot > 0) ? true : false), BackwardEmoteId, BackwardSkinId, (BackwardStandState > 8 ? 0 : BackwardStandState), BackwardSpellToCast, "");    if(wp->backwardInfo->EmoteID == 0        && wp->backwardInfo->SkinID == 0        && wp->backwardInfo->StandState == 0        && wp->backwardInfo->SpellToCast == 0        && wp->backwardInfo->SayText.length() == 0)    {        delete wp->backwardInfo;//.........这里部分代码省略.........
开发者ID:Sandshroud,项目名称:Sandshroud-Prodigy,代码行数:101,


示例21: HandleTrainerBuySpellOpcode

void WorldSession::HandleTrainerBuySpellOpcode(WorldPacket& recvPacket){	CHECK_INWORLD_RETURN;	uint64 Guid;	uint32 TeachingSpellID;	recvPacket >> Guid >> TeachingSpellID;	Creature* pCreature = _player->GetMapMgr()->GetCreature(GET_LOWGUID_PART(Guid));	if(pCreature == NULL)		return;	Trainer *pTrainer = pCreature->GetTrainer();	if(pTrainer == NULL || !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( SMSG_PLAY_SPELL_IMPACT, 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);	}	/////////////////////////////////////////////////////////////////////////////////	// As of 3.1.3 this is sent after buying the spell//.........这里部分代码省略.........
开发者ID:arcticdev,项目名称:arctic-test,代码行数:101,


示例22: HandleGossipHelloOpcode

void WorldSession::HandleGossipHelloOpcode( WorldPacket & recv_data ){	CHECK_INWORLD_RETURN;	uint64 guid;	list<QuestRelation *>::iterator it;	std::set<uint32> ql;	recv_data >> guid;	Creature* TalkingWith = _player->GetMapMgr()->GetCreature(GET_LOWGUID_PART(guid));	if(!TalkingWith) 		return;	//stop when talked to for 3 min	if(TalkingWith->GetAIInterface())		TalkingWith->GetAIInterface()->StopMovement(180000);	// unstealth meh	if( _player->InStealth() )		_player->RemoveAllAurasOfType( SPELL_AURA_MOD_STEALTH );	// reputation	_player->Reputation_OnTalk(TalkingWith->m_factionDBC);	DEBUG_LOG( "WORLD"," Received CMSG_GOSSIP_HELLO from %u",GUID_LOPART(guid) );	GossipScript * Script = TalkingWith->GetCreatureInfo() ? TalkingWith->GetCreatureInfo()->gossip_script : NULL;	if(!Script)		return;	if (TalkingWith->isQuestGiver() && TalkingWith->HasQuests())	{		WorldPacket data;		data.SetOpcode(SMSG_GOSSIP_MESSAGE);		Script->GossipHello(TalkingWith, _player, false);		if(!_player->CurrentGossipMenu)			return;		_player->CurrentGossipMenu->BuildPacket(data);		uint32 count=0;//sQuestMgr.ActiveQuestsCount(TalkingWith, GetPlayer());		size_t pos=data.wpos();		data << uint32(count);		for (it = TalkingWith->QuestsBegin(); it != TalkingWith->QuestsEnd(); ++it)		{			uint32 status = sQuestMgr.CalcQuestStatus(TalkingWith, GetPlayer(), *it);			if (status >= QMGR_QUEST_CHAT)			{				if (!ql.count((*it)->qst->id) )				{						ql.insert((*it)->qst->id);					count++;					data << (*it)->qst->id;					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;					}						data << (*it)->qst->title;				}			}		}		data.wpos(pos);		data << count;		SendPacket(&data);		DEBUG_LOG( "WORLD"," Sent SMSG_GOSSIP_MESSAGE" );	}	else	{		Script->GossipHello(TalkingWith, _player, true);	}}
开发者ID:arcticdev,项目名称:arctic-test,代码行数:83,


示例23: 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)		return;	// Find Item	AuctionHouse * ah = pCreature->auctionHouse;	Auction * auct = ah->GetAuction(auction_id);	if(auct == 0 || !auct->Owner || !_player)	{		SendAuctionPlaceBidResultPacket(0, AUCTION_ERROR_INTERNAL);		return;	}	if(auct->Owner == _player->GetGUID())	{		SendAuctionPlaceBidResultPacket(0, AUCTION_ERROR_BID_OWN_AUCTION);		return;	}	if(auct->HighestBid > price && price != auct->BuyoutPrice)	{		//HACK: Don't know the correct error code... 		SendAuctionPlaceBidResultPacket(0, AUCTION_ERROR_INTERNAL);		return;	}	if(_player->GetUInt32Value(PLAYER_FIELD_COINAGE) < price)	{		SendAuctionPlaceBidResultPacket(0, AUCTION_ERROR_MONEY);		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);		// 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, AUCTION_ERROR_NONE);		ah->SendAuctionBuyOutNotificationPacket(auct);	}	else	{		// update most recent bid		auct->HighestBidder = _player->GetLowGUID();		auct->HighestBid = price;		auct->UpdateInDB();		SendAuctionPlaceBidResultPacket(auct->Id, AUCTION_ERROR_NONE);	}}
开发者ID:Chero,项目名称:abcwow,代码行数:76,


示例24: DEBUG_LOG

void WorldSession::HandleGossipSelectOptionOpcode( WorldPacket & recv_data ){	CHECK_INWORLD_RETURN;	//WorldPacket data;	uint32 option;	uint32 unk24;	uint64 guid;	bool Coded = false;	uint32 BoxMoney = 0;	std::string BoxMessage;	recv_data >> guid >> unk24 >> option;	DEBUG_LOG("WORLD","CMSG_GOSSIP_SELECT_OPTION Option %i Guid %.8X", option, guid );	GossipScript * Script = NULL;	Object* qst_giver = NULL;	uint32 guidtype = GET_TYPE_FROM_GUID(guid);	if(guidtype==HIGHGUID_TYPE_UNIT)	{		Creature* crt = _player->GetMapMgr()->GetCreature(GET_LOWGUID_PART(guid));		if(!crt)			return;		qst_giver=crt;		Script=crt->GetCreatureInfo()?crt->GetCreatureInfo()->gossip_script:NULL;	}	else if(guidtype==HIGHGUID_TYPE_ITEM)	{		Item* pitem = _player->GetItemInterface()->GetItemByGUID(guid);		if(pitem==NULL)			return;		qst_giver=pitem;		Script=pitem->GetProto()->gossip_script;	}	else if(guidtype==HIGHGUID_TYPE_GAMEOBJECT)	{		GameObject* gobj = _player->GetMapMgr()->GetGameObject(GET_LOWGUID_PART(guid));		if(!gobj)			return;		qst_giver=gobj;		Script=gobj->GetInfo()->gossip_script;	}	if(!Script||!qst_giver)		return;	uint32 IntId = 1;	if(_player->CurrentGossipMenu)	{		GossipMenuItem item = _player->CurrentGossipMenu->GetItem(option);		IntId = item.IntId;		Coded = item.Coded;	}	if(Coded)	{		if(recv_data.rpos()!=recv_data.wpos())			recv_data >> BoxMessage;		Script->GossipSelectOption(qst_giver, _player, option, IntId, BoxMessage.c_str());	}	else
开发者ID:arcticdev,项目名称:arctic-test,代码行数:65,


示例25: SystemMessage

bool ChatHandler::HandleWaypointAddFlyCommand(const char * args, WorldSession * m_session){	uint64 guid = m_session->GetPlayer()->GetSelection();	if (guid == 0)	{		SystemMessage(m_session, "No Selection");		return true;	}	AIInterface* ai = NULL;	Creature* pCreature = NULL;	Player* p = m_session->GetPlayer();	if(p->waypointunit != NULL)	{		SystemMessage(m_session, "Using Previous Unit.");		ai = p->waypointunit;		if(!ai)		{			SystemMessage(m_session, "Invalid Creature, please select another one.");			return true;		}		pCreature = TO_CREATURE(ai->GetUnit());		if(!pCreature)		{			SystemMessage(m_session, "Invalid Creature, please select another one.");			return true;		}	}	else	{		pCreature = m_session->GetPlayer()->GetMapMgr()->GetCreature(GET_LOWGUID_PART(guid));		if(!pCreature)		{			SystemMessage(m_session, "You should select a creature.");			return true;		}		ai = pCreature->GetAIInterface();	}	char* pWaitTime = strtok((char*)args, " ");	uint32 WaitTime = (pWaitTime)? atoi(pWaitTime) : 0;	char* pForwardEmoteId = strtok(NULL, " ");	uint32 ForwardEmoteId = (pForwardEmoteId)? atoi(pForwardEmoteId) : 0;	char* pBackwardEmoteId = strtok(NULL, " ");	uint32 BackwardEmoteId = (pBackwardEmoteId)? atoi(pBackwardEmoteId) : 0;	char* pForwardSkinId = strtok(NULL, " ");	uint32 ForwardSkinId = (pForwardSkinId)? atoi(pForwardSkinId) : pCreature->GetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID);	char* pBackwardSkinId = strtok(NULL, " ");	uint32 BackwardSkinId = (pBackwardSkinId)? atoi(pBackwardSkinId) : pCreature->GetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID);	char* pForwardEmoteOneShot = strtok(NULL, " ");	uint32 ForwardEmoteOneShot = (pForwardEmoteOneShot)? atoi(pForwardEmoteOneShot) : 1;	char* pBackwardEmoteOneShot = strtok(NULL, " ");	uint32 BackwardEmoteOneShot = (pBackwardEmoteOneShot)? atoi(pBackwardEmoteOneShot) : 1;	char* pForwardStandState = strtok(NULL, " ");	uint32 ForwardStandState = (pForwardStandState)? atoi(pForwardStandState) : 0;	char* pBackwardStandState = strtok(NULL, " ");	uint32 BackwardStandState = (pBackwardStandState)? atoi(pBackwardStandState) : 0;	char* pForwardSpellToCast = strtok(NULL, " ");	uint32 ForwardSpellToCast = (pForwardSpellToCast)? atoi(pForwardSpellToCast) : 0;	char* pBackwardSpellToCast = strtok(NULL, " ");	uint32 BackwardSpellToCast = (pBackwardSpellToCast)? atoi(pBackwardSpellToCast) : 0;	WayPoint* wp = new WayPoint;	bool showing = ai->m_WayPointsShowing;	wp->id = (uint32)ai->GetWayPointsCount()+1;	wp->x = p->GetPositionX();	wp->y = p->GetPositionY();	wp->z = p->GetPositionZ();	wp->o = p->GetOrientation();	wp->waittime = WaitTime;	wp->flags = 768;	wp->forwardemoteoneshot = (ForwardEmoteOneShot>0)?true:false;	wp->forwardemoteid = ForwardEmoteId;	wp->backwardemoteoneshot = (BackwardEmoteOneShot>0)?true:false;	wp->backwardemoteid = BackwardEmoteId;	wp->forwardskinid = ForwardSkinId;	wp->backwardskinid = BackwardSkinId;	wp->forwardStandState = ForwardStandState > 8 ? 0 : ForwardStandState ;	wp->backwardStandState = BackwardStandState > 8 ? 0 : BackwardStandState ;	wp->forwardSpellToCast = ForwardSpellToCast;	wp->backwardSpellToCast = BackwardSpellToCast;	wp->forwardSayText = "";	wp->backwardSayText = "";	if(showing)		ai->hideWayPoints(p);	ai->addWayPoint(wp);	ai->saveWayPoints();	if(showing)		ai->showWayPoints(p,ai->m_WayPointsShowBackwards);	SystemMessage(m_session, "Waypoint %u added.", wp->id);	return true;}
开发者ID:Ballwinkle,项目名称:Ascent_NG,代码行数:96,


示例26: HandleCharterBuy

// Charter partvoid WorldSession::HandleCharterBuy(WorldPacket & recv_data){	/*	{CLIENT} Packet: (0x01BD) CMSG_PETITION_BUY PacketSize = 85	|------------------------------------------------|----------------|	|00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F |0123456789ABCDEF|	|------------------------------------------------|----------------|	|50 91 00 00 6E 13 01 F0 00 00 00 00 00 00 00 00 |P...n...........|	|00 00 00 00 53 74 6F 72 6D 62 72 69 6E 67 65 72 |....Stormbringer|	|73 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |s...............|	|00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|	|00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 |................|	|00 00 00 00 00								  |.....		   |	-------------------------------------------------------------------	*/	if(!_player->IsInWorld())		return;	uint64 creature_guid;	uint64 crap;	uint32 crap2;	string name;    uint8 error;	uint32 crap3,crap4,crap5,crap6,crap7,crap8,crap9,crap10,crap11,arena_index,crap12;	uint16 crap13;	uint8 crap14;	uint32 crap15;	recv_data >> creature_guid >> crap >> crap2 >> name;	recv_data >> crap3 >> crap4 >> crap5 >> crap6 >> crap7 >> crap8 >> crap9 >> crap10 >> crap11		>> crap12 >> crap13 >> crap14 >> arena_index >> crap15;	Creature * crt = _player->GetMapMgr()->GetCreature(GET_LOWGUID_PART(creature_guid));	if(!crt)	{		Disconnect();		return;	}	if(crt->GetEntry()==19861 || crt->GetEntry()==18897 || crt->GetEntry()==19856 || crt->GetEntry()==sWorld.m_CustomCharterGiver )		/* i am lazy! */	{		uint32 arena_type = arena_index - 1;		if(arena_type > 2)			return;		if(_player->m_arenaTeams[arena_type] || _player->m_charters[arena_index])		{			SendNotification(_player->GetSession()->LocalizedWorldSrv(71));			return;		}		ArenaTeam * t = objmgr.GetArenaTeamByName(name, arena_type);		if(t != NULL)		{			sChatHandler.SystemMessage(this,_player->GetSession()->LocalizedWorldSrv(72));			return;		}		if(objmgr.GetCharterByName(name, (CharterTypes)arena_index))		{			sChatHandler.SystemMessage(this,_player->GetSession()->LocalizedWorldSrv(72));			return;		}		if(_player->m_charters[arena_type])		{			SendNotification(_player->GetSession()->LocalizedWorldSrv(73));			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])			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(0, 0, INV_ERR_INVENTORY_FULL);			return;		}		error = _player->GetItemInterface()->CanReceiveItem(ip,1);		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);			c->GuildName = name;			c->ItemGuid = i->GetGUID();			i->SetUInt32Value(ITEM_FIELD_STACK_COUNT, 1);//.........这里部分代码省略.........
开发者ID:Naqvamp,项目名称:Sandbox,代码行数:101,



注:本文中的GET_LOWGUID_PART函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ GET_LOW_WORD函数代码示例
C++ GET_LOCK函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。