本文整理汇总了C++中CItem::Convert方法的典型用法代码示例。如果您正苦于以下问题:C++ CItem::Convert方法的具体用法?C++ CItem::Convert怎么用?C++ CItem::Convert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CItem
的用法示例。
在下文中一共展示了CItem::Convert方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GiveBuyItemToInventory
BOOL CCashShop::GiveBuyItemToInventory(LPOBJ lpObj, int iItemGuid)
{
BYTE btPosition = 0;
BYTE btResult = 0;
BOOL bEmptySpace = FALSE;
CASHSHOP_ITEMLIST* lpItemInfo = NULL;
CItem pItem;
int iItemCode = 0;
BYTE ExOption[MAX_EXOPTION_SIZE];
lpItemInfo = this->SearchItemList(iItemGuid);
iItemCode = ITEMGET(lpItemInfo->btItemType, lpItemInfo->wItemIndex);
bEmptySpace = this->CheckInventoryEmptySpace(lpObj, lpItemInfo);
if ( bEmptySpace == FALSE )
return FALSE;
pItem.Convert(iItemCode, lpItemInfo->btItemSkillOpion, lpItemInfo->btItemLuckOption, lpItemInfo->btItemAddOption,
lpItemInfo->btItemExOption, 0, 0, NULL, 0xFF, TEMP_PERIOD_VAR, CURRENT_DB_VERSION);
pItem.m_Level = lpItemInfo->btItemLevel;
pItem.m_Durability = lpItemInfo->btItemDuration;
ItemIsBufExOption(ExOption, &pItem);
ItemSerialCreateSend(lpObj->m_Index, 0xEC, lpObj->X, lpObj->Y, pItem.m_Type, pItem.m_Level,
pItem.m_Durability, pItem.m_Option1, pItem.m_Option2, pItem.m_Option3, lpObj->m_Index,
pItem.m_NewOption, 0);
LogAddTD("[CashShop][Buy Item Create in Inven] - User(ID:%s,Name:%s) Item(Name:%s,Code:%d,Skill:%d,Luck:%d,Add:%d,Ex(%d:%d:%d:%d:%d:%d))",
lpObj->AccountID, lpObj->Name, ItemAttribute[iItemCode].Name, iItemCode,
pItem.m_Option1, pItem.m_Option2, pItem.m_Option3, ExOption[0], ExOption[1], ExOption[2],
ExOption[3], ExOption[4], ExOption[5]);
return TRUE;
}
示例2: InsertItem
BYTE CMonsterItemMng::InsertItem(int monsterlevel, int type, int index, int itemlevel, int op1, int op2 ,int op3 )
{
if ( monsterlevel > MAX_LEVEL_MONSTER || monsterlevel < 0 )
{
return -1;
}
int itemcount = this->m_iMonsterInvenItemCount[monsterlevel];
if ( itemcount >= MAX_ITEM_IN_MONSTER )
{
return -1;
}
CItem * item = &this->m_MonsterInvenItems[monsterlevel][itemcount];
int item_type = (type * MAX_SUBTYPE_ITEMS) + index;
item->m_Level = itemlevel;
item->Convert(item_type, op1, op2, op3, 0, 0,0, CURRENT_DB_VERSION);
if ( type == 13 && index == 10 )
{
int rd = Random(0,99);
item->m_Durability = rd + 100.0;
}
else
{
item->m_Durability = item->m_BaseDurability;
}
itemcount ++;
this->m_iMonsterInvenItemCount[monsterlevel] = itemcount;
return 0;
}
示例3: InsertItem
//0042f2a0 -> 100% (Identical)
BYTE CMonsterItemMng::InsertItem(int monsterlevel, int type, int index, int itemlevel, int op1, int op2, int op3)
{
if( monsterlevel > MAX_MONSTER_LEVEL || monsterlevel < 0 )
{
return -1;
}
// ----
int itemcount = this->m_iMonsterInvenItemCount[monsterlevel];
// ----
if( itemcount >= MAX_MONSTER_ITEM )
{
return -1;
}
// ----
CItem * item = &this->m_MonsterInvenItems[monsterlevel][itemcount];
int item_type = (type * MAX_SUBTYPE_ITEMS) + index;
item->m_Level = itemlevel;
// ----
item->Convert(item_type, op1, op2, op3, 0, 0, 0, 0, 0xFF, 0, CURRENT_DB_VERSION);
// ----
if( type == 13 && index == 10 )
{
item->m_Durability = rand() % 100 + 100.0f;
}
else
{
item->m_Durability = item->m_BaseDurability;
}
// ----
itemcount++;
this->m_iMonsterInvenItemCount[monsterlevel] = itemcount;
// ----
return 0;
}
示例4: GetTitanReward
void GetTitanReward(SDHP_GETREWARD_INFOSAVE * lpMsg)
{
char szId[11]={0};
int aIndex = 0;
szId[MAX_ACCOUNT_LEN]=0;
memcpy(szId, lpMsg->AccountID, sizeof(lpMsg->AccountID));
aIndex = lpMsg->aIndex;
if ( !gObjIsAccontConnect(aIndex, szId))
{
LogAddC(2, lMsg.Get(MSGGET(1, 175)), szId, aIndex);
return;
}
LPOBJ lpObj = &gObj[aIndex];
if (( lpObj->m_Index == aIndex) && (!strcmp(lpMsg->Name,lpObj->Name)))
{
char exVipMoney[512]={0};
char exZen[512]={0};
wsprintf(exVipMoney,"VipMoney increased in %d",lpMsg->rew.VipMoney);
wsprintf(exZen,"Zen increased in %d",lpMsg->rew.Zen);
if(lpMsg->ID_Num >= 0)
{
if(lpMsg->rew.num != (WORD) -1)
{
if(lpMsg->rew.Days == 0)
{
PMSG_BUYSHOPRESULT pResult;
PHeadSetB((LPBYTE)&pResult, 0x32, sizeof(pResult));
CItem item;
item.m_Level = lpMsg->rew.Level;
item.m_SkillOption = lpMsg->rew.Skill;
item.m_LuckOption = lpMsg->rew.Luck;
item.m_Z28Option = lpMsg->rew.Opt;
item.m_Durability = lpMsg->rew.Dur;
item.m_ItemOptionEx = lpMsg->rew.Exc;
item.m_JewelOfHarmonyOption = 0;
if(lpMsg->rew.JOH > 0)
{
int btOptionLevel = item.m_Level;
if(btOptionLevel > ReadConfig.JOHLevelMax)
btOptionLevel = ReadConfig.JOHLevelMax;
item.m_JewelOfHarmonyOption |= lpMsg->rew.JOH << 4;
item.m_JewelOfHarmonyOption |= btOptionLevel & 0x0F;
}
item.Convert(lpMsg->rew.num, lpMsg->rew.Skill, lpMsg->rew.Luck, lpMsg->rew.Opt, lpMsg->rew.Exc, 0, 0, CURRENT_DB_VERSION);
item.m_Durability = item.m_BaseDurability;
item.m_ItemSlot1 = lpMsg->rew.Sock1;
item.m_ItemSlot2 = lpMsg->rew.Sock2;
item.m_ItemSlot3 = lpMsg->rew.Sock3;
item.m_ItemSlot4 = lpMsg->rew.Sock4;
item.m_ItemSlot5 = lpMsg->rew.Sock5;
item.Value();
pResult.Result = gObjShopBuyInventoryInsertItem(lpObj->m_Index,item);
if ( pResult.Result != 0xFF )
{
DelTitanReward(aIndex,lpMsg->ID_Num);
if(lpMsg->rew.IsForeverFFFE == 1)
lpObj->pInventory[pResult.Result].m_Number = 0xFFFFFFFE;
ItemByteConvert((LPBYTE)&pResult.ItemInfo, item);
DataSend(aIndex, (LPBYTE)&pResult, pResult.h.size);
if(lpMsg->rew.VipMoney > 0)
{
lpObj->AccountExtraInfoModified = 1;
lpObj->VipMoney += lpMsg->rew.VipMoney;
GCServerMsgStringSend(exVipMoney, lpObj->m_Index, 0x01);
}
if(lpMsg->rew.Zen > 0)
{
if((__int64)(lpMsg->rew.Zen + gObj[aIndex].Money) > (__int64)MAX_ZEN)
gObj[aIndex].Money = MAX_ZEN;
else
gObj[aIndex].Money += lpMsg->rew.Zen;
::GCMoneySend(aIndex, gObj[aIndex].Money);
GCServerMsgStringSend(exZen, lpObj->m_Index, 0x01);
}
GCServerMsgStringSend("Get Reward Success!", aIndex, 0x01);
char sbuf[512]={0};
wsprintf(sbuf,"[BotReward](%s)(%s) Buy Item:%d(%d %d) ID_DB:%d [LVL:%d O:%d L:%d S:%d E:%d]",
gObj[aIndex].AccountID,gObj[aIndex].Name,
lpMsg->rew.num, lpMsg->rew.num/512, lpMsg->rew.num-((int)(lpMsg->rew.num/512)*512), lpMsg->ID_Num,
lpMsg->rew.Level,lpMsg->rew.Opt,lpMsg->rew.Luck,lpMsg->rew.Skill,lpMsg->rew.Exc);
LogAddTD(sbuf);
BOTREWARD_LOG.Output(sbuf);
}
}else
{
//.........这里部分代码省略.........
示例5: MakeBot
void ObjBotWarper::MakeBot()
{
if(this->Enabled == true)
{
for(int botNum=0;botNum<MAX_BOTWARPER;botNum++)
{
if(this->bot[botNum].Enabled == true)
{
int result = gObjAddCallMon();
if(result >= 0)
{
this->bot[botNum].index = result;
gObj[result].m_PosNum = (WORD)-1;
gObj[result].X = this->bot[botNum].X;
gObj[result].Y = this->bot[botNum].Y;
gObj[result].m_OldX = this->bot[botNum].X;
gObj[result].m_OldY = this->bot[botNum].Y;
gObj[result].TX = this->bot[botNum].X;
gObj[result].TY = this->bot[botNum].Y;
gObj[result].MTX = this->bot[botNum].X;
gObj[result].MTY = this->bot[botNum].Y;
gObj[result].Dir = this->bot[botNum].Dir;
gObj[result].MapNumber = this->bot[botNum].Map;
gObj[result].Live = TRUE;
gObj[result].PathCount = 0;
gObj[result].IsBot = 10;
gObjSetMonster(result,this->bot[botNum].Class,"PetBot");
gObj[result].ChangeUP = this->bot[botNum].Class & 0x07; // Set Second Type of Character
gObj[result].Class = this->bot[botNum].Class;
gObj[result].Level = 400;
gObj[result].Life = 1;
gObj[result].MaxLife = 2;
gObj[result].Mana = 1;
gObj[result].MaxMana = 2;
gObj[result].Experience = 0;
gObj[result].DbClass = this->bot[botNum].Class;
gObj[result].pInventory = new CItem[INVENTORY_NORMAL_SIZE];
gObj[result].Inventory1 = new CItem[INVENTORY_NORMAL_SIZE];
gObj[result].InventoryMap1 = new BYTE[INVENTORY_NORMAL_SIZE];
gObj[result].pInventoryMap = new BYTE[INVENTORY_NORMAL_SIZE];
for (int i=0;i<INVENTORY_NORMAL_SIZE;i++)
{
gObj[result].pInventory[i].Clear();
gObj[result].Inventory1[i].Clear();
}
memset(&gObj[result].pInventoryMap[0], (BYTE)-1, INVENTORY_NORMAL_SIZE);
memset(&gObj[result].InventoryMap1[0], (BYTE)-1, INVENTORY_NORMAL_SIZE);
strncpy(gObj[result].Name,this->bot[botNum].Name,sizeof(gObj[result].Name));
for(int i=0;i<9;i++)
{
if(this->bot[botNum].body[i].num >= 0 && this->bot[botNum].body[i].Enabled == true)
{
CItem item;
item.m_Level = this->bot[botNum].body[i].level;
item.m_SkillOption = 0;
item.m_LuckOption = 1;
item.m_Z28Option = this->bot[botNum].body[i].opt;
item.m_Durability = 255.0f;
item.m_JewelOfHarmonyOption = 0;
item.m_ItemOptionEx = 0;
item.m_ItemSlot1 = 0;
item.m_ItemSlot2 = 0;
item.m_ItemSlot3 = 0;
item.m_ItemSlot4 = 0;
item.m_ItemSlot5 = 0;
item.Convert(this->bot[botNum].body[i].num,item.m_SkillOption,item.m_LuckOption,item.m_Z28Option,0,0,item.m_ItemOptionEx,3);
gObj[result].pInventory[i].m_SkillOption = item.m_SkillOption;
gObj[result].pInventory[i].m_LuckOption = item.m_LuckOption;
gObj[result].pInventory[i].m_Z28Option = item.m_Z28Option;
gObj[result].pInventory[i].m_JewelOfHarmonyOption = item.m_JewelOfHarmonyOption;
gObj[result].pInventory[i].m_ItemOptionEx = item.m_ItemOptionEx;
item.m_Number = 0;
gObjInventoryInsertItemPos(gObj[result].m_Index,item,i,0);
}
}
gObj[result].Inventory1 = gObj[result].pInventory;
gObj[result].InventoryMap1 = gObj[result].pInventoryMap;
gObjMakePreviewCharSet(result);
gObj[result].m_AttackType = 0;
gObj[result].BotSkillAttack = 0;
gObj[result].m_Attribute = 100;
gObj[result].TargetNumber = (WORD)-1;
gObj[result].m_ActState.Emotion = 0;
gObj[result].m_ActState.Attack = 0;
gObj[result].m_ActState.EmotionCount = 0;
gObj[result].PathCount = 0;
//.........这里部分代码省略.........
示例6: MonsterItemDrop
bool CQuest::MonsterItemDrop(LPOBJ lpObj)
{
int MaxHitUser = gObjMonsterTopHitDamageUser(lpObj);
if ( MaxHitUser == -1 )
{
return false;
}
int partycount = gParty.GetPartyCount(gObj[MaxHitUser].PartyNumber);
if ( partycount > 0 )
{
return false;
}
int type;
int level = 0;
int x;
int y;
float dur = 0;
int Option1 = 0;
int Option2 = 0;
int Option3 = 0;
LPOBJ lpTarget = &gObj[MaxHitUser];
int qIndex = lpTarget->q_QuestIndex;
if(lpTarget->q_QuestState != QUEST_STATE_ONGOING)
{
return false;
}
QuestAtt * lpQuest = &this->quests[qIndex];
if ( lpQuest != NULL )
{
for(int i = 0 ; i != lpQuest->QuestsObjectCount; i++)
{
QuestObjectItem * lpQitem = &lpQuest->ItemsObject[i];
for(int n = 0 ; n != lpQitem->QuestMobCount; n++)
{
if(lpQuest->QuestKilledCount >= lpQitem->QuestMob[n].count)
{
dur = 0;
x = lpObj->X;
y = lpObj->Y;
type = ItemGetNumberMake(lpQitem->itemType,lpQitem->itemSubType);
CItem uItem;
uItem.Convert(type ,0,0,0,0,0,0,CURRENT_DB_VERSION);
BYTE uPos = gObjInventoryInsertItem(lpTarget->m_Index,uItem);
GCInventoryItemOneSend(lpTarget->m_Index, uPos);
LogAddTD("[Quest] Quest Item Insert [%s]: [%s][%s] (%s) (%d,%d)", lpObj->Name,lpTarget->AccountID, lpTarget->Name, lpQuest->name, lpQitem->itemType,lpQitem->itemSubType);
qMsg->Notice(lpTarget->m_Index, "[Quest] You're item in invnotry!! ");
this->SetQuestState(lpTarget , qIndex , QUEST_STATE_FINISH );
lpQuest->QuestKilledCount = 0;
}
else if(lpObj->Level >= lpQitem->QuestMob[n].minLevel && lpObj->Level <= lpQitem->QuestMob[n].maxLevel)
{
lpQuest->QuestKilledCount++;
qMsg->Msg(lpTarget->m_Index , "[Quest] you need kill more %d monsters",lpQitem->QuestMob[n].count - lpQuest->QuestKilledCount);
}
}
}
}
return false;
}
示例7: MagicBookGiveItemSearch
//004309b0 -> 100% (Identical)
void CMonsterItemMng::MagicBookGiveItemSearch(int monsterlevel, int maxlevel)
{
int result = 0;
int incount = 0;
int type, index;
int BallTable[22];
// ----
if( monsterlevel > MAX_MONSTER_LEVEL - 1 )
{
LogAdd("error-L3 : Monster Level Overflow~ %s %d", __FILE__, __LINE__); //Line: 8
return;
}
// ----
BallTable[0] = 7;
BallTable[1] = 8;
BallTable[2] = 9;
BallTable[3] = 10;
BallTable[4] = 11;
BallTable[5] = 12;
BallTable[6] = 13;
BallTable[7] = 14;
BallTable[8] = 16;
BallTable[9] = 17;
BallTable[10] = 18;
BallTable[11] = 19;
BallTable[12] = 21;
BallTable[13] = 22;
BallTable[14] = 23;
BallTable[15] = 24;
BallTable[16] = 35;
BallTable[17] = 44;
BallTable[18] = 45;
BallTable[19] = 46;
BallTable[20] = 47;
BallTable[21] = 48;
// ----
while(true)
{
if( rand() % 2 )
{
type = MAX_TYPE_ITEMS - 1;
index = GetLargeRand() % (g_MaxItemIndexOfEachItemType[type] + 1);
}
else
{
type = 12;
index = BallTable[GetLargeRand() % 22];
}
// ----
if( type == 12 && index == 11 )
{
CItem * item = &this->m_MonsterInvenExItems[monsterlevel][incount];
result = GetLevelItem(type, index, monsterlevel);
// ----
if( result >= 0 )
{
int item_type = ITEMGET(type, index);
item->Convert(item_type, 0, 0, 0, 0, 0, 0, 0, -1, 0, 3);
item->m_Level = result;
item->m_Durability = item->m_BaseDurability;
// ----
incount++;
// ----
if( incount > MAX_MONSTER_EXITEM - 1 )
{
break;
}
}
continue;
}
else
{
result = GetLevelItem(type, index, monsterlevel);
// ----
if( result != 0 )
{
continue;
}
// ----
CItem * item = &this->m_MonsterInvenExItems[monsterlevel][incount];
int item_type = ITEMGET(type, index);
// ----
item->Convert(item_type, 0, 0, 0, 0, 0, 0, 0, -1, 0, 3);
item->m_Level = 0;
item->m_Durability = item->m_BaseDurability;
// ----
incount++;
// ----
if( incount > MAX_MONSTER_EXITEM - 1 )
{
break;
}
}
}
// ----
this->m_iMonsterInvenExItemCount[monsterlevel] = incount;
}