Change city command

Codes already submitted by people of the forums.
Post Reply
50-pesos
just visiting
Posts: 3
Joined: Sun Jan 01, 2006 1:11 pm

Post by 50-pesos » Sun Jul 31, 2011 10:46 pm

Classic /changecity command but this one also changes your hero items.

HG SRC:
Game.cpp:
Search for:

Code: Select all

case '/':
right before that add:

Code: Select all

if (memcmp(cp, "/changecity ", 12) == 0) {
        PlayerOrder_ChangeCity(iClientH);
        return; 
        }
now at the end of Game.cpp add:

Code: Select all

void CGame::PlayerOrder_ChangeCity(int iClientH)
{
class CItem * pItem;
int i, iEraseReq;
int iCape, iCape1, iHelm, iBerk, iPlate, iLegs, iRobe, iCap;
iCape = iCape1 = iHelm = iBerk = iPlate = iLegs = iRobe = iCap = 0;
if(m_pClientList[iClientH] == NULL) return;
if&#40;m_pClientList&#91;iClientH&#93;->m_iLevel <= 249&#41; return;
if&#40;m_pClientList&#91;iClientH&#93;->m_iGizonItemUpgradeLeft >= 300&#41;
&#123;
for&#40;i = 0; i < DEF_MAXITEMS; i++&#41;
&#123;
if&#40;m_pClientList&#91;iClientH&#93;->m_pItemList&#91;i&#93; != NULL&#41;
&#123;
switch&#40;m_pClientList&#91;iClientH&#93;->m_pItemList&#91;i&#93;->m_sIDnum&#41;
&#123;
case 400&#58;//AresdenHeroCape-
ItemDepleteHandler&#40;iClientH, i, TRUE, TRUE&#41;;
iCape = 1;
break;
case 401&#58;//ElvineHeroCape-
ItemDepleteHandler&#40;iClientH, i, TRUE, TRUE&#41;;
iCape = 2;
break;
case 403&#58;//aHeroHelm&#40;M&#41;-
ItemDepleteHandler&#40;iClientH, i, TRUE, TRUE&#41;;
iHelm = 1;
break;
case 404&#58;//aHeroHelm&#40;W&#41;-
ItemDepleteHandler&#40;iClientH, i, TRUE, TRUE&#41;;
iHelm = 2;
break;
case 405&#58;//eHeroHelm&#40;M&#41;-
ItemDepleteHandler&#40;iClientH, i, TRUE, TRUE&#41;;
iHelm = 3;
break;
case 406&#58;//eHeroHelm&#40;W&#41;-
ItemDepleteHandler&#40;iClientH, i, TRUE, TRUE&#41;;
iHelm = 4;
break;
case 407&#58;//aHeroCap&#40;M&#41;-
ItemDepleteHandler&#40;iClientH, i, TRUE, TRUE&#41;;
iCap = 1;
break;
case 408&#58;//aHeroCap&#40;W&#41;-
ItemDepleteHandler&#40;iClientH, i, TRUE, TRUE&#41;;
iCap = 2;
break;
case 409&#58;//eHeroCap&#40;M&#41;-
ItemDepleteHandler&#40;iClientH, i, TRUE, TRUE&#41;;
iCap = 3;
break;
case 410&#58;//eHeroCap&#40;W&#41;-
ItemDepleteHandler&#40;iClientH, i, TRUE, TRUE&#41;;
iCap = 4;
break;
case 411&#58;//aHeroArmor&#40;M&#41;-
ItemDepleteHandler&#40;iClientH, i, TRUE, TRUE&#41;;
iPlate = 1;
break;
case 412&#58;//aHeroArmor&#40;W&#41;-
ItemDepleteHandler&#40;iClientH, i, TRUE, TRUE&#41;;
iPlate = 2;
break;
case 413&#58;//eHeroArmor&#40;M&#41;-
ItemDepleteHandler&#40;iClientH, i, TRUE, TRUE&#41;;
iPlate = 3;
break;
case 414&#58;//eHeroArmor&#40;W&#41;-
ItemDepleteHandler&#40;iClientH, i, TRUE, TRUE&#41;;
iPlate = 4;
break;
case 415&#58;//aHeroRobe&#40;M&#41;-
ItemDepleteHandler&#40;iClientH, i, TRUE, TRUE&#41;;
iRobe = 1;
break;
case 416&#58;//aHeroRobe&#40;W&#41;-
ItemDepleteHandler&#40;iClientH, i, TRUE, TRUE&#41;;
iRobe = 2;
break;
case 417&#58;//eHeroRobe&#40;M&#41;-
ItemDepleteHandler&#40;iClientH, i, TRUE, TRUE&#41;;
iRobe = 3;
break;
case 418&#58;//eHeroRobe&#40;W&#41;-
ItemDepleteHandler&#40;iClientH, i, TRUE, TRUE&#41;;
iRobe = 4;
break;
case 419&#58;//aHeroHauberk&#40;M&#41;-
ItemDepleteHandler&#40;iClientH, i, TRUE, TRUE&#41;;
iBerk = 1;
break;
case 420&#58;//aHeroHauberk&#40;W&#41;-
ItemDepleteHandler&#40;iClientH, i, TRUE, TRUE&#41;;
iBerk = 2;
break;
case 421&#58;//eHeroHauberk&#40;M&#41;-
ItemDepleteHandler&#40;iClientH, i, TRUE, TRUE&#41;;
iBerk = 3;
break;
case 422&#58;//eHeroHauberk&#40;W&#41;-
ItemDepleteHandler&#40;iClientH, i, TRUE, TRUE&#41;;
iBerk = 4;
break;
case 423&#58;//aHeroLeggings&#40;M&#41;-
ItemDepleteHandler&#40;iClientH, i, TRUE, TRUE&#41;;
iLegs = 1;
break;
case 424&#58;//aHeroLeggings&#40;W&#41;-
ItemDepleteHandler&#40;iClientH, i, TRUE, TRUE&#41;;
iLegs = 2;
break;
case 425&#58;//eHeroLeggings&#40;M&#41;-
ItemDepleteHandler&#40;iClientH, i, TRUE, TRUE&#41;;
iLegs = 3;
break;
case 426&#58;//eHeroLeggings&#40;W&#41;-
ItemDepleteHandler&#40;iClientH, i, TRUE, TRUE&#41;;
iLegs = 4;
break;
case 427&#58;//AresdenHeroCape+1
ItemDepleteHandler&#40;iClientH, i, TRUE, TRUE&#41;;
iCape1 = 1;
break;
case 428&#58;//ElvineHeroCape+1
ItemDepleteHandler&#40;iClientH, i, TRUE, TRUE&#41;;
iCape1 = 2;
break;
&#125;
&#125;
&#125;
if&#40;iCape != 0&#41;
&#123;
pItem = new class CItem;
if&#40;iCape == 1&#41; _bInitItemAttr&#40;pItem, 401&#41;;
else if&#40;iCape == 2&#41; _bInitItemAttr&#40;pItem, 400&#41;;
pItem->m_sTouchEffectType = DEF_ITET_UNIQUE_OWNER;
pItem->m_sTouchEffectValue1 = m_pClientList&#91;iClientH&#93;->m_sCharIDnum1;
pItem->m_sTouchEffectValue2 = m_pClientList&#91;iClientH&#93;->m_sCharIDnum2;
pItem->m_sTouchEffectValue3 = m_pClientList&#91;iClientH&#93;->m_sCharIDnum3;
_bAddClientItemList&#40;iClientH, pItem, &iEraseReq&#41;;
SendItemNotifyMsg&#40;iClientH, DEF_NOTIFY_ITEMOBTAINED, pItem, NULL&#41;;
&#125;
if&#40;iHelm != 0&#41;
&#123;
pItem = new class CItem;
if&#40;iHelm == 1&#41; _bInitItemAttr&#40;pItem, 405&#41;;
else if&#40;iHelm == 2&#41; _bInitItemAttr&#40;pItem, 406&#41;;
else if&#40;iHelm == 3&#41; _bInitItemAttr&#40;pItem, 403&#41;;
else if&#40;iHelm == 4&#41; _bInitItemAttr&#40;pItem, 404&#41;;
pItem->m_sTouchEffectType = DEF_ITET_UNIQUE_OWNER;
pItem->m_sTouchEffectValue1 = m_pClientList&#91;iClientH&#93;->m_sCharIDnum1;
pItem->m_sTouchEffectValue2 = m_pClientList&#91;iClientH&#93;->m_sCharIDnum2;
pItem->m_sTouchEffectValue3 = m_pClientList&#91;iClientH&#93;->m_sCharIDnum3;
_bAddClientItemList&#40;iClientH, pItem, &iEraseReq&#41;;
SendItemNotifyMsg&#40;iClientH, DEF_NOTIFY_ITEMOBTAINED, pItem, NULL&#41;;
&#125;
if&#40;iCap != 0&#41;
&#123;
pItem = new class CItem;
if&#40;iCap == 1&#41; _bInitItemAttr&#40;pItem, 409&#41;;
else if&#40;iCap == 2&#41; _bInitItemAttr&#40;pItem, 410&#41;;
else if&#40;iCap == 3&#41; _bInitItemAttr&#40;pItem, 407&#41;;
else if&#40;iCap == 4&#41; _bInitItemAttr&#40;pItem, 408&#41;;
pItem->m_sTouchEffectType = DEF_ITET_UNIQUE_OWNER;
pItem->m_sTouchEffectValue1 = m_pClientList&#91;iClientH&#93;->m_sCharIDnum1;
pItem->m_sTouchEffectValue2 = m_pClientList&#91;iClientH&#93;->m_sCharIDnum2;
pItem->m_sTouchEffectValue3 = m_pClientList&#91;iClientH&#93;->m_sCharIDnum3;
_bAddClientItemList&#40;iClientH, pItem, &iEraseReq&#41;;
SendItemNotifyMsg&#40;iClientH, DEF_NOTIFY_ITEMOBTAINED, pItem, NULL&#41;;
&#125;
if&#40;iPlate != 0&#41;
&#123;
pItem = new class CItem;
if&#40;iPlate == 1&#41; _bInitItemAttr&#40;pItem, 413&#41;;
else if&#40;iPlate == 2&#41; _bInitItemAttr&#40;pItem, 414&#41;;
else if&#40;iPlate == 3&#41; _bInitItemAttr&#40;pItem, 411&#41;;
else if&#40;iPlate == 4&#41; _bInitItemAttr&#40;pItem, 412&#41;;
pItem->m_sTouchEffectType = DEF_ITET_UNIQUE_OWNER;
pItem->m_sTouchEffectValue1 = m_pClientList&#91;iClientH&#93;->m_sCharIDnum1;
pItem->m_sTouchEffectValue2 = m_pClientList&#91;iClientH&#93;->m_sCharIDnum2;
pItem->m_sTouchEffectValue3 = m_pClientList&#91;iClientH&#93;->m_sCharIDnum3;
_bAddClientItemList&#40;iClientH, pItem, &iEraseReq&#41;;
SendItemNotifyMsg&#40;iClientH, DEF_NOTIFY_ITEMOBTAINED, pItem, NULL&#41;;
&#125;
if&#40;iRobe != 0&#41;
&#123;
pItem = new class CItem;
if&#40;iRobe == 1&#41; _bInitItemAttr&#40;pItem, 417&#41;;
else if&#40;iRobe == 2&#41; _bInitItemAttr&#40;pItem, 418&#41;;
else if&#40;iRobe == 3&#41; _bInitItemAttr&#40;pItem, 415&#41;;
else if&#40;iRobe == 4&#41; _bInitItemAttr&#40;pItem, 416&#41;;
pItem->m_sTouchEffectType = DEF_ITET_UNIQUE_OWNER;
pItem->m_sTouchEffectValue1 = m_pClientList&#91;iClientH&#93;->m_sCharIDnum1;
pItem->m_sTouchEffectValue2 = m_pClientList&#91;iClientH&#93;->m_sCharIDnum2;
pItem->m_sTouchEffectValue3 = m_pClientList&#91;iClientH&#93;->m_sCharIDnum3;
_bAddClientItemList&#40;iClientH, pItem, &iEraseReq&#41;;
SendItemNotifyMsg&#40;iClientH, DEF_NOTIFY_ITEMOBTAINED, pItem, NULL&#41;;
&#125;
if&#40;iBerk != 0&#41;
&#123;
pItem = new class CItem;
if&#40;iBerk == 1&#41; _bInitItemAttr&#40;pItem, 421&#41;;
else if&#40;iBerk == 2&#41; _bInitItemAttr&#40;pItem, 422&#41;;
else if&#40;iBerk == 3&#41; _bInitItemAttr&#40;pItem, 419&#41;;
else if&#40;iBerk == 4&#41; _bInitItemAttr&#40;pItem, 420&#41;;
pItem->m_sTouchEffectType = DEF_ITET_UNIQUE_OWNER;
pItem->m_sTouchEffectValue1 = m_pClientList&#91;iClientH&#93;->m_sCharIDnum1;
pItem->m_sTouchEffectValue2 = m_pClientList&#91;iClientH&#93;->m_sCharIDnum2;
pItem->m_sTouchEffectValue3 = m_pClientList&#91;iClientH&#93;->m_sCharIDnum3;
_bAddClientItemList&#40;iClientH, pItem, &iEraseReq&#41;;
SendItemNotifyMsg&#40;iClientH, DEF_NOTIFY_ITEMOBTAINED, pItem, NULL&#41;;
&#125;
if&#40;iLegs != 0&#41;
&#123;
pItem = new class CItem;
if&#40;iLegs == 1&#41; _bInitItemAttr&#40;pItem, 425&#41;;
else if&#40;iLegs == 2&#41; _bInitItemAttr&#40;pItem, 426&#41;;
else if&#40;iLegs == 3&#41; _bInitItemAttr&#40;pItem, 423&#41;;
else if&#40;iLegs == 4&#41; _bInitItemAttr&#40;pItem, 424&#41;;
pItem->m_sTouchEffectType = DEF_ITET_UNIQUE_OWNER;
pItem->m_sTouchEffectValue1 = m_pClientList&#91;iClientH&#93;->m_sCharIDnum1;
pItem->m_sTouchEffectValue2 = m_pClientList&#91;iClientH&#93;->m_sCharIDnum2;
pItem->m_sTouchEffectValue3 = m_pClientList&#91;iClientH&#93;->m_sCharIDnum3;
_bAddClientItemList&#40;iClientH, pItem, &iEraseReq&#41;;
SendItemNotifyMsg&#40;iClientH, DEF_NOTIFY_ITEMOBTAINED, pItem, NULL&#41;;
&#125;
if&#40;iCape1 != 0&#41;
&#123;
pItem = new class CItem;
if&#40;iCape1 == 1&#41; _bInitItemAttr&#40;pItem, 428&#41;;
else if&#40;iCape1 == 2&#41; _bInitItemAttr&#40;pItem, 427&#41;;
pItem->m_sTouchEffectType = DEF_ITET_UNIQUE_OWNER;
pItem->m_sTouchEffectValue1 = m_pClientList&#91;iClientH&#93;->m_sCharIDnum1;
pItem->m_sTouchEffectValue2 = m_pClientList&#91;iClientH&#93;->m_sCharIDnum2;
pItem->m_sTouchEffectValue3 = m_pClientList&#91;iClientH&#93;->m_sCharIDnum3;
_bAddClientItemList&#40;iClientH, pItem, &iEraseReq&#41;;
SendItemNotifyMsg&#40;iClientH, DEF_NOTIFY_ITEMOBTAINED, pItem, NULL&#41;;
&#125;
m_pClientList&#91;iClientH&#93;->m_iGizonItemUpgradeLeft -= 300;
SendNotifyMsg&#40;NULL, iClientH, DEF_NOTIFY_GIZONITEMUPGRADELEFT, m_pClientList&#91;iClientH&#93;->m_iGizonItemUpgradeLeft, NULL, NULL, NULL&#41;;
if&#40;memcmp&#40;m_pClientList&#91;iClientH&#93;->m_cLocation, "aresden",7&#41; == 0 &#41; strcpy&#40;m_pClientList&#91;iClientH&#93;->m_cLocation,"elvine"&#41;;
else if &#40;memcmp&#40;m_pClientList&#91;iClientH&#93;->m_cLocation, "elvine",6&#41; == 0 &#41; strcpy&#40;m_pClientList&#91;iClientH&#93;->m_cLocation,"aresden"&#41;;
if&#40;m_pClientList&#91;iClientH&#93;->m_iGuildRank != -1&#41;
&#123;
m_pClientList&#91;iClientH&#93;->m_iGuildRank = -1;
m_pClientList&#91;iClientH&#93;->m_iGuildGUID = -1;
strcpy&#40;m_pClientList&#91;iClientH&#93;->m_cGuildName,"NONE"&#41;;
&#125;

ShowClientMsg&#40;iClientH, "Enjoy your new citizenship!"&#41;;
wsprintf&#40;G_cTxt, "&#40;!&#41; Player&#40;%s&#41; Request ChangeCity&#58; C&#40;%d&#41; - H&#40;%d&#41; - C&#40;%d&#41; - P&#40;%d&#41; - R&#40;%d&#41; - B&#40;%d&#41; - L&#40;%d&#41; - C&#40;%d&#41;", m_pClientList&#91;iClientH&#93;->m_cCharName, iCape, iHelm, iCap, iPlate, iRobe, iBerk, iLegs, iCape1&#41;;
PutLogList&#40;G_cTxt&#41;;
DeleteClient&#40;iClientH, TRUE, TRUE&#41;;
&#125;
else
&#123;
ShowClientMsg&#40;iClientH, "Necesitas 300 majestic para cambiar de ciudad"&#41;;
&#125;
&#125;
Game.h:
Add:

Code: Select all

void PlayerOrder_ChangeCity&#40;int iClientH&#41;;
By 50Cent
<img src='http://i722.photobucket.com/albums/ww22 ... ippy-5.gif' border='0' alt='user posted image' />


Post Reply