This is a little tutorial for beginners. This tutorial is about TCMGIFTCHART and GIFT ITEM function from happy tool. I'm pretty sure almost all of you know how to use it but maybe here are some beginners who will need this. So, lets start.
We will use next table: TGAME--->TCMGIFTCHART. Table should be like this one :
wGiftID - You don`t have to change anything here just if you want to create more gifts!
bGiftType (0-nothing,1-item,2-magicitem,3-money,4-merit,5-exp)
dwValue- It`s amount, exemple bGiftType 3(money) dwValue 9 (you will recive 9 croma)
bCount- Just let it 0
bTakeType Setup it to 2
bMaxTakeCount - How much times a player can recive that GiftID. Exemple: If you want to send GiftID 1 bGiftType 3(money) dwValue 9 and bMaxTakeCount is 3 that player will can recive max 3 messages with that Gift ID.
So, he will recive 3 times 9 croma.
bToolOnly setup it to 0
wErrGiftID setup it to 3
szTitle - Message title
szMSG- Messange text
Now you have just to go on HappyTool -->Log In--> GM TOOL-->Gift Item
Server: Select you're own server
Name: Player name who will recive the gift
GiftID : Value from wGiftID (default is 1-24)
Source code of next tut
switch(bGiftType)
{
case CGT_NONE:
break;
case CGT_ITEM:
{
LPTITEM pTITEM = FindTItem((WORD)dwValue);
if(!pTITEM)
{
bRet = CMGIFT_ID;
break;
}
pNew = new CTItem();
pNew->m_dlID = GenItemID();
pNew->m_bCount = bCount;
pNew->m_wItemID = (WORD)dwValue;
pNew->m_pTITEM = pTITEM;
pNew->SetDuration(FALSE);
bPostType = POST_PACKATE;
}
break;
case CGT_MAGICITEM:
{
CTItem * pTITEM = FindTQusetItem(dwValue);
if(!pTITEM)
{
bRet = CMGIFT_ID;
break;
}
pNew = new CTItem();
pNew->Copy(pTITEM, TRUE);
pNew->m_bCount = bCount;
if(pNew->m_dEndTime)
{
CTime time(_AtlModule.m_timeCurrent);
time += CTimeSpan(LONG(pNew->m_dEndTime),0,0,0);
pNew->m_dEndTime = time.GetTime();
SetItemAttr(pNew, 0);
}
bPostType = POST_PACKATE;
}
break;
case CGT_MONEY:
CalcMoney(dwValue, dwGold, dwSilver, dwCooper);
break;
case CGT_MERIT:
pTarget->GainPvPoint(dwValue, PVPE_WIN, PVP_USEABLE);
break;
case CGT_EXP:
pTarget->GainExp(dwValue, FALSE);
break;
default:
bRet = CMGIFT_FAIL;
}