本文整理汇总了C++中PlayerObject::getCraftingSession方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerObject::getCraftingSession方法的具体用法?C++ PlayerObject::getCraftingSession怎么用?C++ PlayerObject::getCraftingSession使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerObject
的用法示例。
在下文中一共展示了PlayerObject::getCraftingSession方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleCreatePrototype
bool CraftingManager::HandleCreatePrototype(Object* object, Object* target,Message* message, ObjectControllerCmdProperties* cmdProperties)
{
PlayerObject* player = dynamic_cast<PlayerObject*>(object);
CraftingSession* session = player->getCraftingSession();
BString dataStr;
uint32 mode,counter;
if(!session)
return false;
message->getStringUnicode16(dataStr);
if(swscanf(dataStr.getUnicode16(),L"%u %u",&counter,&mode) != 2)
{
gCraftingSessionFactory->destroySession(player->getCraftingSession());
return false;
}
session->createPrototype(mode,counter);
return true;
}
示例2: HandleCreateManufactureSchematic
bool CraftingManager::HandleCreateManufactureSchematic(Object* object, Object* target,Message* message, ObjectControllerCmdProperties* cmdProperties)
{
PlayerObject* player = dynamic_cast<PlayerObject*>(object);
CraftingSession* session = player->getCraftingSession();
BString dataStr;
uint32 counter;
if(!session)
return false;
message->getStringUnicode16(dataStr);
if(swscanf(dataStr.getUnicode16(),L"%u",&counter) != 1)
{
gCraftingSessionFactory->destroySession(player->getCraftingSession());
return false;
}
//gLogger->hexDump(message->getData(),message->getSize());
session->createManufactureSchematic(counter);
return true;
}
示例3: HandleCancelCraftingSession
bool CraftingManager::HandleCancelCraftingSession(Object* object,Object* target,Message* message,ObjectControllerCmdProperties* cmdProperties)
{
PlayerObject* playerObject = dynamic_cast<PlayerObject*>(object);
message->setIndex(24);
/*uint32 counter = */
message->getUint32();
gCraftingSessionFactory->destroySession(playerObject->getCraftingSession());
//client complains over crafting tool already having an item when we go out of the slot screen!!!!!
return true;
}
示例4: handleCraftExperiment
void CraftingManager::handleCraftExperiment(Object* object, Message* message)
{
PlayerObject* player = dynamic_cast<PlayerObject*>(object);
CraftingSession* session = player->getCraftingSession();
uint8 counter = message->getUint8();
uint32 propCount = message->getUint32();
std::vector<std::pair<uint32,uint32> > properties;
if(!session || player->getCraftingStage() != 3)
return;
for(uint32 i = 0; i < propCount; i++)
properties.push_back(std::make_pair(message->getUint32(),message->getUint32()));
session->experiment(counter,properties);
}
示例5: handleCraftCustomization
void CraftingManager::handleCraftCustomization(Object* object,Message* message)
{
PlayerObject* player = dynamic_cast<PlayerObject*>(object);
CraftingSession* session = player->getCraftingSession();
BString itemName;
uint8 hmmm1,hmmm2;
uint32 amount,color;
if(!session)
return;
player->setCraftingStage(4);
message->getStringUnicode16(itemName);
itemName.convert(BSTRType_ANSI);
message->getUint8(hmmm1);
message->getUint32(amount);
message->getUint8(hmmm2);
CustomizationList* cList;
cList = session->getManufacturingSchematic()->getCustomizationList();
CustomizationList::iterator custIt = cList->begin();
uint32 i = 0;
while((custIt != cList->end())&&(i < hmmm2))
{
message->getUint32(color);
message->getUint32(color);
session->getItem()->setCustomization(static_cast<uint8>((*custIt)->cutomizationIndex),(uint16)color,3);
i++;
++custIt;
}
int8 sql[550];
sprintf(sql, "INSERT INTO item_customization VALUES (%"PRIu64", %u, %u)",session->getItem()->getId(), session->getItem()->getCustomization(1), session->getItem()->getCustomization(2));
mDatabase->executeAsyncSql(sql);
session->setProductionAmount(amount);
session->customize(itemName.getAnsi());
}
示例6: handleCraftEmptySlot
void CraftingManager::handleCraftEmptySlot(Object* object,Message* message)
{
PlayerObject* player = dynamic_cast<PlayerObject*>(object);
CraftingSession* session = player->getCraftingSession();
uint32 slotId = message->getUint32();
uint64 containerId = message->getUint64();
uint8 counter = message->getUint8();
// make sure we have a valid session and are in the assembly stage
if(session && player->getCraftingStage() == 2)
{
session->handleEmptySlot(slotId,containerId,counter);
}
// it failed
else
{
gMessageLib->sendCraftAcknowledge(opCraftEmptySlot,CraftError_Not_In_Assembly_Stage,counter,player);
}
}
示例7: HandleSelectDraftSchematic
bool CraftingManager::HandleSelectDraftSchematic(Object* object,Object* target,Message* message,ObjectControllerCmdProperties* cmdProperties)
{
PlayerObject* playerObject = dynamic_cast<PlayerObject*>(object);
CraftingSession* session = playerObject->getCraftingSession();
//DraftSchematic* schematic = NULL;
BString dataStr;
uint32 schematicIndex = 0;
message->getStringUnicode16(dataStr);
if(session)
{
if(swscanf(dataStr.getUnicode16(),L"%u",&schematicIndex) != 1 || !session->selectDraftSchematic(schematicIndex))
{
gCraftingSessionFactory->destroySession(session);
}
}
return true;
}
示例8: _handleGetAttributesBatch
void ObjectController::_handleGetAttributesBatch(uint64 targetId,Message* message,ObjectControllerCmdProperties* cmdProperties)
{
PlayerObject* playerObject = dynamic_cast<PlayerObject*>(mObject);
BString requestStr;
BStringVector dataElements;
BStringVector dataElements2;
uint16 elementCount;
message->getStringUnicode16(requestStr);
requestStr.convert(BSTRType_ANSI);
requestStr.getRawData()[requestStr.getLength()] = 0;
elementCount = requestStr.split(dataElements,' ');
if(!elementCount)
{
return;
}
Message* newMessage;
for(uint16 i = 0; i < elementCount; i++)
{
uint64 itemId = boost::lexical_cast<uint64>(dataElements[i].getAnsi());
Object* object = gWorldManager->getObjectById(itemId);
if(object == NULL)
{
// could be a resource
Resource* resource = gResourceManager->getResourceById(itemId);
if(resource != NULL)
{
resource->sendAttributes(playerObject);
continue;
}
//could be a schematic!
Datapad* datapad = playerObject->getDataPad();
ManufacturingSchematic* schem = datapad->getManufacturingSchematicById(itemId);
if(schem != NULL)
{
schem->sendAttributes(playerObject);
continue;
}
MissionObject* mission = datapad->getMissionById(itemId);
if(mission != NULL)
{
mission->sendAttributes(playerObject);
continue;
}
IntangibleObject* data = datapad->getDataById(itemId);
if(data != NULL)
{
data->sendAttributes(playerObject);
continue;
}
// TODO: check our datapad items
if(playerObject->isConnected())
{
// default reply for schematics
gMessageFactory->StartMessage();
gMessageFactory->addUint32(opAttributeListMessage);
gMessageFactory->addUint64(itemId);
gMessageFactory->addUint32(0);
//gMessageFactory->addUint16(0);
//gMessageFactory->addUint32(40);
newMessage = gMessageFactory->EndMessage();
(playerObject->getClient())->SendChannelAUnreliable(newMessage, playerObject->getAccountId(), CR_Client, 8);
}
//finally, when we are crafting this could be the new item, not yet added to the worldmanager??
if(playerObject->getCraftingSession())
{
if(playerObject->getCraftingSession()->getItem()&&playerObject->getCraftingSession()->getItem()->getId() == itemId)
{
playerObject->getCraftingSession()->getItem()->sendAttributes(playerObject);
}
}
}
else
{
// Tutorial: I (Eru) have to do some hacks here, since I don't know how to get the info of what object the client has selected (by single click) in the Inventory.
if (gWorldConfig->isTutorial())
{
// Let's see if the actual object is the food item "Melon" in our inventory.
if (dynamic_cast<Inventory*>(playerObject->getEquipManager()->getEquippedObject(CreatureEquipSlot_Inventory))->getId() == object->getParentId())
{
//uint64 id = object->getId();
// Is it an Item?
Item* item = dynamic_cast<Item*>(object);
//.........这里部分代码省略.........
示例9: HandleNextCraftingStage
bool CraftingManager::HandleNextCraftingStage(Object* object, Object* target,Message* message, ObjectControllerCmdProperties* cmdProperties)
{
PlayerObject* playerObject = dynamic_cast<PlayerObject*>(object);
CraftingSession* session = playerObject->getCraftingSession();
BString dataStr;
uint32 counter = 1;
if(!session)
return false;
message->getStringUnicode16(dataStr);
if(dataStr.getLength() == 0)
{
//Command Line Entry
counter = session->getCounter();
}
else
{
uint32 resultCount = swscanf(dataStr.getUnicode16(),L"%u",&counter);
if(resultCount != 1)
{
gCraftingSessionFactory->destroySession(session);
return false;
}
}
switch(session->getStage())
{
case 1:
{
//Player's Macro is wrong! :p
}
break;
case 2:
{
session->assemble(counter);
}
break;
case 3:
{
session->experimentationStage(counter);
}
break;
case 4:
{
session->customizationStage(counter);
//session->creationStage(counter);
}
break;
case 5:
{
session->creationStage(counter);
}
break;
default:
{
}
break;
}
return true;
}