示例#1
0
void CShop::ShopItemDelete(int Pos,CShop *Shop)
{
	Shop->m_item[Pos].Clear();
	for (int i = 0; i < Type.size(); i++)
	{
		int type = ITEMGET(Type[i],Index[i]); 
		if ( type == Shop->m_item[Pos].m_Type && Dur[i] == Shop->m_item[Pos].m_Durability && Level[i] == Shop->m_item[Pos].m_Level && 
			Opt1[i] == Shop->m_item[Pos].m_Option1 && Opt2[i] == Shop->m_item[Pos].m_Option2 && Opt3[i] == Shop->m_item[Pos].m_Option3 )
		{
			Type[i] = -1;
			Index[i] = -1;
			Dur[i] = -1;
			Level[i] = -1;
			Opt1[i] = -1;
			Opt2[i] = -1;
			Opt3[i] = -1;
			break;
		}
	}
	Shop->RefreshShopItems();
}
示例#2
0
int CIllusionTempleEvent::CharmOfLuckCount(int iIndex)
{
	if( OBJMAX_RANGE(iIndex ) == FALSE )
	{
		LogAdd("return %s %d",__FILE__,__LINE__);
		return -1;
	}

	LPOBJ lpObj = &gObj[iIndex];
	int iCharmCount = 0;

	for(int n = 0; n < CHAOS_BOX_SIZE; n++)
	{
		if( lpObj->pChaosBox[n].IsItem() == TRUE &&
			lpObj->pChaosBox[n].m_Type == ITEMGET(14,53) )
		{
			iCharmCount += (int)lpObj->pChaosBox[n].m_Durability;
		}
	}
return iCharmCount;
}
int CJewelOfHarmonySystem::_GetItemType(CItem *pItem)
{
	int iItemType = JEWELOFHARMONY_ITEM_TYPE_NULL;


	if ( (pItem->m_Type >= ITEMGET(0,0) && pItem->m_Type <ITEMGET(4,0)) || (pItem->m_Type >= ITEMGET(4,0) && pItem->m_Type <ITEMGET(4,7)) || (pItem->m_Type >= ITEMGET(4,8) && pItem->m_Type <ITEMGET(4,15)) || (pItem->m_Type >= ITEMGET(4,16) && pItem->m_Type <ITEMGET(5,0)) )
		iItemType =JEWELOFHARMONY_ITEM_TYPE_WEAPON;

	if (pItem->m_Type >= ITEMGET(5,0) && pItem->m_Type <ITEMGET(6,0) )
		iItemType =JEWELOFHARMONY_ITEM_TYPE_STAFF;

	if (pItem->m_Type >= ITEMGET(6,0) && pItem->m_Type <ITEMGET(12,0) )
		iItemType =JEWELOFHARMONY_ITEM_TYPE_DEFENSE;

	return iItemType;
}
示例#4
0
bool GensPvP::CheckInvFree(int aIndex)
{
	if(OBJMAX_RANGE(aIndex) == 0)
	{
		return false;
	}

	BYTE Num = gObj[aIndex].GensLevel -1;
	//BYTE TempInventoryMap[BASIC_INVENTORY_SIZE + (MAX_EXTENDED_INV*EXTENDED_INV_SIZE)];
	BYTE TempInventoryMap[MAIN_INVENTORY_NORMAL_SIZE + (MAX_EXTENDED_INV*EXTENDED_INV_SIZE) + PSHOP_SIZE];
	memcpy(TempInventoryMap,gObj[aIndex].pInventoryMap,ReadConfig.GETSLOTS(aIndex));

	for(int x=0;x<this->rItem[Num].Count;x++)
	{
		int item = ITEMGET(this->rItem[Num].Type,this->rItem[Num].Index);
		if(gObjTempInventoryInsertItem(&gObj[aIndex],item,TempInventoryMap) == 255)
		{
			return false;
		}
	}
	return true;
}
示例#5
0
//004AA480
void MapClass::StateSetDestroy()
{
    int CurTime = GetTickCount();

    for (int n=0; n<MAX_MAPITEM; n++)
    {
        if ( this->m_cItem[n].IsItem() != FALSE )
        {
            if ( this->m_cItem[n].m_State == 1 )
            {
                this->m_cItem[n].m_State = 2;
            }
            else if ( this->m_cItem[n].m_State == 8 )
            {
                this->m_cItem[n].Clear();
                this->m_cItem[n].live = 0;
                this->m_cItem[n].Give = 1;
            }
        }

        if ( this->m_cItem[n].IsItem() != FALSE )
        {
            if ( this->m_cItem[n].m_State != 8 )
            {
                if ( CurTime > this->m_cItem[n].m_Time )
                {
                    LogAddTD(lMsg.Get(MSGGET(4, 76)), this->m_cItem[n].GetName(), this->m_cItem[n].m_Type, this->m_cItem[n].m_Level, this->m_cItem[n].m_Special[0] , this->m_cItem[n].m_Number);
                    this->m_cItem[n].m_State = 8;

                    if(this->m_cItem[n].m_Type == ITEMGET(14,64)) //season 2.5 add-on
                    {
                        g_IllusionTempleEvent.SetNpcStatueRegen(this->thisMapNumber);
                    }
                }
            }
        }
    }
}
示例#6
0
int CCastleSiegeSync::CheckOverlapCsMarks(int iIndex)
{
	for ( int x=INVENTORY_BAG_START;x<ReadConfig.MAIN_INVENTORY_SIZE(iIndex,false);x++)
	{
		if ( gObj[iIndex].pInventory[x].IsItem() == TRUE )
		{
			if ( gObj[iIndex].pInventory[x].m_Type == ITEMGET(14,21) )
			{
				if ( gObj[iIndex].pInventory[x].m_Level == 3 )
				{
					int op = gObj[iIndex].pInventory[x].m_Durability;

					if ( ITEM_DUR_RANGE(op) != FALSE)
					{
						return x;
					}
				}
			}
		}
	}

	return -1;
}
BYTE _SOCKET_SPHERE_OPTION::SetSphereOption(_SOCKET_SEED_DATA* lpSeedData,BYTE btLevel)
{
	if( lpSeedData == NULL || btLevel == NULL )
	{
		return false;
	}

	this->btOptionId = btLevel * MAX_SEED_OPTION + lpSeedData->btOption;
	this->btOption = lpSeedData->btOption;
	this->btGroup = lpSeedData->btGroup;
	this->btIndex = lpSeedData->btIndex;
	this->btIncType = lpSeedData->btIncType;
	this->btLevel = btLevel;
	this->wSphereValue = lpSeedData->btIncValue[-1+btLevel];

	switch( lpSeedData->btGroup )
	{
	case 1:
		this->SeedItem = ITEMGET(12,100);
		break;
	case 2:
		this->SeedItem = ITEMGET(12,101);
		break;
	case 3:
		this->SeedItem = ITEMGET(12,102);
		break;
	case 4:
		this->SeedItem = ITEMGET(12,103);
		break;
	case 5:
		this->SeedItem = ITEMGET(12,104);
		break;
	case 6:
		this->SeedItem = ITEMGET(12,105);
		break;
	case 7:
		break;
	default:
		return false;
	}

	this->SeedItem += (this->btLevel -1)*6;

return true;
}
示例#8
0
//00415FC0 - identical
int CKalimaGate::CheckOverlapKundunMark(int iIndex, BYTE btLevel)
{
	for ( int x = 0;x<MAIN_INVENTORY_SIZE;x++ )
	{
		if ( gObj[iIndex].pInventory[x].IsItem() == TRUE )
		{
			if ( gObj[iIndex].pInventory[x].m_Type == ITEMGET(14, 29) )
			{
				if ( gObj[iIndex].pInventory[x].m_Level == btLevel )
				{
					int iITEM_DUR = gObj[iIndex].pInventory[x].m_Durability;

					if ( KUNDUN_MARK_RANGE(iITEM_DUR) != FALSE )
					{
						return x;
					}
				}
			}
		}
	}

	return -1;
}
示例#9
0
BOOL CCashLotterySystem::InsertItem(int iItemCategory, int iItemType, int iItemIndex, int iItemLevelMin, int iItemLevelMax, int iSkillOption, int iLuckOption, int iAddOption, int iExOption)
{
	if ( iItemCategory < 0 || iItemCategory > MAX_LOTTERY_ITEM_CATEGORY )
		return FALSE;

	int iItemCount = this->LotteryItemListCount[iItemCategory];

	if ( iItemCount < 0 || iItemCount > MAX_LOTTERY_ITEM_COUNT )
		return FALSE;

	this->LotteryItemList[iItemCategory][iItemCount].btItemType = iItemType;
	this->LotteryItemList[iItemCategory][iItemCount].wItemIndex = iItemIndex;
	this->LotteryItemList[iItemCategory][iItemCount].btItemLevelMin = iItemLevelMin;
	this->LotteryItemList[iItemCategory][iItemCount].btItemLevelMax = iItemLevelMax;
	this->LotteryItemList[iItemCategory][iItemCount].btSkillOption = iSkillOption;
	this->LotteryItemList[iItemCategory][iItemCount].btLuckOption = iLuckOption;
	this->LotteryItemList[iItemCategory][iItemCount].btAddOption = iAddOption;
	this->LotteryItemList[iItemCategory][iItemCount].btExOption = iExOption;

	int iItemCode = 0;
	int iItemHeight = 0;
	int iItemWidth = 0;

	iItemCode = ITEMGET(iItemType, iItemIndex);
	iItemHeight = ItemAttribute[iItemCode].Height;
	iItemWidth = ItemAttribute[iItemCode].Width;

	if ( iItemWidth > this->iItemMaxWidth )
		this->iItemMaxWidth = iItemWidth;

	if ( iItemHeight > this->iItemMaxHeight )
		this->iItemMaxHeight = iItemHeight;

	this->LotteryItemListCount[iItemCategory]++;

	return TRUE;
}
BOOL CIllusionTempleEvent::CheckChangeRing(int nType)
{
	int bRet = 0;

	switch(nType)
	{
		case ITEMGET(13,10):
		case ITEMGET(13,39):
		case ITEMGET(13,40):
		case ITEMGET(13,41):
		case ITEMGET(13,68): //season4 add-on
		case ITEMGET(13,76): //season4.6 add-on
			bRet = 1;
			break;
	}

	return bRet;
}
示例#11
0
void CQuestInfo::InitQuestItem()
{
	int questcount = this->GetQeustCount();
	int foundquest = 0;
	LPQUEST_INFO lpQuestInfo;
	LPQUEST_SUB_INFO lpSubInfo;

	for (int i=0;i<MAX_QUEST_INFO;i++)
	{
		lpQuestInfo = this->GetQuestInfo(i);

		if ( lpQuestInfo == NULL )
		{
			continue;
		}

		for ( int n=0;n<lpQuestInfo->QuestSubInfoCount;n++)
		{
			lpSubInfo = &lpQuestInfo->QuestSubInfo[n];

			if ( lpSubInfo != NULL )
			{
				if ( lpSubInfo->QuestType == 1 )
				{
					LPITEM_ATTRIBUTE p = &ItemAttribute[ITEMGET(lpSubInfo->NeedType, lpSubInfo->NeedSubType) ];
					p->QuestItem = TRUE;
					LogAddTD("[Quest] [SetQuestItem] %s", p->Name);
				}
			}
		}
		foundquest++;
		if ( foundquest == questcount )
		{
			return;
		}
	}
}
// Set Options
void _SOCKET_SEED_DATA::SetOptionData(BYTE btOption, BYTE btGroup, BYTE btIndex, BYTE btIncType,LPBYTE btIncValue, int OptionRate)
{
	this->btOption = btOption;
	this->btGroup = btGroup;
	this->btIndex = btIndex;
	this->btIncType = btIncType;

	for(int i =0; i<MAX_SPHERE_LEVEL;i++)
	{
		this->btIncValue[i] = btIncValue[i];
	}

	this->OptionRate = OptionRate;

	switch( btGroup )
	{
	case 1:
		SeedItem = ITEMGET(12,60);
		break;
	case 2:
		SeedItem = ITEMGET(12,61);
		break;
	case 3:
		SeedItem = ITEMGET(12,62);
		break;
	case 4:
		SeedItem = ITEMGET(12,63);
		break;
	case 5:
		SeedItem = ITEMGET(12,64);
		break;
	case 6:
		SeedItem = ITEMGET(12,65);
		break;
	case 7:
		SeedItem = ITEMGET(12,66);
		break;
	}
}
示例#13
0
StatGem::StatGem()
{
	this->m_GemInfo[0].ItemID		= ITEMGET(14, 308);
	this->m_GemInfo[0].EffectType	= StatGemType::DoubleDamageRate;
	this->m_GemInfo[0].EffectValue	= 100;
	this->m_GemInfo[1].ItemID		= ITEMGET(14, 309);
	this->m_GemInfo[1].EffectType	= StatGemType::ExcellentDamageRate;
	this->m_GemInfo[1].EffectValue	= 100;
	this->m_GemInfo[2].ItemID		= ITEMGET(14, 310);
	this->m_GemInfo[2].EffectType	= StatGemType::DamageDecrease;
	this->m_GemInfo[2].EffectValue	= 100;
	this->m_GemInfo[3].ItemID		= ITEMGET(14, 311);
	this->m_GemInfo[3].EffectType	= StatGemType::DefenseIncrease;
	this->m_GemInfo[3].EffectValue	= 100;
	this->m_GemInfo[4].ItemID		= ITEMGET(14, 312);
	this->m_GemInfo[4].EffectType	= StatGemType::ZenHuntIncrease;
	this->m_GemInfo[4].EffectValue	= 100;
	this->m_GemInfo[5].ItemID		= ITEMGET(14, 313);
	this->m_GemInfo[5].EffectType	= StatGemType::MaxLifeIncrease;
	this->m_GemInfo[5].EffectValue	= 100;
}
示例#14
0
//00556760 //identical Calls alloc 3x
BYTE CSeedSphere::SetInfo(CSeed * lpSeed, BYTE slot_count)
{
	if(lpSeed == NULL || !slot_count)
	{
		return 0;
	}
	
	this->m_btItemByteOption	= slot_count * 50 + lpSeed->m_btOptionIndex;
	this->m_btOptionIndex	= lpSeed->m_btOptionIndex;

	this->m_btElementIndex	= lpSeed->m_btElementIndex;
	
	this->m_btItemLevel	= lpSeed->m_btItemLevel;
	
	this->m_btOptionType	= lpSeed->m_btOptionType;
	
	this->m_btSocketSlotCount	= slot_count;
	
	this->m_wSocketSlot  = lpSeed->m_btSocketSlot[slot_count-1];

	switch(lpSeed->m_btElementIndex)
	{
	case 1:this->m_iItemIndex = ITEMGET(12,100);	break;
	case 2:this->m_iItemIndex = ITEMGET(12,101);	break;
	case 3:this->m_iItemIndex = ITEMGET(12,102);	break;
	case 4:this->m_iItemIndex = ITEMGET(12,103);	break;
	case 5:this->m_iItemIndex = ITEMGET(12,104);	break;
	case 6:this->m_iItemIndex = ITEMGET(12,105);	break;
	case 7:								break;
	default:							return 0;
	}

	this->m_iItemIndex += (this->m_btSocketSlotCount - 1) * 6;

	return 1;
}
int CCashItemPeriodSystem::GetItemPeriodInfoEffectID(int iItemCode)
{
	int iValue = 0;

	switch(iItemCode)
	{
	case ITEMGET(13,43):
		iValue = AT_CSHOP_SEAL_OF_ASCENSION;
		break;
	case ITEMGET(13,44):
		iValue = AT_CSHOP_SEAL_OF_WEALTH;
		break;
	case ITEMGET(13,45):
		iValue = AT_CSHOP_SEAL_OF_SUSTENANCE;
		break;
	case ITEMGET(13,59):
		iValue = AT_CSHOP_SEAL_OF_MOBILITY;
		break;
	case ITEMGET(13,62): //Season 3.5
		iValue = AT_CSHOP_SEAL_OF_HEALING;
		break;
	case ITEMGET(13,63): //Season 3.5
		iValue = AT_CSHOP_SEAL_OF_DIVINITY;
		break;
	case ITEMGET(14,72):
		iValue = AT_CSHOP_SCROLL_OF_QUICKNESS;
		break;
	case ITEMGET(14,73):
		iValue = AT_CSHOP_SCROLL_OF_DEFENSE;
		break;
	case ITEMGET(14,74):
		iValue = AT_CSHOP_SCROLL_OF_WRATH;
		break;
	case ITEMGET(14,75):
		iValue = AT_CSHOP_SCROLL_OF_WIZARDRY;
		break;
	case ITEMGET(14,76):
		iValue = AT_CSHOP_SCROLL_OF_HEALTH;
		break;
	case ITEMGET(14,77):
		iValue = AT_CSHOP_SCROLL_OF_MANA;
		break;
	case ITEMGET(14,97): //Season 3.5
		iValue = AT_CSHOP_SCROLL_OF_BATTLE;
		break;
	case ITEMGET(14,98): //Season 3.5
		iValue = AT_CSHOP_SCROLL_OF_STRENGTHENER;
		break;
	case ITEMGET(14,78):
		iValue = AT_CSHOP_LEAP_OF_STRENGTH;
		break;
	case ITEMGET(14,79):
		iValue = AT_CSHOP_LEAP_OF_QUICKNESS;
		break;
	case ITEMGET(14,80):
		iValue = AT_CSHOP_LEAP_OF_HEALTH;
		break;
	case ITEMGET(14,81):
		iValue = AT_CSHOP_LEAP_OF_ENERGY;
		break;
	case ITEMGET(14,82):
		iValue = AT_CSHOP_LEAP_OF_CONTROL;
		break;
	case ITEMGET(13,81): //Season 4.5
		iValue = AT_CSHOP_GUARDIAN_AMULET;
		break;
	case ITEMGET(13,82): //Season 4.5
		iValue = AT_CSHOP_PROTECT_AMULET;
		break;
	case ITEMGET(13,93): //Season 4.5
		iValue = AT_CSHOP_MASTER_SEAL_OF_ASCENSION;
		break;
	case ITEMGET(13,94): //Season 4.5
		iValue = AT_CSHOP_MASTER_SEAL_OF_WEALTH;
		break;
	case ITEMGET(13,104): //AG AURA BOOST
		iValue = AT_CSHOP_AG_AURA;
		break;
	case ITEMGET(13,105): //AG AURA BOOST
		iValue = AT_CSHOP_SD_AURA;
		break;
	default:
		iValue = AT_NULL_BUFF_EFFECT;
		break;
	}

	return iValue;
}
void CLuckyCoin::ExchangeCoin(LPOBJ lpObj,int Type)
{
	int Count = 0;
	BYTE Socket[5];
	Socket[0] = 0xFF;
	Socket[1] = 0xFF;
	Socket[2] = 0xFF;
	Socket[3] = 0xFF;
	Socket[4] = 0xFF;
	CItem item;
	// ----
	switch ( Type )
	{
	case 0:	// -- 10 Coin Change
		Count = gLuckyCoin.GetCoinCount(lpObj);
		if ( Count < 10 )
		{
			GCServerMsgStringSend("[LuckyCoin]: Need 10 coins",lpObj->m_Index,1);
			return;
		}
		else
		{
			item.m_Type = ITEMGET(14,13);
			// ----
			if ( gObjInventoryInsertItem(lpObj->m_Index,item) == -1 )
			{
				return;
			}
			for (int i=0;i<10;i++)
			{
				gLuckyCoin.DeleteCoin(lpObj);
			}

			//ItemSerialCreateSend(lpObj->m_Index,236,0,0,ITEMGET(14,14),0,0,0,0,0,lpObj->m_Index,0,0,Socket);
		}
		break;
	case 1:	// -- 20 Coin Change
		Count = gLuckyCoin.GetCoinCount(lpObj);
		if ( Count < 20 )
		{
			GCServerMsgStringSend("[LuckyCoin]: Need 20 coins",lpObj->m_Index,1);
			return;
		}
		else
		{
			item.m_Type = ITEMGET(14,14);
			// ----
			if ( gObjInventoryInsertItem(lpObj->m_Index,item) == -1 )
			{
				return;
			}
			for (int i=0;i<20;i++)
			{
				gLuckyCoin.DeleteCoin(lpObj);
			}
			//ItemSerialCreateSend(lpObj->m_Index,236,0,0,ITEMGET(14,13),0,0,0,0,0,lpObj->m_Index,0,0,Socket);
		}
		break;
	case 2:	// -- 30 Coin Change
		Count = gLuckyCoin.GetCoinCount(lpObj);
		if ( Count < 30 )
		{
			GCServerMsgStringSend("[LuckyCoin]: Need 30 coins",lpObj->m_Index,1);
			return;
		}
		else
		{
			item.m_Type = ITEMGET(14,16);
			// ----
			if ( gObjInventoryInsertItem(lpObj->m_Index,item) == -1 )
			{
				return;
			}
			for (int i=0;i<30;i++)
			{
				gLuckyCoin.DeleteCoin(lpObj);
			}
			//ItemSerialCreateSend(lpObj->m_Index,236,0,0,ITEMGET(14,16),0,0,0,0,0,lpObj->m_Index,0,0,Socket);
		}
		break;
	}
}
示例#17
0
void ClassCalc::GetAttackDamage(LPOBJ lpUser)
{
#if (ENABLETEST_ZTLUA == 1)
    ZTLuaManager* LuaMng = new ZTLuaManager(FILE_LUA_CHARACTERBASICS);
    ZTLuaUnit::Bind(LuaMng->getLua());
    ZTLuaItem::Bind(LuaMng->getLua());
    LuaMng->Call("setAttackDamage", lpUser->m_Index);
    ZTLuaManager::Delete(LuaMng);
#else
    CItem* Right	= &lpUser->pInventory[0];
    CItem* Left		= &lpUser->pInventory[1];
    int Strength	= lpUser->Strength + lpUser->AddStrength;
    int Dexterity	= lpUser->Dexterity + lpUser->AddDexterity;
    int Vitality	= lpUser->Vitality + lpUser->AddVitality;
    int Energy		= lpUser->Energy + lpUser->AddEnergy;
    WORD Class		= lpUser->Class;
    // ----
    if( Class == CLASS_WIZARD || Class == CLASS_KNIGHT )
    {
        lpUser->m_AttackDamageMinRight	= Strength / this->m_Data[Class].AttackDamageMinRightDiv1;
        lpUser->m_AttackDamageMaxRight	= Strength / this->m_Data[Class].AttackDamageMaxRightDiv1;
        lpUser->m_AttackDamageMinLeft	= Strength / this->m_Data[Class].AttackDamageMinLeftDiv1;
        lpUser->m_AttackDamageMaxLeft	= Strength / this->m_Data[Class].AttackDamageMaxLeftDiv1;
    }
    else if( Class == CLASS_ELF )
    {
        if(		(Right->m_Type >= ITEMGET(4,8) && Right->m_Type < ITEMGET(4,15) )
                ||	(Left->m_Type >= ITEMGET(4,0) && Left->m_Type < ITEMGET(4,7))
                ||	Right->m_Type == ITEMGET(4,16)
                ||	Left->m_Type == ITEMGET(4,17)
                ||	Right->m_Type == ITEMGET(4,18)
                ||	Right->m_Type == ITEMGET(4,19)
                ||	Left->m_Type == ITEMGET(4,20)
                ||	Left->m_Type == ITEMGET(4,21)
                ||	Left->m_Type == ITEMGET(4,22)
                ||	Left->m_Type == ITEMGET(4,23)
                ||	Left->m_Type == ITEMGET(4,24)
                ||	Left->m_Type == ITEMGET(4,25)
                ||	Right->m_Type == ITEMGET(4,26)
                ||	Left->m_Type == ITEMGET(4,27))
        {
            if(		(Right->IsItem() && !Right->m_IsValidItem)
                    ||	(Left->IsItem() && !Left->m_IsValidItem) )
            {
                lpUser->m_AttackDamageMinRight	= (Dexterity + Strength) / this->m_Data[Class].AttackDamageMinRightDiv3;
                lpUser->m_AttackDamageMaxRight	= (Dexterity + Strength) / this->m_Data[Class].AttackDamageMaxRightDiv3;
                lpUser->m_AttackDamageMinLeft	= (Dexterity + Strength) / this->m_Data[Class].AttackDamageMinLeftDiv3;
                lpUser->m_AttackDamageMaxLeft	= (Dexterity + Strength) / this->m_Data[Class].AttackDamageMaxLeftDiv3;
            }
            else
            {
                lpUser->m_AttackDamageMinRight	= (Dexterity / this->m_Data[Class].AttackDamageMinRightDiv1) + (Strength / this->m_Data[Class].AttackDamageMinRightDiv2);
                lpUser->m_AttackDamageMaxRight	= (Dexterity / this->m_Data[Class].AttackDamageMaxRightDiv1) + (Strength / this->m_Data[Class].AttackDamageMaxRightDiv2);
                lpUser->m_AttackDamageMinLeft	= (Dexterity / this->m_Data[Class].AttackDamageMinLeftDiv1) + (Strength / this->m_Data[Class].AttackDamageMinLeftDiv2);
                lpUser->m_AttackDamageMaxLeft	= (Dexterity / this->m_Data[Class].AttackDamageMaxLeftDiv1) + (Strength / this->m_Data[Class].AttackDamageMaxLeftDiv2);
            }
        }
        else
        {
            lpUser->m_AttackDamageMinRight	= (Dexterity + Strength) / this->m_Data[Class].AttackDamageMinRightDiv3;
            lpUser->m_AttackDamageMaxRight	= (Dexterity + Strength) / this->m_Data[Class].AttackDamageMaxRightDiv3;
            lpUser->m_AttackDamageMinLeft	= (Dexterity + Strength) / this->m_Data[Class].AttackDamageMinLeftDiv3;
            lpUser->m_AttackDamageMaxLeft	= (Dexterity + Strength) / this->m_Data[Class].AttackDamageMaxLeftDiv3;
        }
    }
    else if( Class == CLASS_MAGUMSA || Class == CLASS_DARKLORD )
    {
        lpUser->m_AttackDamageMinRight	= (Strength / this->m_Data[Class].AttackDamageMinRightDiv1) + (Energy / this->m_Data[Class].AttackDamageMinRightDiv2);
        lpUser->m_AttackDamageMaxRight	= (Strength / this->m_Data[Class].AttackDamageMaxRightDiv1) + (Energy / this->m_Data[Class].AttackDamageMaxRightDiv2);
        lpUser->m_AttackDamageMinLeft	= (Strength / this->m_Data[Class].AttackDamageMinLeftDiv1) + (Energy / this->m_Data[Class].AttackDamageMinLeftDiv2);
        lpUser->m_AttackDamageMaxLeft	= (Strength / this->m_Data[Class].AttackDamageMaxLeftDiv1) + (Energy / this->m_Data[Class].AttackDamageMaxLeftDiv2);
    }
    else if( Class == CLASS_SUMMONER )
    {
        lpUser->m_AttackDamageMinRight	= ((Strength + Dexterity) / this->m_Data[Class].AttackDamageMinRightDiv1);
        lpUser->m_AttackDamageMaxRight	= ((Strength + Dexterity) / this->m_Data[Class].AttackDamageMaxRightDiv1);
        lpUser->m_AttackDamageMinLeft	= ((Strength + Dexterity) / this->m_Data[Class].AttackDamageMinLeftDiv1);
        lpUser->m_AttackDamageMaxLeft	= ((Strength + Dexterity) / this->m_Data[Class].AttackDamageMaxLeftDiv1);
    }
    else if( Class == CLASS_FIGHTER )
    {
        lpUser->m_AttackDamageMinRight	= Vitality / this->m_Data[Class].AttackDamageMinRightDiv1 + Strength / this->m_Data[Class].AttackDamageMinRightDiv2;
        lpUser->m_AttackDamageMaxRight	= Vitality / this->m_Data[Class].AttackDamageMaxRightDiv1 + Strength / this->m_Data[Class].AttackDamageMaxRightDiv2;
        lpUser->m_AttackDamageMinLeft	= Vitality / this->m_Data[Class].AttackDamageMinLeftDiv1 + Strength / this->m_Data[Class].AttackDamageMinLeftDiv2;
        lpUser->m_AttackDamageMaxLeft	= Vitality / this->m_Data[Class].AttackDamageMaxLeftDiv1 + Strength / this->m_Data[Class].AttackDamageMaxLeftDiv2;
    }
    else
    {
        lpUser->m_AttackDamageMinRight	= Strength / 8;
        lpUser->m_AttackDamageMaxRight	= Strength / 4;
        lpUser->m_AttackDamageMinLeft	= Strength / 8;
        lpUser->m_AttackDamageMaxLeft	= Strength / 4;
    }
#endif
}
void CCalCharacter::gObjCalCharacter(int aIndex)
{
	LPOBJ lpObj = &gObj[aIndex];
	int Strength = 0;
	int Dexterity = 0;
	int Vitality = 0;
	int Energy = 0;
	int Leadership = 0;
	// ----
	CItem * Right = &lpObj->pInventory[0];
	CItem * Left  = &lpObj->pInventory[1];
	CItem * Helm  = &lpObj->pInventory[2];
	CItem * Armor  = &lpObj->pInventory[3];
	CItem * Pants  = &lpObj->pInventory[4];
	CItem * Gloves = &lpObj->pInventory[5];
	CItem * Boots = &lpObj->pInventory[6];
	CItem * Wings = &lpObj->pInventory[7];
	CItem * Helper = &lpObj->pInventory[8];
	CItem * Amulet = &lpObj->pInventory[9];
	CItem * Ring01 = &lpObj->pInventory[10];
	CItem * Ring02 = &lpObj->pInventory[11];
	lpObj->HaveWeaponInHand = true;
	// -------------------------------------------------------
	// Check Weapon in hand
	// -------------------------------------------------------
	if ( Right->IsItem() == false && Left->IsItem() == false )
	{
		lpObj->HaveWeaponInHand = false;
	}
	else if ( Left->IsItem() == false && Right->m_Type == ITEMGET(4,15) ) // Arrow
	{
		lpObj->HaveWeaponInHand = false;
	}
	else if ( Right->IsItem() == false )
	{
		int iType = Left->m_Type / MAX_SUBTYPE_ITEMS;

		if ( Left->m_Type == ITEMGET(4,7) ) // Bolt
		{
			lpObj->HaveWeaponInHand = false;
		}
		else if ( iType == 6 ) // Shield
		{
			lpObj->HaveWeaponInHand = false;
		}
	}
	// -------------------------------------------------------
	lpObj->AddLife = 0;
	lpObj->AddMana = 0;
	lpObj->MonsterDieGetMoney = 0;
	lpObj->MonsterDieGetLife = 0;
	lpObj->MonsterDieGetMana = 0;
	lpObj->DamageReflect = 0;
	lpObj->DamageMinus = 0;
	lpObj->SkillLongSpearChange = false;

	if ( lpObj->m_iItemEffectValidTime > 0 )
	{
		g_ItemAddOption.PrevSetItemLastEffectForHallowin(lpObj);
	}

	int iItemIndex;
	BOOL bIsChangeItem;	// lc34

	for ( iItemIndex=0; iItemIndex<MAX_PLAYER_EQUIPMENT;iItemIndex++)
	{
		if ( lpObj->pInventory[iItemIndex].IsItem() != FALSE )
		{
			lpObj->pInventory[iItemIndex].m_IsValidItem = true;
		}
	}

	do
	{
		lpObj->SetOpAddMaxAttackDamage = 0;
		lpObj->SetOpAddMinAttackDamage = 0;
		lpObj->SetOpAddDamage = 0;
		lpObj->SetOpIncAGValue = 0;
		lpObj->SetOpAddCriticalDamageSuccessRate = 0;
		lpObj->SetOpAddCriticalDamage = 0;
		lpObj->SetOpAddExDamageSuccessRate = 0;
		lpObj->SetOpAddExDamage = 0;
		lpObj->SetOpAddSkillAttack = 0;
		lpObj->AddStrength = 0;
		lpObj->AddDexterity = 0;
		lpObj->AddVitality = 0;
		lpObj->AddEnergy = 0;
		lpObj->AddBP = 0;
		lpObj->iAddShield = 0;
		lpObj->SetOpAddAttackDamage = 0;
		lpObj->SetOpAddDefence = 0;
		lpObj->SetOpAddMagicPower = 0;
		lpObj->SetOpAddDefenceRate = 0;
		lpObj->SetOpIgnoreDefense = 0;
		lpObj->SetOpDoubleDamage = 0;
		lpObj->SetOpTwoHandSwordImproveDamage = 0;
		lpObj->SetOpImproveSuccessAttackRate = 0;
		lpObj->SetOpReflectionDamage = 0;
		lpObj->SetOpImproveSheldDefence = 0;
		lpObj->SetOpDecreaseAG = 0;
		lpObj->SetOpImproveItemDropRate = 0;
		lpObj->IsFullSetItem = false;
		memset(lpObj->m_AddResistance, 0, sizeof(lpObj->m_AddResistance));
		bIsChangeItem = 0;
		gObjCalcSetItemStat(lpObj);
		gObjCalcSetItemOption(lpObj);

		for (iItemIndex=0;iItemIndex<MAX_PLAYER_EQUIPMENT;iItemIndex++)
		{
			if ( lpObj->pInventory[iItemIndex].IsItem() != FALSE && lpObj->pInventory[iItemIndex].m_IsValidItem != false )
			{
				if ( gObjValidItem( lpObj, &lpObj->pInventory[iItemIndex], iItemIndex) != FALSE )
				{
					lpObj->pInventory[iItemIndex].m_IsValidItem = true;
				}
				else
				{
					lpObj->pInventory[iItemIndex].m_IsValidItem  = false;
					bIsChangeItem = TRUE;
				}
			}
		}
	}
	while ( bIsChangeItem != FALSE );

	Strength = lpObj->Strength + lpObj->AddStrength;
	Dexterity = lpObj->Dexterity + lpObj->AddDexterity;
	Vitality = lpObj->Vitality + lpObj->AddVitality;
	Energy = lpObj->Energy + lpObj->AddEnergy;
	Leadership = lpObj->Leadership + lpObj->AddLeadership;

	switch ( lpObj->Class )
	{
	case CLASS_WIZARD:
		lpObj->m_AttackDamageMinRight = (Strength / 8);
		lpObj->m_AttackDamageMaxRight = (Strength / 4);
		lpObj->m_AttackDamageMinLeft = (Strength / 8);
		lpObj->m_AttackDamageMaxLeft = (Strength / 4);
		break;
	case CLASS_KNIGHT:
		lpObj->m_AttackDamageMinRight = Strength / 6;
		lpObj->m_AttackDamageMaxRight = Strength / 4;
		lpObj->m_AttackDamageMinLeft = Strength / 6;
		lpObj->m_AttackDamageMaxLeft = Strength / 4;
		break;
	case CLASS_ELF:
		if ( (Right->m_Type >= ITEMGET(4,8) && Right->m_Type < ITEMGET(4,15) ) ||
			 (Left->m_Type >= ITEMGET(4,0) && Left->m_Type < ITEMGET(4,7)) ||
			  Right->m_Type == ITEMGET(4,16) ||
			  Left->m_Type == ITEMGET(4,17) ||
			  Right->m_Type == ITEMGET(4,18) ||
			  Right->m_Type == ITEMGET(4,19) ||
			  Left->m_Type == ITEMGET(4,20) ||
			  Left->m_Type == ITEMGET(4,21) ||
			  Left->m_Type == ITEMGET(4,22) ||
			  Left->m_Type == ITEMGET(4,23) ||
			  Left->m_Type == ITEMGET(4,24) )
		{
			if ( (Right->IsItem() != FALSE && Right->m_IsValidItem == false) || (Left->IsItem() != FALSE && Left->m_IsValidItem == false) )
			{
				lpObj->m_AttackDamageMinRight = (Dexterity + Strength ) / 7;
				lpObj->m_AttackDamageMaxRight = (Dexterity + Strength ) / 4;
				lpObj->m_AttackDamageMinLeft = (Dexterity + Strength ) / 7;
				lpObj->m_AttackDamageMaxLeft = (Dexterity + Strength ) / 4;
			}
			else
			{
				lpObj->m_AttackDamageMinRight = (Dexterity / 7) + (Strength / 14);
				lpObj->m_AttackDamageMaxRight = (Dexterity / 4) + (Strength / 8 );
				lpObj->m_AttackDamageMinLeft = (Dexterity / 7) + (Strength / 14);
				lpObj->m_AttackDamageMaxLeft = (Dexterity / 4) + (Strength / 8 );
			}
		}
		else
		{
			lpObj->m_AttackDamageMinRight = (Dexterity + Strength) / 7;
			lpObj->m_AttackDamageMaxRight = (Dexterity + Strength) / 4;
			lpObj->m_AttackDamageMinLeft = (Dexterity + Strength) / 7;
			lpObj->m_AttackDamageMaxLeft = (Dexterity + Strength) / 4;
		}
		break;
	case CLASS_MAGUMSA:
		lpObj->m_AttackDamageMinRight = (Strength / 6) + (Energy / 12);
		lpObj->m_AttackDamageMaxRight = (Strength / 4) + (Energy / 8);
		lpObj->m_AttackDamageMinLeft = (Strength / 6) + (Energy / 12);
		lpObj->m_AttackDamageMaxLeft = (Strength / 4) + (Energy / 8);
		break;
	case CLASS_DARKLORD:
		lpObj->m_AttackDamageMinRight = (Strength / 7) + (Energy / 14);
		lpObj->m_AttackDamageMaxRight = (Strength / 5) + (Energy / 10);
		lpObj->m_AttackDamageMinLeft = (Strength / 7) + (Energy / 14);
		lpObj->m_AttackDamageMaxLeft = (Strength / 5) + (Energy / 10);
		break;
	case CLASS_SUMMONER:
		lpObj->m_AttackDamageMinRight = (Strength / 8) + (Energy / 12);
		lpObj->m_AttackDamageMaxRight = (Strength / 4) + (Energy / 8);
		lpObj->m_AttackDamageMinLeft = (Strength / 8) + (Energy / 12);
		lpObj->m_AttackDamageMaxLeft = (Strength / 4) + (Energy / 8);
		break;
	case CLASS_FIGHTER:
		lpObj->m_AttackDamageMinRight = (Strength / 6) + (Energy / 12);
		lpObj->m_AttackDamageMaxRight = (Strength / 4) + (Energy / 8);
		lpObj->m_AttackDamageMinLeft = (Strength / 6) + (Energy / 12);
		lpObj->m_AttackDamageMaxLeft = (Strength / 4) + (Energy / 8);
		break;
	}
	
	if ( Wings->IsItem() != FALSE && Wings->m_IsValidItem != false ) 
	{
		Wings->PlusSpecial(&lpObj->m_AttackDamageMinRight, 80);
		Wings->PlusSpecial(&lpObj->m_AttackDamageMaxRight, 80);
		Wings->PlusSpecial(&lpObj->m_AttackDamageMinLeft, 80);
		Wings->PlusSpecial(&lpObj->m_AttackDamageMaxLeft, 80);
	}

	int AddLeadership = 0;

	if ( Wings->IsItem() != FALSE && Wings->m_IsValidItem != false)
	{
		AddLeadership += Wings->m_Leadership;
	}

	if ( Right->m_Type != -1 )
	{
		if ( Right->m_IsValidItem != false )
		{
			if ( Right->m_Type >= ITEMGET(5,0) && Right->m_Type <= ITEMGET(6,0) ) // Check this
			{
				lpObj->m_AttackDamageMinRight += Right->m_DamageMin / 2;
				lpObj->m_AttackDamageMaxRight += Right->m_DamageMax / 2;
			}
			else
			{
				lpObj->m_AttackDamageMinRight += Right->m_DamageMin;
				lpObj->m_AttackDamageMaxRight += Right->m_DamageMax;
			}
		}

		if ( Right->m_SkillChange != FALSE )
		{
			lpObj->SkillLongSpearChange = true;
		}

		Right->PlusSpecial(&lpObj->m_AttackDamageMinRight, 80);
		Right->PlusSpecial(&lpObj->m_AttackDamageMaxRight, 80);
	}
		
	if ( Left->m_Type != -1 )
	{
		if ( Left->m_IsValidItem != false)
		{
			lpObj->m_AttackDamageMinLeft += Left->m_DamageMin;
			lpObj->m_AttackDamageMaxLeft += Left->m_DamageMax;
		}

		Left->PlusSpecial(&lpObj->m_AttackDamageMinLeft, 80);
		Left->PlusSpecial(&lpObj->m_AttackDamageMaxLeft, 80);
	}

	lpObj->m_CriticalDamage = 0;
	lpObj->m_ExcelentDamage = 0;

	if ( Wings->IsItem() != FALSE && Wings->m_IsValidItem != false )
	{
		Wings->PlusSpecial(&lpObj->m_MagicDamageMin, 81);
		Wings->PlusSpecial(&lpObj->m_MagicDamageMax, 81);
		Wings->PlusSpecial(&lpObj->m_CriticalDamage, 84);
	}
	if ( Right->IsItem() != FALSE && Right->m_IsValidItem != false )
	{
		Right->PlusSpecial(&lpObj->m_CriticalDamage, 84);
	}
	if ( Left->IsItem() != FALSE && Left->m_IsValidItem != false )
	{
		Left->PlusSpecial(&lpObj->m_CriticalDamage, 84);
	}
	if ( Helm->IsItem() != FALSE && Helm->m_IsValidItem != false )
	{
		Helm->PlusSpecial(&lpObj->m_CriticalDamage, 84);
	}
	if ( Armor->IsItem() != FALSE && Armor->m_IsValidItem != false )
	{
		Armor->PlusSpecial(&lpObj->m_CriticalDamage, 84);
	}
	if ( Pants->IsItem() != FALSE && Pants->m_IsValidItem != false )
	{
		Pants->PlusSpecial(&lpObj->m_CriticalDamage, 84);
	}
	if ( Gloves->IsItem() != FALSE && Gloves->m_IsValidItem != false )
	{
		Gloves->PlusSpecial(&lpObj->m_CriticalDamage, 84);
	}
	if ( Boots->IsItem() != FALSE && Boots->m_IsValidItem != false )
	{
		Boots->PlusSpecial(&lpObj->m_CriticalDamage, 84);
	}
	lpObj->m_MagicDamageMin = Energy / 9;
	lpObj->m_MagicDamageMax = Energy / 4;


	if ( Right->m_Type != -1 )
	{
		if ( Right->m_Type == ITEMGET(0,31) ||
			 Right->m_Type == ITEMGET(0,21) ||
			 Right->m_Type == ITEMGET(0,23) ||
			 Right->m_Type == ITEMGET(0,25) ||
			 Right->m_Type == ITEMGET(0,28) ) 
		{
			Right->PlusSpecial(&lpObj->m_MagicDamageMin, 80);
			Right->PlusSpecial(&lpObj->m_MagicDamageMax, 80);
		}
		else
		{
			Right->PlusSpecial(&lpObj->m_MagicDamageMin, 81);
			Right->PlusSpecial(&lpObj->m_MagicDamageMax, 81);
		}
	}

	lpObj->m_AttackRating = (Strength + Dexterity) / 2;
	if (lpObj->Class != CLASS_FIGHTER) // Rage Fighter - No Gloves
	{
		if ( Gloves->IsItem() != FALSE && Gloves->m_IsValidItem != false )
		{
			lpObj->m_AttackRating += Gloves->ItemDefense();
		}
	}
	// ----------------------------------------
	// Attack Speed
	// ---------------------------------------- 
	switch ( lpObj->Class )
	{
	case CLASS_WIZARD:
		lpObj->m_AttackSpeed = Dexterity / 20;
		lpObj->m_MagicSpeed = Dexterity / 10;
		break;
	case CLASS_KNIGHT:
		lpObj->m_AttackSpeed = Dexterity / 15;
		lpObj->m_MagicSpeed = Dexterity / 20;
		break;
	case CLASS_ELF:
		lpObj->m_AttackSpeed = Dexterity / 50;
		lpObj->m_MagicSpeed = Dexterity / 50;
		break;
	case CLASS_MAGUMSA:
		lpObj->m_AttackSpeed = Dexterity / 15;
		lpObj->m_MagicSpeed = Dexterity / 20;
		break;
	case CLASS_DARKLORD:
		lpObj->m_AttackSpeed = Dexterity / 10;
		lpObj->m_MagicSpeed = Dexterity / 10;
		break;
	case CLASS_SUMMONER:
		lpObj->m_AttackSpeed = Dexterity / 20;
		lpObj->m_MagicSpeed = Dexterity / 20;
		break;
	case CLASS_FIGHTER:
		lpObj->m_AttackSpeed = Dexterity / 15;
		lpObj->m_MagicSpeed = Dexterity / 20;
		break;
	}
	
	bool bRight = false;
	bool bLeft = false;
	// ---------------------------------------- 
	// Check if have weapon in Right Hand
	// ---------------------------------------- 
	if ( Right->m_Type != ITEMGET(4,7) && Right->m_Type != ITEMGET(4,15) && Right->m_Type >= ITEMGET(0,0) && Right->m_Type < ITEMGET(6,0) )
	{
		if ( Right->m_IsValidItem != false )
		{
			bRight = true;
		}
	}
	// ---------------------------------------- 
	// Check if have weapon in Left Hand
	// ---------------------------------------- 
	if ( Left->m_Type != ITEMGET(4,7) && Left->m_Type != ITEMGET(4,15) && Left->m_Type >= ITEMGET(0,0) && Left->m_Type < ITEMGET(6,0) )
	{
		if ( Left->m_IsValidItem != false )
		{
			bLeft = true;
		}
	}

	if ( bRight != false && bLeft != false )
	{
		lpObj->m_AttackSpeed += (Right->m_AttackSpeed + Left->m_AttackSpeed)/2;
		lpObj->m_MagicSpeed += (Right->m_AttackSpeed + Left->m_AttackSpeed)/2;
	}
	else if ( bRight!= false )
	{
		lpObj->m_AttackSpeed += Right->m_AttackSpeed;
		lpObj->m_MagicSpeed += Right->m_AttackSpeed;
	}
	else if ( bLeft != false )
	{
		lpObj->m_AttackSpeed += Left->m_AttackSpeed;
		lpObj->m_MagicSpeed += Left->m_AttackSpeed;
	}

	if ( lpObj->Class != CLASS_FIGHTER ) // Rage Fighter - No Gloves
	{
		if ( Gloves->m_Type != -1 )
		{
			if ( Gloves->m_IsValidItem != false )
			{
				lpObj->m_AttackSpeed += Gloves->m_AttackSpeed;
				lpObj->m_MagicSpeed += Gloves->m_AttackSpeed;
			}
		}
	}

	if ( Amulet->m_Type != -1 ) // Pendant
	{
		if ( Amulet->m_IsValidItem != false )
		{
			lpObj->m_AttackSpeed += Amulet->m_AttackSpeed;
			lpObj->m_MagicSpeed += Amulet->m_AttackSpeed;
		}
	}
	// ----------------------------------------
	// Wizard Ring Effect
	// ----------------------------------------
	if ( (lpObj->pInventory[10].IsItem() == TRUE && lpObj->pInventory[10].m_Type == ITEMGET(13,20) && lpObj->pInventory[10].m_Level == 0 && lpObj->pInventory[10].m_Durability > 0.0f ) || (lpObj->pInventory[11].IsItem() == TRUE && lpObj->pInventory[11].m_Type == ITEMGET(13,20) && lpObj->pInventory[11].m_Level == 0 && lpObj->pInventory[11].m_Durability > 0.0f ) )
	{
		lpObj->m_AttackDamageMinRight += lpObj->m_AttackDamageMinRight * 10 / 100;
		lpObj->m_AttackDamageMaxRight += lpObj->m_AttackDamageMaxRight * 10 / 100;
		lpObj->m_AttackDamageMinLeft += lpObj->m_AttackDamageMinLeft * 10 / 100;
		lpObj->m_AttackDamageMaxLeft += lpObj->m_AttackDamageMaxLeft * 10 / 100;
		lpObj->m_MagicDamageMin += lpObj->m_MagicDamageMin * 10 / 100;
		lpObj->m_MagicDamageMax += lpObj->m_MagicDamageMax * 10 / 100;
		lpObj->m_AttackSpeed += 10;
		lpObj->m_MagicSpeed += 10;
	}
	// ----------------------------------------
	// Speed Hack Detect
	// ----------------------------------------
	switch ( lpObj->Class )
	{
	case CLASS_WIZARD:
		lpObj->m_DetectSpeedHackTime = (gAttackSpeedTimeLimit - (lpObj->m_MagicSpeed*2 * gDecTimePerAttackSpeed) );
		break;
	case CLASS_KNIGHT:
		lpObj->m_DetectSpeedHackTime = (gAttackSpeedTimeLimit - (lpObj->m_AttackSpeed * gDecTimePerAttackSpeed) );
		break;
	case CLASS_ELF:
		lpObj->m_DetectSpeedHackTime = (gAttackSpeedTimeLimit - (lpObj->m_AttackSpeed * gDecTimePerAttackSpeed) );
		break;
	case CLASS_MAGUMSA:
		lpObj->m_DetectSpeedHackTime = (gAttackSpeedTimeLimit - (lpObj->m_AttackSpeed * gDecTimePerAttackSpeed) );
		break;
	case CLASS_DARKLORD:
		lpObj->m_DetectSpeedHackTime = (gAttackSpeedTimeLimit - (lpObj->m_AttackSpeed * gDecTimePerAttackSpeed) );
		break;
	case CLASS_SUMMONER:
		lpObj->m_DetectSpeedHackTime = (gAttackSpeedTimeLimit - (lpObj->m_MagicSpeed*2 * gDecTimePerAttackSpeed) );
		break;
	case CLASS_FIGHTER:
		lpObj->m_DetectSpeedHackTime = (gAttackSpeedTimeLimit - (lpObj->m_MagicSpeed*2 * gDecTimePerAttackSpeed) );
		break;
	}
	
	if ( lpObj->m_DetectSpeedHackTime < gMinimumAttackSpeedTime )
	{
		lpObj->m_DetectSpeedHackTime = gMinimumAttackSpeedTime;
	}
	// ----------------------------------------
	// Successful Blocking
	// ----------------------------------------
	switch ( lpObj->Class )
	{
	case CLASS_WIZARD:		lpObj->m_SuccessfulBlocking = Dexterity / 3;	break;
	case CLASS_KNIGHT:		lpObj->m_SuccessfulBlocking = Dexterity / 3;	break;
	case CLASS_ELF:			lpObj->m_SuccessfulBlocking = Dexterity / 4;	break;
	case CLASS_MAGUMSA:		lpObj->m_SuccessfulBlocking = Dexterity / 3;	break;
	case CLASS_DARKLORD:	lpObj->m_SuccessfulBlocking = Dexterity / 7;	break;
	case CLASS_SUMMONER:	lpObj->m_SuccessfulBlocking = Dexterity / 3;	break;
	case CLASS_FIGHTER:		lpObj->m_SuccessfulBlocking = Dexterity / 5;	break;
	}
	
	if ( Left->m_Type != -1 )
	{
		if ( Left->m_IsValidItem != false )
		{
			lpObj->m_SuccessfulBlocking += Left->m_SuccessfulBlocking;
			Left->PlusSpecial(&lpObj->m_SuccessfulBlocking, 82);
		}
	}
	// ----------------------------------------
	// Character Set & Succesful Blocking
	// ----------------------------------------
	bool Success = true;

	if ( lpObj->Class == CLASS_MAGUMSA ) // Magic Gladiator (No Helmet)
	{
		for ( int j=3;j<=6;j++)
		{
			if ( lpObj->pInventory[j].m_Type == -1 )
			{
				Success = false;
				break;
			}

			if ( lpObj->pInventory[j].m_IsValidItem == false )
			{
				Success = false;
				break;
			}
		}
	}
	else if ( lpObj->Class == CLASS_FIGHTER ) // Rage Fighter (No Gloves)
	{
		for ( int l=2;l<6;l++)
		{
			if ( l != 5 )
			{
				if ( lpObj->pInventory[l].m_Type == -1 )
				{
					Success = false;
					break;
				}

				if ( lpObj->pInventory[l].m_IsValidItem == false )
				{
					Success = false;
					break;
				}
			}
		}

	}
	else // Dark Wizard, Dark Knight, Dark Lord, Elf, Summoner (All Set)
	{
		for  ( int k=2;k<=6;k++)
		{
			if ( lpObj->pInventory[k].m_Type == -1 )
			{
				Success = false;
				break;
			}

			if ( lpObj->pInventory[k].m_IsValidItem == false )
			{
				Success = false;
				break;
			}
		}
	}

	int Level11Count = 0;
	int Level10Count = 0;
	int Level12Count = 0;
	int Level13Count = 0;
	int Level14Count = 0;
	int Level15Count = 0;

	if ( Success != false )
	{
		int in;

		if ( lpObj->Class == CLASS_MAGUMSA ) // Magic Gladiator (No Helmet)
		{
			in = Armor->m_Type % MAX_SUBTYPE_ITEMS;

			if ( in != ITEMGET(0,15) &&
				 in != ITEMGET(0,20) &&
				 in != ITEMGET(0,23) &&
				 in != ITEMGET(0,32) &&
				 in != ITEMGET(0,37) )
			{
				Success = false;
			}
			else
			{
				Level15Count++;

				for (int m=3;m<=6;m++)
				{
					if ( in != ( lpObj->pInventory[m].m_Type % MAX_SUBTYPE_ITEMS) )
					{
						Success = false;
					}
					if ( lpObj->pInventory[m].m_Level > 14 )
					{
						Level15Count++;
					}
					else if ( lpObj->pInventory[m].m_Level > 13 )
					{
						Level14Count++;
					}
					else if ( lpObj->pInventory[m].m_Level > 12 )
					{
						Level13Count++;
					}
					else if ( lpObj->pInventory[m].m_Level > 11 )
					{
						Level12Count++;
					}
					else if ( lpObj->pInventory[m].m_Level > 10 )
					{
						Level11Count++;
					}
					else if ( lpObj->pInventory[m].m_Level > 9 )
					{
						Level10Count++;
					}
				}
			}
		}
		if ( lpObj->Class == CLASS_FIGHTER ) // Rage Fighter (No Gloves)
		{
			in = Boots->m_Type % MAX_SUBTYPE_ITEMS;

			if ( in != ITEMGET(0,59) &&
				 in != ITEMGET(0,60) &&
				 in != ITEMGET(0,61) )
			{
				Success = false;
			}
			else
			{
				Level15Count++;

				for (int m=2;m<=6;m++)
				{
					if (m != 5)
					{
						if ( in != ( lpObj->pInventory[m].m_Type % MAX_SUBTYPE_ITEMS) )
						{
							Success = false;
						}
						if ( lpObj->pInventory[m].m_Level > 14 )
						{
							Level15Count++;
						}
						else if ( lpObj->pInventory[m].m_Level > 13 )
						{
							Level14Count++;
						}
						else if ( lpObj->pInventory[m].m_Level > 12 )
						{
							Level13Count++;
						}
						else if ( lpObj->pInventory[m].m_Level > 11 )
						{
							Level12Count++;
						}
						else if ( lpObj->pInventory[m].m_Level > 10 )
						{
							Level11Count++;
						}
						else if ( lpObj->pInventory[m].m_Level > 9 )
						{
							Level10Count++;
						}
					}
				}
			}
		}
		else // Dark Knight, Dark Wizard, Elf, Dark Lord, Summoner (All Set)
		{
			in = lpObj->pInventory[2].m_Type % MAX_SUBTYPE_ITEMS;

			for (int m=2;m<=6;m++)
			{
				if ( in !=  ( lpObj->pInventory[m].m_Type % MAX_SUBTYPE_ITEMS) )
				{
					Success = false;
				}
				if ( lpObj->pInventory[m].m_Level > 14 )
				{
					Level15Count++;
				}
				else if ( lpObj->pInventory[m].m_Level > 13 )
				{
					Level14Count++;
				}
				else if ( lpObj->pInventory[m].m_Level > 12 )
				{
					Level13Count++;
				}
				else if ( lpObj->pInventory[m].m_Level > 11 )
				{
					Level12Count++;
				}
				else if ( lpObj->pInventory[m].m_Level > 10 )
				{
					Level11Count++;
				}
				else if ( lpObj->pInventory[m].m_Level > 9 )
				{
					Level10Count++;
				}
			}
		}

		if ( Success != false )	// #warning unuseful if
		{
			lpObj->m_SuccessfulBlocking += lpObj->m_SuccessfulBlocking / 10;
		}
	}
	// ----------------------------------------
	// Character Defense
	// ----------------------------------------
	switch ( lpObj->Class )
	{
	case CLASS_WIZARD:		lpObj->m_Defense = Dexterity / 4;	break;
	case CLASS_KNIGHT:		lpObj->m_Defense = Dexterity / 3;	break;
	case CLASS_ELF:			lpObj->m_Defense = Dexterity / 10;	break;
	case CLASS_MAGUMSA:		lpObj->m_Defense = Dexterity / 4;	break;
	case CLASS_DARKLORD:	lpObj->m_Defense = Dexterity / 7;	break;
	case CLASS_SUMMONER:	lpObj->m_Defense = Dexterity / 4;	break;
	case CLASS_FIGHTER:		lpObj->m_Defense = Dexterity / 4;	break;
	}
	
	if ( lpObj->Class == CLASS_MAGUMSA ) // Magic Gladiator (No Helm)
	{
		lpObj->m_Defense += Armor->ItemDefense();
		lpObj->m_Defense += Pants->ItemDefense();
		lpObj->m_Defense += Gloves->ItemDefense();
		lpObj->m_Defense += Boots->ItemDefense();
		lpObj->m_Defense += Left->ItemDefense();
		lpObj->m_Defense += Wings->ItemDefense();
	}
	else if ( lpObj->Class == CLASS_FIGHTER ) // Rage Fighter (No Gloves)
	{
		lpObj->m_Defense += Helm->ItemDefense();
		lpObj->m_Defense += Armor->ItemDefense();
		lpObj->m_Defense += Pants->ItemDefense();
		lpObj->m_Defense += Boots->ItemDefense();
		lpObj->m_Defense += Left->ItemDefense();
		lpObj->m_Defense += Wings->ItemDefense();
	}
	else // Dark Wizard, Dark Knight, Elf, Dark Lord, Summoner (All Set)
	{
		lpObj->m_Defense += Helm->ItemDefense();
		lpObj->m_Defense += Armor->ItemDefense();
		lpObj->m_Defense += Pants->ItemDefense();
		lpObj->m_Defense += Gloves->ItemDefense();
		lpObj->m_Defense += Boots->ItemDefense();
		lpObj->m_Defense += Left->ItemDefense();
		lpObj->m_Defense += Wings->ItemDefense();
	}

	if ( Helper->IsItem() != FALSE )
	{
		if ( Helper->m_Type == ITEMGET(13,4) && Helper->m_Durability > 0.0f ) // Dark Horse
		{
			lpObj->m_Defense += INT( Dexterity / 20 + 5 + Helper->m_PetItem_Level * 2 );
		}
	}

	if ( (Level15Count + Level14Count + Level13Count + Level12Count + Level11Count + Level10Count) >= 5 )
	{
		if ( Success != false )
		{
			if ( Level15Count == 5 )
			{
				lpObj->m_Defense += lpObj->m_Defense * 30 / 100;
			}
			else if ( Level14Count == 5 || (Level14Count + Level15Count) == 5 )
			{
				lpObj->m_Defense += lpObj->m_Defense * 25 / 100;
			}
			else if ( Level13Count == 5 || (Level13Count + Level14Count + Level15Count) == 5 )
			{
				lpObj->m_Defense += lpObj->m_Defense * 20 / 100;
			}
			else if ( Level12Count == 5 || (Level12Count + Level13Count + Level14Count + Level15Count) == 5 )
			{
				lpObj->m_Defense += lpObj->m_Defense * 15 / 100;
			}
			else if ( Level11Count == 5 || (Level11Count + Level12Count + Level13Count + Level14Count + Level15Count) == 5 )
			{
				lpObj->m_Defense += lpObj->m_Defense * 10 / 100;
			}
			else if ( Level10Count == 5 || (Level10Count + Level11Count + Level12Count + Level13Count + Level14Count + Level15Count) == 5)
			{
				lpObj->m_Defense += lpObj->m_Defense * 5 / 100;
			}
		}
	}

	lpObj->m_Defense = lpObj->m_Defense * 10 / 20;
	// ----------------------------------------
	// Transformation Rings
	// ----------------------------------------
	if ( lpObj->m_Change == 9 ) // Thunder Lich Change
	{
		// Add Magic Power Here
	}
	else if ( lpObj->m_Change == 41 ) // Death Cow Change
	{
		lpObj->AddLife = ((int)(lpObj->MaxLife * 20.0f))/100;
	}
	else if ( lpObj->m_Change == 372 ) // Don't Know
	{
		lpObj->m_Defense += lpObj->m_Defense / 10;
		lpObj->AddLife += lpObj->Level;
	}
	// ----------------------------------------
	// Pets
	// ----------------------------------------
	if ( Helper->m_Type == ITEMGET(13,0) ) // Guardian Angel
	{
		lpObj->AddLife += 50;
	}
	else if ( Helper->m_Type == ITEMGET(13,1) ) // Imp
	{
		//Add 30% to Attack
		lpObj->m_AttackDamageMinLeft	+= (lpObj->m_AttackDamageMinLeft*30)/100;
		lpObj->m_AttackDamageMaxLeft	+= (lpObj->m_AttackDamageMaxLeft*30)/100;
		lpObj->m_AttackDamageMinRight	+= (lpObj->m_AttackDamageMinRight*30)/100;
		lpObj->m_AttackDamageMaxRight	+= (lpObj->m_AttackDamageMaxRight*30)/100;
		//Add 30% to Magic Attack
		lpObj->m_MagicDamageMin			+= (lpObj->m_MagicDamageMin*30)/100;
		lpObj->m_MagicDamageMax			+= (lpObj->m_MagicDamageMax*30)/100;
	}
	else if ( Helper->m_Type == ITEMGET(13,3) ) // Dinorant
	{
		//Helper->PlusSpecial(&lpObj->AddBP, 103 );
		//Add 15% to Attack
		lpObj->m_AttackDamageMinLeft	+= (lpObj->m_AttackDamageMinLeft*15)/100;
		lpObj->m_AttackDamageMaxLeft	+= (lpObj->m_AttackDamageMaxLeft*15)/100;
		lpObj->m_AttackDamageMinRight	+= (lpObj->m_AttackDamageMinRight*15)/100;
		lpObj->m_AttackDamageMaxRight	+= (lpObj->m_AttackDamageMaxRight*15)/100;
		//Add 15% to Magic Attack
		lpObj->m_MagicDamageMin			+= (lpObj->m_MagicDamageMin*15)/100;
		lpObj->m_MagicDamageMax			+= (lpObj->m_MagicDamageMax*15)/100;
	}
	else if ( Helper->m_Type == ITEMGET(13,64) ) // Demon
	{
		//Add 40% to Attack
		lpObj->m_AttackDamageMinLeft	+= (lpObj->m_AttackDamageMinLeft*40)/100;
		lpObj->m_AttackDamageMaxLeft	+= (lpObj->m_AttackDamageMaxLeft*40)/100;
		lpObj->m_AttackDamageMinRight	+= (lpObj->m_AttackDamageMinRight*40)/100;
		lpObj->m_AttackDamageMaxRight	+= (lpObj->m_AttackDamageMaxRight*40)/100;
		//Add +10 to Attack Speed
		lpObj->m_MagicSpeed += 10;
		lpObj->m_AttackSpeed += 10;
		//Add 40% to Magic Attack
		lpObj->m_MagicDamageMin			+= (lpObj->m_MagicDamageMin*40)/100;
		lpObj->m_MagicDamageMax			+= (lpObj->m_MagicDamageMax*40)/100;
	}
	else if ( Helper->m_Type == ITEMGET(13,65) ) // Spirit Guardian
	{
		lpObj->AddLife					+= 50;
	}
	else if ( Helper->m_Type == ITEMGET(13,80) ) // Pet Panda
	{
		lpObj->m_Defense				+= 50;
	}
	else if ( Helper->m_Type == ITEMGET(13,123) ) // Skeleton Pet
	{
		//Add 20% to Attack
		lpObj->m_AttackDamageMinLeft	+= (lpObj->m_AttackDamageMinLeft*20)/100;
		lpObj->m_AttackDamageMaxLeft	+= (lpObj->m_AttackDamageMaxLeft*20)/100;
		lpObj->m_AttackDamageMinRight	+= (lpObj->m_AttackDamageMinRight*20)/100;
		lpObj->m_AttackDamageMaxRight	+= (lpObj->m_AttackDamageMaxRight*20)/100;
		//Add +10 to Attack Speed
		lpObj->m_MagicSpeed += 10;
		lpObj->m_AttackSpeed += 10;
		//Add 20% to Magic Attack
		lpObj->m_MagicDamageMin			+= (lpObj->m_MagicDamageMin*20)/100;
		lpObj->m_MagicDamageMax			+= (lpObj->m_MagicDamageMax*20)/100;
	}
	int addlife = 0;
	int addmana = 0;

	Wings->PlusSpecial(&addlife, 100);
	Wings->PlusSpecial(&addmana, 101);
	Wings->PlusSpecial(&AddLeadership, 105);
	lpObj->AddLeadership = AddLeadership;
	lpObj->AddLife += addlife;
	lpObj->AddMana += addmana;

	if ( lpObj->Type == OBJ_USER )
	{
		gDarkSpirit[lpObj->m_Index].Set(lpObj->m_Index, &lpObj->pInventory[1]);
	}

	Amulet->PlusSpecialPercentEx(&lpObj->AddBP, lpObj->MaxBP, 173);
	Ring01->PlusSpecialPercentEx(&lpObj->AddMana, lpObj->MaxMana, 172);
	Ring02->PlusSpecialPercentEx(&lpObj->AddMana, lpObj->MaxMana, 172);

	CItem * rItem[3];
	int comparecount = 0;
	
	rItem[0] = &lpObj->pInventory[10];
	rItem[1] = &lpObj->pInventory[11];
	rItem[2] = &lpObj->pInventory[9];

#define GET_MAX_RESISTANCE(x,y,z) ( ( ( ( (x) > (y) ) ? (x) : (y) ) > (z) ) ? ( ( (x) > (y) ) ? (x) : (y) ) : (z) )	

	lpObj->m_Resistance[1] = GET_MAX_RESISTANCE(rItem[0]->m_Resistance[1], rItem[1]->m_Resistance[1], rItem[2]->m_Resistance[1]);
	lpObj->m_Resistance[0] = GET_MAX_RESISTANCE(rItem[0]->m_Resistance[0], rItem[1]->m_Resistance[0], rItem[2]->m_Resistance[0]);
	lpObj->m_Resistance[2] = GET_MAX_RESISTANCE(rItem[0]->m_Resistance[2], rItem[1]->m_Resistance[2], rItem[2]->m_Resistance[2]);
	lpObj->m_Resistance[3] = GET_MAX_RESISTANCE(rItem[0]->m_Resistance[3], rItem[1]->m_Resistance[3], rItem[2]->m_Resistance[3]);
	lpObj->m_Resistance[4] = GET_MAX_RESISTANCE(rItem[0]->m_Resistance[4], rItem[1]->m_Resistance[4], rItem[2]->m_Resistance[4]);
	lpObj->m_Resistance[5] = GET_MAX_RESISTANCE(rItem[0]->m_Resistance[5], rItem[1]->m_Resistance[5], rItem[2]->m_Resistance[5]);
	lpObj->m_Resistance[6] = GET_MAX_RESISTANCE(rItem[0]->m_Resistance[6], rItem[1]->m_Resistance[6], rItem[2]->m_Resistance[6]);


	g_Item380System.ApplyFor380Option(lpObj);
	g_kJewelOfHarmonySystem.SetApplyStrengthenItem(lpObj);
	gItemSocket.ApplyEffect(lpObj);
	gSkillTree.ApplyEffect(lpObj);

	GObjExtItemApply(lpObj);
	gObjSetItemApply(lpObj);
	gObjNextExpCal(lpObj);

	if ( (Left->m_Type >= ITEMGET(4,0) && Left->m_Type < ITEMGET(4,7) ) ||
		  Left->m_Type == ITEMGET(4,17) ||
		  Left->m_Type == ITEMGET(4,20) ||
		  Left->m_Type == ITEMGET(4,21) ||
		  Left->m_Type == ITEMGET(4,22) ||
		  Left->m_Type == ITEMGET(4,23) ||
		  Left->m_Type == ITEMGET(4,24)  )
	{
		if ( Right->m_Type == ITEMGET(4,15) && Right->m_Level == 1 )
		{
			lpObj->m_AttackDamageMinLeft += (WORD)(lpObj->m_AttackDamageMinLeft * 0.03f + 1.0f);
			lpObj->m_AttackDamageMaxLeft += (WORD)(lpObj->m_AttackDamageMaxLeft * 0.03f + 1.0f);
		}
		else if ( Right->m_Type == ITEMGET(4,15) && Right->m_Level == 2 )
		{
			lpObj->m_AttackDamageMinLeft += (WORD)(lpObj->m_AttackDamageMinLeft * 0.05f + 1.0f);
			lpObj->m_AttackDamageMaxLeft += (WORD)(lpObj->m_AttackDamageMaxLeft * 0.05f + 1.0f);
		}
	}
	else if ( (Right->m_Type >= ITEMGET(4,8) && Right->m_Type < ITEMGET(4,15) ) ||
		      (Right->m_Type >= ITEMGET(4,16) && Right->m_Type < ITEMGET(5,0)) )
	{
		if ( Left->m_Type == ITEMGET(4,7) && Left->m_Level == 1 )
		{
				lpObj->m_AttackDamageMinRight += (WORD)(lpObj->m_AttackDamageMinRight * 0.03f + 1.0f);
				lpObj->m_AttackDamageMaxRight += (WORD)(lpObj->m_AttackDamageMaxRight * 0.03f + 1.0f);
		}
		else if ( Left->m_Type == ITEMGET(4,7) && Left->m_Level == 2 )
		{
				lpObj->m_AttackDamageMinRight += (WORD)(lpObj->m_AttackDamageMinRight * 0.05f + 1.0f);
				lpObj->m_AttackDamageMaxRight += (WORD)(lpObj->m_AttackDamageMaxRight * 0.05f + 1.0f);
		}
	}

	if ( lpObj->Class == CLASS_KNIGHT || lpObj->Class == CLASS_MAGUMSA || lpObj->Class == CLASS_DARKLORD || lpObj->Class == CLASS_FIGHTER )
	{
		if ( Right->m_Type != -1 && Left->m_Type != -1 )
		{
			if ( Right->m_Type >= ITEMGET(0,0) && Right->m_Type < ITEMGET(4,0) && Left->m_Type >= ITEMGET(0,0) && Left->m_Type < ITEMGET(4,0) )
			{
				lpObj->m_AttackDamageMinRight = lpObj->m_AttackDamageMinRight * 55 / 100;
				lpObj->m_AttackDamageMaxRight = lpObj->m_AttackDamageMaxRight * 55 / 100;
				lpObj->m_AttackDamageMinLeft = lpObj->m_AttackDamageMinLeft * 55 / 100;
				lpObj->m_AttackDamageMaxLeft = lpObj->m_AttackDamageMaxLeft * 55 / 100;
			}
		}
	}

	if ( lpObj->m_iItemEffectValidTime > 0 )
	{
		g_ItemAddOption.NextSetItemLastEffectForHallowin(lpObj);
	}

	gObjCalcShieldPoint(lpObj);

	if ( lpObj->iShield > ( lpObj->iMaxShield + lpObj->iAddShield ) )
	{
		lpObj->iShield = lpObj->iMaxShield + lpObj->iAddShield ;
		GCReFillSend(lpObj->m_Index, lpObj->Life, 0xFF, 0, lpObj->iShield);
	}

	GCReFillSend(lpObj->m_Index, lpObj->MaxLife + lpObj->AddLife, 0xFE, 0, lpObj->iMaxShield + lpObj->iAddShield);
	GCManaSend(lpObj->m_Index, lpObj->MaxMana + lpObj->AddMana, 0xFE, 0, lpObj->MaxBP + lpObj->AddBP);
}
void CheckItemOptForGetExpEx(LPOBJ lpObj,__int64 & iExp,int bRewardExp)
{
	__int64 iRetExp = iExp;
	int iAddExpRate = 100;

	if ( gObjCheckUsedBuffEffect(lpObj, AT_CSHOP_SEAL_OF_SUSTENANCE) || gObjCheckUsedBuffEffect(lpObj, AT_PCBANG_SEAL_OF_SUSTENANCE) )
	{
		iRetExp = 0;
	}
	else if (
		 gObjCheckUsedBuffEffect(lpObj, AT_CSHOP_SEAL_OF_ASCENSION)
      || gObjCheckUsedBuffEffect(lpObj, AT_CSHOP_SEAL_OF_WEALTH)
      || gObjCheckUsedBuffEffect(lpObj, AT_PCBANG_SEAL_OF_ASCENSION)
      || gObjCheckUsedBuffEffect(lpObj, AT_PCBANG_SEAL_OF_WEALTH)
      || gObjCheckUsedBuffEffect(lpObj, AT_CSHOP_SEAL_OF_HEALING)
      || gObjCheckUsedBuffEffect(lpObj, AT_CSHOP_MASTER_SEAL_OF_ASCENSION)
      || gObjCheckUsedBuffEffect(lpObj, AT_CSHOP_MASTER_SEAL_OF_WEALTH) )
    {
		iAddExpRate = gObjGetTotalValueOfEffect(lpObj, ADD_OPTION_EXPERIENCE);
		
		if( g_MasterExp.IsEnabled(lpObj) )
		{
			if ( gObjCheckUsedBuffEffect(lpObj, AT_CSHOP_MASTER_SEAL_OF_ASCENSION) || gObjCheckUsedBuffEffect(lpObj, AT_CSHOP_MASTER_SEAL_OF_WEALTH) )
			{
				if ( bRewardExp )
					iAddExpRate = 100;
			}
			else
			{
				iAddExpRate = 100;
			}
		}
		else
		{
			if ( gObjCheckUsedBuffEffect(lpObj, AT_CSHOP_MASTER_SEAL_OF_ASCENSION) || gObjCheckUsedBuffEffect(lpObj, AT_CSHOP_MASTER_SEAL_OF_WEALTH) )
			{
				iAddExpRate = 100;
			}
			else
			{
				if ( bRewardExp )
					iAddExpRate = 100;
			}
		}
		//iRetExp = iRetExp * iAddExpRate / 100;
    }
	else if ( gObjCheckUsedBuffEffect(lpObj, AT_PARTY_EXP_BONUS) )
	{
        iAddExpRate = 190;

        if ( lpObj->PartyNumber >= 0 )
		{
			for (int i = 0; i < MAX_USER_IN_PARTY; ++i )
			{
				LPOBJ lpPartyObj = &gObj[gParty.m_PartyS[lpObj->PartyNumber].Number[i]]; // wz bug ? need to check for -1
				int iPartyDis = gObjCalDistance(lpObj, lpObj);
				
				if ( lpObj->m_Index != lpPartyObj->m_Index && lpObj->MapNumber == lpPartyObj->MapNumber && iPartyDis < 10 )
					iAddExpRate += 10;
			}
        }
        
		// g_MasterLevelSystem.IsMasterLevelUser(lpObj) )
		if ( bRewardExp || g_MasterExp.IsEnabled(lpObj) )
			iAddExpRate = 100;
		
		//iRetExp = iRetExp * iAddExpRate / 100;
	}
	else if ( gObjCheckUsedBuffEffect(lpObj, AT_NEWPVPSYSTEM_REWARD) )
	{
		// g_MasterLevelSystem.IsMasterLevelUser(lpObj) )
		if( g_MasterExp.IsEnabled(lpObj) )
			return; // webzen error ? ...

#if (ENABLETEST_NEWPVP == 1)
        if (g_NewPVP.IsVulcanusMap(lpObj->MapNumber) && iRetExp == iExp) {
			iExp = iRetExp * gObjGetTotalValueOfEffect(lpObj, 60) / 100 + iRetExp;
			return;
		}
#endif
	}

	if( (lpObj->pInventory[10].IsItem() && lpObj->pInventory[10].m_Type == ITEMGET(13,77) && lpObj->pInventory[10].m_Durability > 0.0 &&  !lpObj->pInventory[10].m_bExpired) ||
		(lpObj->pInventory[11].IsItem() && lpObj->pInventory[11].m_Type == ITEMGET(13,77) && lpObj->pInventory[11].m_Durability > 0.0 &&  !lpObj->pInventory[11].m_bExpired))
	{
		if( gObjCheckUsedBuffEffect(lpObj,AT_CSHOP_SEAL_OF_SUSTENANCE) || gObjCheckUsedBuffEffect(lpObj,AT_PCBANG_SEAL_OF_SUSTENANCE) )
		{
			iRetExp = 0;
		}
		else
		{
			if( bRewardExp )
			{
				iAddExpRate = 100;
			}
			else
			{
				iAddExpRate += 30;
			}
			
			//iRetExp = iRetExp * iAddExpRate / 100;
		}
	}
	if( (lpObj->pInventory[10].IsItem() && lpObj->pInventory[10].m_Type == ITEMGET(13,78) && lpObj->pInventory[10].m_Durability > 0.0 &&  !lpObj->pInventory[10].m_bExpired) ||
		(lpObj->pInventory[11].IsItem() && lpObj->pInventory[11].m_Type == ITEMGET(13,78) && lpObj->pInventory[11].m_Durability > 0.0 &&  !lpObj->pInventory[11].m_bExpired))
	{
		if( gObjCheckUsedBuffEffect(lpObj,AT_CSHOP_SEAL_OF_SUSTENANCE) || gObjCheckUsedBuffEffect(lpObj,AT_PCBANG_SEAL_OF_SUSTENANCE) )
		{
			iRetExp = 0;
		}
		else
		{
			if( bRewardExp )
			{
				iAddExpRate = 100;
			}
			else
			{
				iAddExpRate += 50;
			}
			
			//iRetExp = iRetExp * iAddExpRate / 100;
		}
	}

	if( lpObj->pInventory[8].IsItem() && lpObj->pInventory[8].m_Type == ITEMGET(13,80) && lpObj->pInventory[8].m_Durability > 0.0 && !lpObj->pInventory[8].m_bExpired )
	{
		if( gObjCheckUsedBuffEffect(lpObj,AT_CSHOP_SEAL_OF_SUSTENANCE) || gObjCheckUsedBuffEffect(lpObj,AT_PCBANG_SEAL_OF_SUSTENANCE) )
		{
			iRetExp = 0;
		}
		else
		{
			if( bRewardExp )
			{
				iAddExpRate = 100;
			}
			else
			{
				iAddExpRate += 50;
			}

			//iRetExp = iRetExp * iAddExpRate / 100;
		}
	}

	if( lpObj->pInventory[8].IsItem() && lpObj->pInventory[8].m_Type == ITEMGET(13,123) && lpObj->pInventory[8].m_Durability > 0.0 && !lpObj->pInventory[8].m_bExpired )
	{
		if( gObjCheckUsedBuffEffect(lpObj,AT_CSHOP_SEAL_OF_SUSTENANCE) || gObjCheckUsedBuffEffect(lpObj,AT_PCBANG_SEAL_OF_SUSTENANCE) )
		{
			iRetExp = 0;
		}
		else
		{
			if( bRewardExp )
			{
				iAddExpRate = 100;
			}
			else
			{
				iAddExpRate += 30;
			}

			//iRetExp = iRetExp * iAddExpRate / 100;
		}
	}

	if(((lpObj->pInventory[8].IsItem() && lpObj->pInventory[8].m_Type == ITEMGET(13,80)  && lpObj->pInventory[8].m_Durability > 0.0 &&  !lpObj->pInventory[8].m_bExpired) ||
		(lpObj->pInventory[8].IsItem() && lpObj->pInventory[8].m_Type == ITEMGET(13,123) && lpObj->pInventory[8].m_Durability > 0.0 &&  !lpObj->pInventory[8].m_bExpired)) &&

	   ((lpObj->pInventory[10].IsItem() && lpObj->pInventory[10].m_Type == ITEMGET(13,76) && lpObj->pInventory[10].m_Durability > 0.0 &&  !lpObj->pInventory[10].m_bExpired) ||
		(lpObj->pInventory[11].IsItem() && lpObj->pInventory[11].m_Type == ITEMGET(13,76) && lpObj->pInventory[11].m_Durability > 0.0 &&  !lpObj->pInventory[11].m_bExpired) ||

		(lpObj->pInventory[10].IsItem() && lpObj->pInventory[10].m_Type == ITEMGET(13,77) && lpObj->pInventory[10].m_Durability > 0.0 &&  !lpObj->pInventory[10].m_bExpired) ||
		(lpObj->pInventory[11].IsItem() && lpObj->pInventory[11].m_Type == ITEMGET(13,77) && lpObj->pInventory[11].m_Durability > 0.0 &&  !lpObj->pInventory[11].m_bExpired) ||

		(lpObj->pInventory[10].IsItem() && lpObj->pInventory[10].m_Type == ITEMGET(13,78) && lpObj->pInventory[10].m_Durability > 0.0 &&  !lpObj->pInventory[10].m_bExpired) ||
		(lpObj->pInventory[11].IsItem() && lpObj->pInventory[11].m_Type == ITEMGET(13,78) && lpObj->pInventory[11].m_Durability > 0.0 &&  !lpObj->pInventory[11].m_bExpired) ||
		
		(lpObj->pInventory[10].IsItem() && lpObj->pInventory[10].m_Type == ITEMGET(13,122) && lpObj->pInventory[10].m_Durability > 0.0 &&  !lpObj->pInventory[10].m_bExpired) ||
		(lpObj->pInventory[11].IsItem() && lpObj->pInventory[11].m_Type == ITEMGET(13,122) && lpObj->pInventory[11].m_Durability > 0.0 &&  !lpObj->pInventory[11].m_bExpired) ))
	{
		if( gObjCheckUsedBuffEffect(lpObj,AT_CSHOP_SEAL_OF_SUSTENANCE) || gObjCheckUsedBuffEffect(lpObj,AT_PCBANG_SEAL_OF_SUSTENANCE) )
		{
			iRetExp = 0;
		}
		else
		{
			if( bRewardExp )
			{
				iAddExpRate = 100;
			}
			else
			{
				iAddExpRate += 30;
			}
			
			//iRetExp = iRetExp * iAddExpRate / 100;
		}
	}

	iRetExp = iRetExp * iAddExpRate / 100;

#if ( __CUSTOM__ == 1)
	if( !g_MasterExp.IsEnabled(lpObj) )
	{
		iRetExp = gCustomExp.GetResetExp(lpObj,iRetExp);
	}
#endif
	iExp = iRetExp;
}
void gObjSetItemApply(LPOBJ lpObj)
{
	lpObj->m_AttackDamageMinLeft += lpObj->SetOpAddAttackDamage;
	lpObj->m_AttackDamageMaxLeft += lpObj->SetOpAddAttackDamage;
	lpObj->m_AttackDamageMinRight += lpObj->SetOpAddAttackDamage;
	lpObj->m_AttackDamageMaxRight += lpObj->SetOpAddAttackDamage;

	lpObj->m_AttackDamageMinLeft += lpObj->SetOpAddMinAttackDamage;
	lpObj->m_AttackDamageMinRight += lpObj->SetOpAddMinAttackDamage;

	lpObj->m_AttackDamageMaxLeft += lpObj->SetOpAddMaxAttackDamage;
	lpObj->m_AttackDamageMaxRight += lpObj->SetOpAddMaxAttackDamage;

	lpObj->m_MagicDamageMin += lpObj->m_MagicDamageMin * lpObj->SetOpAddMagicPower / 100;
	lpObj->m_MagicDamageMax += lpObj->m_MagicDamageMax * lpObj->SetOpAddMagicPower / 100;

	lpObj->AddLife += INT(lpObj->AddVitality * gCharInfo.sCharInfo[lpObj->Class].VitalityToLife);
	lpObj->AddMana += INT(lpObj->AddEnergy * gCharInfo.sCharInfo[lpObj->Class].EnergyToMana);

	lpObj->m_CriticalDamage += lpObj->SetOpAddCriticalDamageSuccessRate;
	lpObj->m_ExcelentDamage += lpObj->SetOpAddExDamageSuccessRate;

	if ( lpObj->pInventory[10].IsSetItem() )
	{
		lpObj->pInventory[10].PlusSpecialSetRing((LPBYTE)lpObj->m_AddResistance);
	}

	if ( lpObj->pInventory[11].IsSetItem() )
	{
		lpObj->pInventory[11].PlusSpecialSetRing((LPBYTE)lpObj->m_AddResistance);
	}

	if ( lpObj->pInventory[9].IsSetItem() )
	{
		lpObj->pInventory[9].PlusSpecialSetRing((LPBYTE)lpObj->m_AddResistance);
	}

	if ( lpObj->SetOpTwoHandSwordImproveDamage )
	{
		if ( !lpObj->pInventory[1].IsItem() && !lpObj->pInventory[0].IsItem() )
		{
			lpObj->SetOpTwoHandSwordImproveDamage = 0;
		}

		if ( lpObj->pInventory[1].IsItem() && lpObj->pInventory[1].m_TwoHand == FALSE )
		{
			lpObj->SetOpTwoHandSwordImproveDamage = 0;
		}

		if ( lpObj->pInventory[0].IsItem() && lpObj->pInventory[0].m_TwoHand == FALSE )
		{
			lpObj->SetOpTwoHandSwordImproveDamage = 0;
		}
	}

	if ( (lpObj->MaxLife + lpObj->AddLife ) < lpObj->Life )
	{
		lpObj->Life = lpObj->MaxLife + lpObj->AddLife;
		GCReFillSend(lpObj->m_Index, lpObj->Life, 0xFF, 0, lpObj->iShield);
	}

	gObjSetBP(lpObj->m_Index);

	if ( (lpObj->MaxMana + lpObj->AddMana ) < lpObj->Mana )
	{
		lpObj->Mana = lpObj->MaxMana + lpObj->AddMana;
		GCManaSend(lpObj->m_Index, lpObj->Mana, 0xFF, 0, lpObj->BP);
	}

	lpObj->m_Defense += lpObj->SetOpAddDefence * 10 / 20;
	lpObj->m_Defense += lpObj->m_Defense * lpObj->SetOpAddDefenceRate / 100;

	if ( lpObj->pInventory[1].m_Type >= ITEMGET(6,0) && lpObj->pInventory[1].m_Type < ITEMGET(7,0) )
	{
		lpObj->m_Defense += lpObj->m_Defense * lpObj->SetOpImproveSheldDefence / 100;
	}
}
void GObjExtItemApply(LPOBJ lpObj)
{

	int n;
	int i;
	int max_count = 0;
	int temp_n[3] = {0, 1, 9};
	int temp_n2[10] = {2, 3, 4, 5, 6, 7, 8, 10, 11, 1};
	int maxn2_loop = 9;

	for ( i=0;i<3;i++ )
	{
		n = temp_n[i];

		if ( lpObj->pInventory[n].m_Type >= ITEMGET(6, 0) && lpObj->pInventory[n].m_Type < ITEMGET(7, 0) )
			continue;

		if ( lpObj->pInventory[n].IsItem() == TRUE )
		{
			if ( lpObj->pInventory[n].m_Durability != 0.0f )
			{
				if ( lpObj->pInventory[n].m_IsValidItem == true )
				{
					if ( lpObj->pInventory[n].IsExtAttackRate() )
					{
						if ( ( lpObj->pInventory[n].m_Type >= ITEMGET(5, 0) && lpObj->pInventory[n].m_Type < ITEMGET(6, 0) ) ||
							lpObj->pInventory[n].m_Type == ITEMGET(13,12) ||
							lpObj->pInventory[n].m_Type == ITEMGET(13,25) ||
							lpObj->pInventory[n].m_Type == ITEMGET(13,27) )
						{
							lpObj->m_MagicDamageMax += lpObj->Level / 20;
							lpObj->m_MagicDamageMin += lpObj->Level / 20;
						}
						else 
						{
							if ( n == 0 || n == 9 )
							{
								lpObj->m_AttackDamageMinRight += lpObj->Level / 20;
								lpObj->m_AttackDamageMaxRight += lpObj->Level / 20;
							}
							
							if ( n == 1 || n == 9 )
							{
								lpObj->m_AttackDamageMinLeft += lpObj->Level / 20;
								lpObj->m_AttackDamageMaxLeft += lpObj->Level / 20;
							}
						}
					}

					if ( lpObj->pInventory[n].IsExtAttackRate2() )
					{
						if ( ( lpObj->pInventory[n].m_Type >= ITEMGET(5, 0) && lpObj->pInventory[n].m_Type < ITEMGET(6, 0) ) ||
							lpObj->pInventory[n].m_Type == ITEMGET(13,12) ||
							lpObj->pInventory[n].m_Type == ITEMGET(13,25) ||
							lpObj->pInventory[n].m_Type == ITEMGET(13,27) )
						{
							lpObj->m_MagicDamageMax += lpObj->m_MagicDamageMax * lpObj->pInventory[n].IsExtAttackRate2() / 100;
							lpObj->m_MagicDamageMin += lpObj->m_MagicDamageMin * lpObj->pInventory[n].IsExtAttackRate2() / 100;
						}
						else 
						{
							if ( n == 0 || n == 9 )
							{
								lpObj->m_AttackDamageMinRight += lpObj->m_AttackDamageMinRight * lpObj->pInventory[n].IsExtAttackRate2() / 100;
								lpObj->m_AttackDamageMaxRight += lpObj->m_AttackDamageMaxRight * lpObj->pInventory[n].IsExtAttackRate2() / 100;
							}
							
							if ( n == 1 || n == 9 )
							{
								lpObj->m_AttackDamageMinLeft += lpObj->m_AttackDamageMinLeft * lpObj->pInventory[n].IsExtAttackRate2() / 100;
								lpObj->m_AttackDamageMaxLeft += lpObj->m_AttackDamageMaxLeft * lpObj->pInventory[n].IsExtAttackRate2() / 100;
							}
						}
					}

					lpObj->m_ExcelentDamage += lpObj->pInventory[n].IsExtExcellentDamage();
					lpObj->m_AttackSpeed += lpObj->pInventory[n].IsExtAttackSpeed();
					lpObj->m_MagicSpeed += lpObj->pInventory[n].IsExtAttackSpeed();
					lpObj->MonsterDieGetLife += lpObj->pInventory[n].IsExtMonsterDieLife();
					lpObj->MonsterDieGetMana += lpObj->pInventory[n].IsExtMonsterDieMana();
				}
			}
		}
	}
		
	if ( lpObj->pInventory[1].IsItem() == TRUE )
	{
		if ( lpObj->pInventory[1].m_Type >= ITEMGET(6, 0) && lpObj->pInventory[1].m_Type <= ITEMGET(6, 21) )
		{
			maxn2_loop = 10;
		}
	}

	for ( i=0;i<maxn2_loop;i++)
	{
		n = temp_n2[i];

		if ( max_count < 8 )
		{
			if ( lpObj->pInventory[n].IsItem() == TRUE &&
				 lpObj->pInventory[n].IsExtItem() &&
				 lpObj->pInventory[n].m_Durability != 0.0f &&
				 lpObj->pInventory[n].m_IsValidItem == true )
			{
				if ( n != 7 )	// #warning this will unselect ONLY wings
				{
					lpObj->AddLife += (short)(lpObj->MaxLife * lpObj->pInventory[n].IsExtLifeAdd()  / 100.0f);	// #stat
					lpObj->AddMana += (short)(lpObj->MaxMana * lpObj->pInventory[n].IsExtManaAdd() / 100.0f);	// #stat
					lpObj->m_SuccessfulBlocking += lpObj->m_SuccessfulBlocking * lpObj->pInventory[n].IsExtDefenseSuccessfull() / 100;
					lpObj->MonsterDieGetMoney += lpObj->pInventory[n].IsExtMonsterMoney();
					lpObj->DamageMinus += lpObj->pInventory[n].IsExtDamageMinus();
					lpObj->DamageReflect += lpObj->pInventory[n].IsExtDamageReflect();
					max_count++;
				}
			}
		}
	}

	lpObj->AddLife += lpObj->m_SkillAddLife;
	lpObj->AddLife += lpObj->m_RageFighterSkillFitnessAddLife;
}
示例#22
0
void CCashShop::MakeItemList(CASHSHOP_ITEM_STATUS * lpItemStatus, sellItem * lpItemSellInfo)
{
	int iIndex = 0;
	int iItemCount = lpItemSellInfo->dwPriceCount;
	int iCategory = lpItemSellInfo->dwCategoryID;
	int iItemIndex = this->iCashItemCountInCategory[iCategory];
	int iBranchType = 0;
	int iItemPrice = 0;
	int iItemSaleRate = 0;

	for ( iIndex=0;iIndex<iItemCount;iIndex++)
	{
		iBranchType = this->GetBranchType(lpItemSellInfo->dwItemGuid);
		this->CashItemList[iCategory][iItemIndex+iIndex].dwItemGuid = lpItemSellInfo->dwItemGuid;
		this->CashItemList[iCategory][iItemIndex+iIndex].dwPriceGuid = lpItemSellInfo->itemPrice[iIndex].dwPriceGuid;
		this->CashItemList[iCategory][iItemIndex+iIndex].btCategoryCode = iCategory;
		this->CashItemList[iCategory][iItemIndex+iIndex].btItemType = lpItemStatus->btItemType;
		this->CashItemList[iCategory][iItemIndex+iIndex].wItemIndex = lpItemStatus->wItemIndex;
		this->CashItemList[iCategory][iItemIndex+iIndex].btItemLevel = lpItemStatus->btItemLevel;
		this->CashItemList[iCategory][iItemIndex+iIndex].btItemAddOption = lpItemStatus->btAddOption;
		this->CashItemList[iCategory][iItemIndex+iIndex].btItemLuckOption = lpItemStatus->btLuckOption;
		this->CashItemList[iCategory][iItemIndex+iIndex].btItemSkillOpion = lpItemStatus->btSkillOption;
		this->CashItemList[iCategory][iItemIndex+iIndex].btItemExOption = lpItemStatus->btExOption;
		this->CashItemList[iCategory][iItemIndex+iIndex].btItemUsedType = lpItemSellInfo->dwUseType;
		this->CashItemList[iCategory][iItemIndex+iIndex].btSpecialOption = iBranchType;


		if ( this->IsGetAmountFromShopItem(ITEMGET(lpItemStatus->btItemType, lpItemStatus->wItemIndex)) == TRUE )
		{
			this->CashItemList[iCategory][iItemIndex+iIndex].btItemDuration = lpItemSellInfo->itemPrice[iIndex].dwAmount;
		}
		else
		{
			this->CashItemList[iCategory][iItemIndex+iIndex].btItemDuration = lpItemStatus->btDurability;
		}

		if ( this->IsGetSocketSeedFromShopItem(ITEMGET(lpItemStatus->btItemType, lpItemStatus->wItemIndex)) == TRUE ) //season 4 add-on
		{
			this->CashItemList[iCategory][iItemIndex+iIndex].btItemLevel = lpItemSellInfo->itemPrice[iIndex].dwAmount - 1;
		}

		this->CashItemList[iCategory][iItemIndex+iIndex].btItemSaleRatio = lpItemSellInfo->itemPrice[iIndex].dwSellRate;
		this->CashItemList[iCategory][iItemIndex+iIndex].wItemPrice = lpItemSellInfo->itemPrice[iIndex].dwPrice;
		this->CashItemList[iCategory][iItemIndex+iIndex].dwItemUsePeriod = lpItemSellInfo->itemPrice[iIndex].dwUseTime;
		memcpy(this->CashItemList[iCategory][iItemIndex+iIndex].btItemInfo, lpItemStatus->btItemInfo, sizeof(lpItemStatus->btItemInfo));


		this->CashItemList[iCategory][iItemIndex+iIndex].ItemInfo.Convert(ITEMGET(lpItemStatus->btItemType, lpItemStatus->wItemIndex),
			lpItemStatus->btSkillOption, lpItemStatus->btLuckOption, lpItemStatus->btAddOption, lpItemStatus->btExOption, 0, 0, NULL, 0xFF, TEMP_PERIOD_VAR, CURRENT_DB_VERSION);

		this->MapCashItemList.insert(std::pair<int, CASHSHOP_ITEMLIST *>(this->CashItemList[iCategory][iItemIndex+iIndex].dwPriceGuid, &this->CashItemList[iCategory][iItemIndex+iIndex]));

		this->CashItemListCompress[iCategory][iItemIndex+iIndex].dwItemGuid = lpItemSellInfo->itemPrice[iIndex].dwPriceGuid;
		this->CashItemListCompress[iCategory][iItemIndex+iIndex].btCategoryCode = iCategory;
		this->CashItemListCompress[iCategory][iItemIndex+iIndex].btItemDuration = this->CashItemList[iCategory][iItemIndex+iIndex].btItemDuration;
		this->CashItemListCompress[iCategory][iItemIndex+iIndex].btItemSaleRatio = lpItemSellInfo->itemPrice[iIndex].dwSellRate;
		this->CashItemListCompress[iCategory][iItemIndex+iIndex].wItemPrice = lpItemSellInfo->itemPrice[iIndex].dwPrice;
		this->CashItemListCompress[iCategory][iItemIndex+iIndex].btSpecialOption = iBranchType;
		this->CashItemListCompress[iCategory][iItemIndex+iIndex].dwItemUsePeriod = lpItemSellInfo->itemPrice[iIndex].dwUseTime;
		memcpy(this->CashItemListCompress[iCategory][iItemIndex+iIndex].btItemInfo, lpItemStatus->btItemInfo, sizeof(lpItemStatus->btItemInfo));

		if ( this->IsGetSocketSeedFromShopItem(ITEMGET(lpItemStatus->btItemType, lpItemStatus->wItemIndex)) == TRUE ) //season 4 add-on
		{
			this->CashItemListCompress[iCategory][iItemIndex+iIndex].btItemInfo[1] |= 8*lpItemSellInfo->itemPrice[iIndex].dwAmount-8;
		}
		
		this->iAddItemCountInCategory[iCategory]++;
		this->iCashItemCountInCategory[iCategory]++;

		LogAddTD("[CashShop][ShopList] (Category:%d, Guid:%d) ItemInfo(Type : %d, Index : %d, Name : %s, Price : %d(%d) Amount : %d, UseTime : %d, SPOP:%d ",
			iCategory, this->CashItemListCompress[iCategory][iItemIndex+iIndex].dwItemGuid,
			this->CashItemList[iCategory][iItemIndex+iIndex].btItemType,
			this->CashItemList[iCategory][iItemIndex+iIndex].wItemIndex,
			ItemAttribute[ITEMGET(this->CashItemList[iCategory][iItemIndex+iIndex].btItemType, this->CashItemList[iCategory][iItemIndex+iIndex].wItemIndex)].Name,
			this->CashItemListCompress[iCategory][iItemIndex+iIndex].wItemPrice,
			this->CashItemListCompress[iCategory][iItemIndex+iIndex].btItemSaleRatio,
			this->CashItemListCompress[iCategory][iItemIndex+iIndex].btItemDuration,
			this->CashItemList[iCategory][iItemIndex+iIndex].dwItemUsePeriod,
			iBranchType);

		if ( (iItemIndex+iIndex-1) > MAX_CASH_SHOP_ITEM )
			break;

	}
}
示例#23
0
void CCashShop::CGCashItemBuy(LPOBJ lpObj, PMSG_REQ_CASHITEM_BUY *lpMsg)
{
	int iCategoryIndex = 0;
	BYTE btResult = 0;
	BYTE btPosition = 0;
	BOOL bItemEmptySpace = FALSE;
	int iItemCode = 0;
	CASHSHOP_ITEMLIST* lpCashItemInfo = NULL;

	if ( this->bCashItemListReload == TRUE )
	{
		btResult = 7;
		goto GOTO_EndFunc;
	}

	if ( g_bConnectShopServer == TRUE && g_bShopServerConnectState == FALSE )
	{
		btResult = 6;
		goto GOTO_EndFunc;
	}

	if ( !gObjIsAccontConnect(lpObj->m_Index, lpObj->AccountID))
	{
		LogAddC(2, lMsg.Get(MSGGET(1, 175)), lpObj->AccountID, lpObj->m_Index);
		btResult = 9;
		goto GOTO_EndFunc;
	}

	if ( lpObj->Connected !=PLAYER_PLAYING && lpObj->Type != OBJ_USER )
	{
		btResult = 9;
		goto GOTO_EndFunc;
	}

	iCategoryIndex = lpMsg->btCategoryIndex;

	if ( iCategoryIndex < 0 || iCategoryIndex > MAX_CASH_SHOP_CATEGORY )
	{
		btResult = 3;
		goto GOTO_EndFunc;
	}

	lpCashItemInfo = this->SearchItemList(lpMsg->dwItemPriceGuid);

	if ( lpCashItemInfo == NULL )
	{
		btResult = 3;
		LogAddTD("[CashShop][Buy Request] User(ID:%s, Name:%s) Item(Guid:%d,Category:%d) Result:RESULT_FAIL_NOT_FOUND_ITEM", lpObj->AccountID, lpObj->Name, lpMsg->dwItemPriceGuid, iCategoryIndex);
		goto GOTO_EndFunc;
	}

	iItemCode = ITEMGET(lpCashItemInfo->btItemType, lpCashItemInfo->wItemIndex);

	if(iItemCode == ITEMGET(14,91)) //Anti-hack Summoner Card
	{
		if(lpObj->Summoner != false)
		{
			btResult = 3;
			goto GOTO_EndFunc;
		}
	}

	if ( this->CheckPeriodItem(iItemCode) == TRUE )
	{
		g_CashItemPeriodSystem.SearchAndDeleteItemPeriodEffect(lpObj,iItemCode);
	}
	else if ( this->CheckInventoryEmptySpace(lpObj, lpCashItemInfo) == FALSE )
	{
		btResult = 2;
	}

GOTO_EndFunc:
	if ( btResult == 0 )
	{
		LogAddTD("[CashShop][Buy Request] User(ID:%s, Name:%s) Item(Name:%s,Guid:%d,Category:%d,Price:%d,SaleRate:%d) Result:%d", lpObj->AccountID, lpObj->Name, ItemAttribute[iItemCode].Name, lpMsg->dwItemPriceGuid, iCategoryIndex, lpCashItemInfo->wItemPrice, lpCashItemInfo->btItemSaleRatio, btResult);
		this->GSReqBuyCashItem(gGameServerCode, lpObj->DBNumber, lpObj->m_Index, lpObj->Name, 1, lpMsg->dwItemPriceGuid);
	}
	else
	{
		LogAddTD("[CashShop][Buy Request] User(ID:%s, Name:%s) Item(Guid:%d,Category:%d) Result:%d", lpObj->AccountID, lpObj->Name, lpMsg->dwItemPriceGuid, iCategoryIndex, btResult);
		this->GCCashItemBuyResult(lpObj, btResult);
	}
}
示例#24
0
int CIllusionTempleEvent::ChaosMixItemGet(int iIndex)
{
	if( OBJMAX_RANGE(iIndex) == FALSE )
	{
		return FALSE;
	}

	int Empty = FALSE;
	int bChaos = FALSE;
	int bScroll = FALSE;
	int bPotion = FALSE;
	int bOtherItem = FALSE;
	int iItemCount = 0;
	int iScrollLevel = 0;
	int iPotionLevel = 0;
	int iCharmOfLuckCount = 0;

	for(int n = 0; n < CHAOS_BOX_SIZE; n++)
	{
		if( gObj[iIndex].pChaosBox[n].IsItem() == TRUE )
		{
			if( gObj[iIndex].pChaosBox[n].m_Type == ITEMGET(12,15) )
			{
				bChaos = TRUE;
			}
			else if( gObj[iIndex].pChaosBox[n].m_Type == ITEMGET(13,49) )
			{
				int iLevel = gObj[iIndex].pChaosBox[n].m_Level;
				iItemCount++;
				bScroll = TRUE;
				iScrollLevel = iLevel;
			}
			else if( gObj[iIndex].pChaosBox[n].m_Type == ITEMGET(13,50) )
			{
				int iLevel = gObj[iIndex].pChaosBox[n].m_Level;
				iItemCount++;
				bPotion = TRUE;
				iPotionLevel = iLevel;
			}
			else if( gObj[iIndex].pChaosBox[n].m_Type == ITEMGET(14,53) )
			{
				iCharmOfLuckCount += (int)gObj[iIndex].pChaosBox[n].m_Durability;
			}
			else
			{
				bOtherItem = TRUE;
			}
		}
	}

	if( bOtherItem != FALSE )
	{
		return 8;
	}

	if( bScroll == FALSE && bPotion == FALSE )
	{
		return 0;
	}

	if( bScroll == FALSE || bPotion == FALSE )
	{
		return 11;
	}

	if( iItemCount > 2 )
	{
		return 12;
	}

	if( iScrollLevel != iPotionLevel )
	{
		return 9;
	}

	if( IT_TEMPLE_RANGE( iScrollLevel - 1 ) == FALSE )
	{
		return 9;
	}

	if( IT_TEMPLE_RANGE( iPotionLevel - 1 ) == FALSE )
	{
		return 9;
	}

	if( bChaos == FALSE )
	{
		return 10;
	}

	if( gObj[iIndex].Level < 10 )
	{
		return 14;
	}

	if( bChaos != FALSE && bScroll != FALSE && bPotion != FALSE )
	{
		return iScrollLevel;
	}

return FALSE;
}
示例#25
0
void CItemAddOption::Load(PCHAR chFileName)
{
	SMDToken Token;

	this->Initialize();

	SMDFile = fopen(chFileName, "r");

	if ( SMDFile == NULL )
		return;

	int iItemAddOptionIndex = 0;

	while ( true )
	{
		Token = (SMDToken)GetToken();

		if ( Token == END )
			break;

		if ( Token == NUMBER )
		{
			int iType = TokenNumber;

			while ( true )
			{
				if ( iType == 0 )
				{
					Token = (SMDToken)GetToken();

					if ( strcmp("end", TokenString) == 0 )
						break;
				}

				if ( iType >= 1 )
				{
					int iItemNumber = 0;
					int iItemType = 0;
					int iItemIndex = 0;
					int iItemOption1 = 0;
					int iItemValue1 = 0;
					int iItemOption2 = 0;
					int iItemValue2 = 0;
					int iItemValidTime = 0;

					Token = (SMDToken)GetToken();

					if ( !strcmp("end", TokenString))
						break;

					iItemType = TokenNumber;

					Token = (SMDToken)GetToken();
					iItemIndex = TokenNumber;

					Token = (SMDToken)GetToken();
					iItemOption1 = TokenNumber;					

					Token = (SMDToken)GetToken();
					iItemValue1 = TokenNumber;

					Token = (SMDToken)GetToken();
					iItemOption2 = TokenNumber;

					Token = (SMDToken)GetToken();
					iItemValue2 = TokenNumber;

					Token = (SMDToken)GetToken();
					iItemValidTime = TokenNumber;

					iItemNumber = ITEMGET(iItemType, iItemIndex);
					this->m_ItemAddOption[iItemAddOptionIndex].wOptionType = iType;
					this->m_ItemAddOption[iItemAddOptionIndex].iItemNumber = iItemNumber;
					this->m_ItemAddOption[iItemAddOptionIndex].iItemType = iItemType;
					this->m_ItemAddOption[iItemAddOptionIndex].iItemIndex = iItemIndex;
					this->m_ItemAddOption[iItemAddOptionIndex].wEffectType1 = iItemOption1;
					this->m_ItemAddOption[iItemAddOptionIndex].iEffectValue1 = iItemValue1;
					this->m_ItemAddOption[iItemAddOptionIndex].wEffectType2 = iItemOption2;
					this->m_ItemAddOption[iItemAddOptionIndex].iEffectValue2 = iItemValue2;
					this->m_ItemAddOption[iItemAddOptionIndex].iEffectValidTime = iItemValidTime;

					iItemAddOptionIndex++;

					if (iItemAddOptionIndex > MAX_ITEM_ADD_OPTION )
					{
						MsgBox("[ItemAddOption] Overflow ItemAddOption Table Index");
					}
				}
				else if ( iType == 2 )
				{
					int iItemNumber = 0;
					int iItemType = 0;
					int iItemIndex = 0;
					int iItemOption1 = 0;
					int iItemValue1 = 0;
					int iItemOption2 = 0;
					int iItemValue2 = 0;
					int iItemValidTime = 0;

					Token = (SMDToken)GetToken();

					if ( !strcmp("end", TokenString))
						break;

					iItemType = TokenNumber;

					Token = (SMDToken)GetToken();
					iItemIndex = TokenNumber;

					Token = (SMDToken)GetToken();
					iItemOption1 = TokenNumber;					

					Token = (SMDToken)GetToken();
					iItemValue1 = TokenNumber;

					Token = (SMDToken)GetToken();
					iItemOption2 = TokenNumber;

					Token = (SMDToken)GetToken();
					iItemValue2 = TokenNumber;

					Token = (SMDToken)GetToken();
					iItemValidTime = TokenNumber;

					iItemNumber = ITEMGET(iItemType, iItemIndex);
					this->m_ItemAddOption[iItemAddOptionIndex].wOptionType = iType;
					this->m_ItemAddOption[iItemAddOptionIndex].iItemNumber = iItemNumber;
					this->m_ItemAddOption[iItemAddOptionIndex].iItemType = iItemType;
					this->m_ItemAddOption[iItemAddOptionIndex].iItemIndex = iItemIndex;
					this->m_ItemAddOption[iItemAddOptionIndex].wEffectType1 = iItemOption1;
					this->m_ItemAddOption[iItemAddOptionIndex].iEffectValue1 = iItemValue1;
					this->m_ItemAddOption[iItemAddOptionIndex].wEffectType2 = iItemOption2;
					this->m_ItemAddOption[iItemAddOptionIndex].iEffectValue2 = iItemValue2;
					this->m_ItemAddOption[iItemAddOptionIndex].iEffectValidTime = iItemValidTime;

					iItemAddOptionIndex++;

					if (iItemAddOptionIndex > MAX_ITEM_ADD_OPTION )
					{
						MsgBox("[ItemAddOption] Overflow ItemAddOption Table Index");
					}
				}
			}
		}
	}

	fclose(SMDFile);
}
示例#26
0
int CIllusionTempleEvent::Enter(int aIndex,BYTE Temple,BYTE Pos)
{
	if( g_bIllusionTemple == FALSE )
	{
		return FALSE;
	}

	if( IT_TEMPLE_RANGE(Temple) == FALSE )
	{
		return FALSE;
	}

	LPOBJ lpObj = &gObj[aIndex];

	PMSG_ILLUSIONTEMPLE_ENTER_RESULT pMsg;

	PHeadSubSetB((LPBYTE)&pMsg,0xBF,0,sizeof( pMsg ));
	pMsg.result = 0;

	if( lpObj->Type != OBJ_USER || lpObj->Connected <= PLAYER_LOGGED )
	{
		return FALSE;
	}

	if ( lpObj->m_IfState.use != 0 && lpObj->m_IfState.type != 12 )
	{
		return FALSE;
	}

	if ( lpObj->m_bPShopOpen == TRUE )
	{
		CGPShopReqClose(lpObj->m_Index);
	}

	int bFail = FALSE;
	int iLevel;
	int iSerial;

#if (ENABLE_FIX_PARTYPK == 0)

	if ( lpObj->PartyNumber >= 0 )
	{
		if( gParty.GetPartyPkLevel(lpObj->PartyNumber) >= 5 )
		{
			bFail = TRUE;
		}
	}
	else if( lpObj->m_PK_Level >= 4 )
	{
		bFail = TRUE;
	}

	if( bFail == TRUE )
	{
		pMsg.result = 7;
		DataSend(aIndex,(LPBYTE)&pMsg,pMsg.h.size);
		return FALSE;
	}

#endif

	if( IsTransformEquipment(aIndex) )
	{
		pMsg.result = 8;
		DataSend(aIndex,(LPBYTE)&pMsg,pMsg.h.size);
		return FALSE;
	}

	if( m_TempleData[Temple].GetState() != IT_STATE_CLOSED ||
		m_TempleData[Temple].OpenState() == FALSE )
	{
		pMsg.result = 2;
		DataSend(aIndex,(LPBYTE)&pMsg,pMsg.h.size);
		return FALSE;
	}

	if( gObj[aIndex].pInventory[Pos].IsItem() == TRUE )
	{
		if( gObj[aIndex].pInventory[Pos].m_Type == ITEMGET(13,51) )
		{
			iLevel = gObj[aIndex].pInventory[Pos].m_Level;
			iSerial = gObj[aIndex].pInventory[Pos].m_Number;

			if( IT_TEMPLE_RANGE(iLevel-1) == FALSE && gObj[aIndex].pInventory[Pos].m_Durability != 1.0f )
			{
				pMsg.result = 1;
				DataSend(aIndex,(LPBYTE)&pMsg,pMsg.h.size);
				return FALSE;
			}
		}
		else if( gObj[aIndex].pInventory[Pos].m_Type == ITEMGET(13,61) )
		{
			iSerial = gObj[aIndex].pInventory[Pos].m_Number;
			iLevel = GetEnterLevel(aIndex);

			if( iLevel <= 0 )
			{
				pMsg.result = 1;
				DataSend(aIndex,(LPBYTE)&pMsg,pMsg.h.size);
				return FALSE;
			}
		}
		else
		{
			pMsg.result = 1;
			DataSend(aIndex,(LPBYTE)&pMsg,pMsg.h.size);
			return FALSE;
		}
	}
	else
	{
		pMsg.result = 1;
		DataSend(aIndex,(LPBYTE)&pMsg,pMsg.h.size);
		return FALSE;
	}

	if( RankingCheck(aIndex,Temple,Pos,iLevel) != FALSE )
	{
		return TRUE;
	}

	if( CheckCanEnter(aIndex,iLevel) == FALSE )
	{
		pMsg.result = 3;
		DataSend(aIndex,(LPBYTE)&pMsg,pMsg.h.size);
		return FALSE;
	}

	m_TempleData[iLevel-1].CheckUsers();

	int bResult = m_TempleData[iLevel-1].EnterUser(aIndex,Temple,Pos);

	if( bResult == TRUE )
	{
		if( lpObj->PartyNumber >= 0 )
		{
			PMSG_PARTYDELUSER pMsg;
			int PartyIndex;
			PartyIndex = gParty.GetIndex(lpObj->PartyNumber,lpObj->m_Index,lpObj->DBNumber);

			if( PartyIndex >= 0 )
			{
				
				pMsg.Number = PartyIndex;

				CGPartyDelUser(&pMsg,lpObj->m_Index);
			}
		}

		if( lpObj->pInventory[Pos].m_Type == ITEMGET(13,51) )
		{
			lpObj->pInventory[Pos].m_Durability = 0;
			GCItemDurSend(lpObj->m_Index,Pos,(BYTE)lpObj->pInventory[Pos].m_Durability,0);
		}
		else if( lpObj->pInventory[Pos].m_Type == ITEMGET(13,61) )
		{
			if( lpObj->pInventory[Pos].m_Durability > 0.0f )
			{
				lpObj->pInventory[Pos].m_Durability -= 1.0f;
				GCItemDurSend(lpObj->m_Index,Pos,(BYTE)lpObj->pInventory[Pos].m_Durability,0);
			}
		}

		LogAddTD("[Illusion Temple] (%d) EnterUser: (%s)(%s) class:%d (Serial:%u).",
			iLevel,lpObj->AccountID,lpObj->Name,lpObj->DbClass,lpObj->pInventory[Pos].m_Number);

		DataSend(aIndex,(LPBYTE)&pMsg,pMsg.h.size);
		gObjMoveGate(lpObj->m_Index,141 + iLevel);
	}

	m_TempleData[Temple].SendState(0,lpObj->m_Index);
	SendInfo();
return TRUE;
}
示例#27
0
//=====================================
//	Magic Gladiator Offline Experience
//=====================================
void cOffExp::MagicGladiatorOff(LPOBJ lpObj)
{
	int skill;
	int NormDis;
	CMagicInf * lpMagic;
	int SearchSkill = 0;

	if(lpObj->pInventory[0].m_Type >= ITEMGET(5,0) && lpObj->pInventory[0].m_Type < ITEMGET(6,0))
	{
		if(gObjGetMagicSearch( lpObj, 9) != NULL) SearchSkill = 9;
		else if(gObjGetMagicSearch( lpObj, 530) != NULL) SearchSkill = 530;
		else if(gObjGetMagicSearch( lpObj, 531) != NULL) SearchSkill = 531;
		else if(gObjGetMagicSearch( lpObj, 532) != NULL) SearchSkill = 532;
		else if(gObjGetMagicSearch( lpObj, 533) != NULL) SearchSkill = 533;
		else if(gObjGetMagicSearch( lpObj, 534) != NULL) SearchSkill = 534;
		else return;
		skill = SearchSkill;
		NormDis = 6;
	}
	else
	{
		if(gObjGetMagicSearch( lpObj, 41) != NULL) SearchSkill = 41;
		else if(gObjGetMagicSearch( lpObj, 495) != NULL) SearchSkill = 495;
		else if(gObjGetMagicSearch( lpObj, 496) != NULL) SearchSkill = 496;
		else if(gObjGetMagicSearch( lpObj, 497) != NULL) SearchSkill = 497;
		else if(gObjGetMagicSearch( lpObj, 498) != NULL) SearchSkill = 498;
		else if(gObjGetMagicSearch( lpObj, 499) != NULL) SearchSkill = 499;
		else return;
		skill = SearchSkill;
		NormDis = 2;
	}

	lpMagic = gObjGetMagicSearch( lpObj, skill);	//Twisting Slash 41
	if(lpMagic==NULL) return;

	gObjUseSkill.UseSkill(lpObj->m_Index, lpMagic,lpObj->X, lpObj->Y,0,0,-1);

	int dis;
	int tObjNum;
	BYTE attr;
	for (int n=0;n<MAX_VIEWPORT_MONSTER;n++)
	{
		tObjNum = lpObj->VpPlayer2[n].number;
		if(lpObj->VpPlayer2[n].state == 0) continue;
		if ( tObjNum >= 0 )
		{
			if ( gObj[tObjNum].Type == OBJ_MONSTER )
			{
				attr = MapC[gObj[tObjNum].MapNumber].GetAttr(gObj[tObjNum].X, gObj[tObjNum].Y);
				if ( (attr&1) != 1 )
				{
					dis = gObjCalDistance(lpObj, &gObj[tObjNum]);
					if(NormDis >= dis)
					{
						gObjAttack(lpObj, &gObj[tObjNum], lpMagic, FALSE, 1, 0, FALSE, 0 , 0);
					}
				}
			}
		}
	}

	this->UseMana(lpObj->m_Index);
}
示例#28
0
BYTE CIllusionTempleEvent::TicketMix(int iIndex, int iLevel, int iCharmCount)
{
	if( OBJMAX_RANGE( iIndex ) == FALSE )
	{
		return FALSE;
	}

	if( IT_MAP_RANGE( iLevel + (MAP_INDEX_ILLUSIONTEMPLE1 - 1)) == FALSE )
	{
		return FALSE;
	}

	int Empty = 0;
	PMSG_CHAOSMIXRESULT pMsg;
	PHeadSetB((LPBYTE)&pMsg,0x86,sizeof(pMsg));

	pMsg.Result = 0;
	gObj[iIndex].ChaosLock = TRUE;

	LogAddTD("[Illusion Temple] Mix Chaos Mix Start (Account:%s, Name:%s, Level:%d)",
		gObj[iIndex].AccountID,gObj[iIndex].Name,iLevel);

	char szTmp[23];

	wsprintf(szTmp,"IllusionTemple Mix,%d",iLevel);
	g_ChaosBox.LogChaosItem(&gObj[iIndex],szTmp);

	int MixRate = IT_TicketRate[-1 + iLevel];

	if( MixRate < 0 || MixRate > 100 )
	{
		DataSend(iIndex,(LPBYTE)&pMsg,pMsg.h.size);
		LogAddTD("[Illusion Temple] Mix Chaos Mix Failed - MixRate Out of Bound (Account:%s, Name:%s, Level:%d)",
			gObj[iIndex].AccountID,gObj[iIndex].Name,iLevel);
		return FALSE;
	}

	if ( g_CrywolfSync.GetOccupationState() == 0 && g_iCrywolfApplyMvpBenefit )
	{	
		MixRate += g_CrywolfSync.GetPlusChaosRate();
	}

	int iNeedChaosMoney = IT_TicketZen[-1 + iLevel];

	int iChaosTaxMoney = (int)((__int64)iNeedChaosMoney * (__int64)g_CastleSiegeSync.GetTaxRateChaos(iIndex) / (__int64)100);

	if ( iChaosTaxMoney < 0 )
	{
		iChaosTaxMoney = 0;
	}

	iNeedChaosMoney += iChaosTaxMoney;

	if ( iNeedChaosMoney < 0 )
	{
		DataSend(iIndex,(LPBYTE)&pMsg,pMsg.h.size);
		LogAddTD("[Illusion Temple] Mix Chaos Mix Failed - MixMoney< 0 (Account:%s, Name:%s, Level:%d).",
			gObj[iIndex].AccountID,gObj[iIndex].Name,iLevel);
		return false;
	}

	if ( ( gObj[iIndex].Money - iNeedChaosMoney ) < 0 )
	{
		pMsg.Result = 11;
		DataSend(iIndex,(LPBYTE)&pMsg,pMsg.h.size);
		LogAddTD("[Illusion Temple] Mix Chaos Mix Failed - Not Enough Money (Account:%s, Name:%s, Level:%d)",
			gObj[iIndex].AccountID,gObj[iIndex].Name,iLevel);
		return false;
	}

	gObj[iIndex].Money -= iNeedChaosMoney;
	g_CastleSiegeSync.AddTributeMoney(iChaosTaxMoney);
	GCMoneySend(iIndex, gObj[iIndex].Money);

	MixRate += iCharmCount;

	if( rand() % 100 < MixRate )
	{
#if( __4GAMERS__ == 1 )
			g_Achievements.GD_UpdateMixData(&gObj[iIndex], true);
#endif
		int Item = ITEMGET(13,51);
		ItemSerialCreateSend(iIndex,0xFF,0,0,Item,iLevel,0,0,0,0,-1,0,0);
		LogAddTD("[Illusion Temple] [%s][%s] CBMix Success %d Money : %d-%d, CharmRate : %d",
			gObj[iIndex].AccountID,gObj[iIndex].Name,MixRate,gObj[iIndex].Money,iNeedChaosMoney,iCharmCount);
	}
	else
	{
#if( __4GAMERS__ == 1 )
			g_Achievements.GD_UpdateMixData(&gObj[iIndex], false);
#endif
		g_ChaosBox.ChaosBoxInit(&gObj[iIndex]);
		GCUserChaosBoxSend(&gObj[iIndex], 0);
		DataSend(iIndex,(LPBYTE)&pMsg,pMsg.h.size);

		LogAddTD("[Illusion Temple] [%s][%s] CBMix Fail %d Money : %d-%d, CharmRate : %d",
			gObj[iIndex].AccountID,gObj[iIndex].Name,MixRate,gObj[iIndex].Money,iNeedChaosMoney,iCharmCount);
		return FALSE;
	}

	gObjInventoryCommit(iIndex);
	return TRUE;
}
示例#29
0
//0051d8a0	-> Checked
BOOL CObjBaseAttack::DecreaseArrow(LPOBJ lpObj)
{
	if (lpObj->Class == CLASS_ELF && lpObj->Type == OBJ_USER )
	{
		CItem * Right = &lpObj->pInventory[0];
		CItem * Left  = &lpObj->pInventory[1];

		if ( (Right->m_Type >= ITEMGET(4,8) && Right->m_Type <= ITEMGET(4,14)) ||
			  Right->m_Type == ITEMGET(4,16) || Right->m_Type == ITEMGET(4,18) ||
			  Right->m_Type == ITEMGET(4,19) )
		{
			if ( Left->m_Type == ITEMGET(4,7) )
			{
				if ( Left->m_Durability < 1.0f )
				{
					return FALSE;
				}

				Left->m_Durability -= 1.0f;
				GCItemDurSend(lpObj->m_Index, 1, Left->m_Durability, 0);

				if ( Left->m_Durability < 1.0f )
				{
					lpObj->pInventory[1].Clear();
					GCInventoryItemDeleteSend(lpObj->m_Index, 1, 0);
				}
			}
			else
			{
				return FALSE;
			}
		}
		else if ( (Left->m_Type >= ITEMGET(4,0) && Left->m_Type <= ITEMGET(4,6) ) ||
				   Left->m_Type == ITEMGET(4,17) ||
				   Left->m_Type == ITEMGET(4,20) ||
				   Left->m_Type == ITEMGET(4,21) ||
				   Left->m_Type == ITEMGET(4,22) ||
				   Left->m_Type == ITEMGET(4,23) ||
				   Left->m_Type == ITEMGET(4,24)) //season4.6 add-on
		{
			if ( Right->m_Type == ITEMGET(4,15) )
			{
				if ( Right->m_Durability < 1.0f )
				{
					return FALSE;
				}

				Right->m_Durability -= 1.0f;
				GCItemDurSend(lpObj->m_Index, 0, Right->m_Durability, 0);

				if ( Right->m_Durability < 1.0f )
				{
					lpObj->pInventory[0].Clear();
					GCInventoryItemDeleteSend(lpObj->m_Index, 0, 0);
				}
			}
			else
			{
				return FALSE;
			}
		}
	}

	return TRUE;
}
示例#30
0
// --------------------------------------------------------------------------------------------------------------------------------------------------
void CMoveSystem::CheckRequirements(int aIndex, int MapNumber, BYTE X, BYTE Y)
{
	LPOBJ lpObj = &gObj[aIndex];
	// -----
	//--  Check Target Map Status
	if ( MapNumberCheck(MapNumber) == FALSE)
	{
		CLog.LogAddC(TColor.Red(), "Error: [%s][%s] Unknown Map Number [%d].", lpObj->AccountID, lpObj->Name, MapNumber);
		SendMsg.MessageOut(aIndex, 0x01, "[WARNING]: You are attempting to move to Unknown Map.");
		return;
	}
	// -----
	//-- Check The Coordonates Status
	if ( X > MOVMAX || X < MOVMIN ) return;
	if ( Y > MOVMAX || Y < MOVMIN ) return;
	// -----
	//-- Checking Required Money
	if ( lpObj->Money < MOVSTR[MapNumber].Money )
	{
		if ( HRB_CheckMoveMoneyMsg == TRUE )
		{
			SendMsg.MessageOut(aIndex, 0x01, "[WARNING]: You don't have enough zen to warp.");
		}
		return;
	}
	// -----
	//-- Checking Required Level
	if( !REQ_LEVEL_MOVE_RANGE(lpObj->Level) )
	{
		CLog.LogAddC(TColor.Red(), "Error: [%s][%s]: Trying to moving, While he is out of Range of Required Level!", lpObj->AccountID, lpObj->Name);
		// ----
		if ( HRB_CheckMoveLevelMsg == TRUE )
		{
			SendMsg.MessageOut(aIndex, 0x01, "[WARNING]: You are Out Of Range Of Required Level.");
			SendMsg.MessageOut(aIndex, 0x01, "MinLevel:(%d) - MaxLevel:(%d) to warp to [%s].", MOVSTR[MapNumber].MinLevel, MOVSTR[MapNumber].MaxLevel,
				GetMapName(MapNumber));
		}
		return;
	}
	// -----
	//-- Characters Type Specificity & Ability to Move
	if ( MOVSTR[MapNumber].MoveForChar == 1 ) //------------> For Normal Players Only
	{
		if ( (lpObj->AuthorityCode&1) == TRUE ) 
		{
			SendMsg.MessageOut(aIndex, 0x01, "[WARNING]: This Map is Only available for Normal Players Only.");
			return;
		}
	}
	else if ( MOVSTR[MapNumber].MoveForChar == 2 ) //-------> For Game Masters Only
	{
		if ( (lpObj->AuthorityCode&1) == FALSE )
		{
			SendMsg.MessageOut(aIndex, 0x01, "[WARNING]: This Map is Only available for Game Masters Only.");
			return;
		}
	}
	else if ( MOVSTR[MapNumber].MoveForChar == -1 ) //------> For All ( Normal & Game Masters )
	{
	}
	else
	{
		CLog.LogAddC(TColor.Red(), "Error: [%s][%s]: There is a Wrong Value in MoveSystem.txt in 'MoveForChar'.", lpObj->AccountID, lpObj->Name);
		return;
	}
	// -----
	//-- Checking BattleZones
	if ( MOVSTR[MapNumber].IsBattleZone == 1 )
	{
	}
	else
	{
	}
	// -----
	//--  Check Equipment To Move Atlans
	if ( MapNumber == MAP_INDEX_ATLANS )
	{
		if ( lpObj->pInventory[GUARDIAN].IsItem() != FALSE )
		{
			if ( lpObj->pInventory[GUARDIAN].m_Type == ITEMGET(13,2) ) // Horn Of Uniria
			{
				SendMsg.MessageOut(aIndex, 0x01, "You unable to warp to %s While Riding a Uniria.",GetMapName(MapNumber));
				return;
			}
			// ----
			if ( lpObj->pInventory[GUARDIAN].m_Type == ITEMGET(13,3) ) // Dinorant
			{
				SendMsg.MessageOut(aIndex, 0x01, "You unable to warp to %s While Riding a Dinorant.",GetMapName(MapNumber));
				return;
			}
		}
	}
	// -----
	//--  Check Equipment To Move Icarus
	if ( MapNumber == MAP_INDEX_ICARUS )
	{
		if(  lpObj->pInventory[GUARDIAN].m_Type != ITEMGET(13,3)  && 
			 lpObj->pInventory[WINGS].m_Type != ITEMGET(13,30) &&
			 lpObj->pInventory[GUARDIAN].m_Type != ITEMGET(13,37) &&
		    (lpObj->pInventory[WINGS].m_Type < ITEMGET(12,0)   ||  lpObj->pInventory[WINGS].m_Type > ITEMGET(12,6) ) &&
		    (lpObj->pInventory[WINGS].m_Type < ITEMGET(12,36)  ||  lpObj->pInventory[WINGS].m_Type > ITEMGET(12,43)) )
		{
			SendMsg.MessageOut(aIndex, 0x01, "You unable to warp to %s without Wing or Dinorant or Fernir.", GetMapName(MapNumber));
			return;
		}
		// ----
		if(lpObj->pInventory[GUARDIAN].m_Type == ITEMGET(13,2))
		{
			SendMsg.MessageOut(aIndex, 0x01, "You unable to warp to %s while Riding a Uniria.",GetMapName(MapNumber));
			return;
		}
		// ----
		if(lpObj->pInventory[RING_02].m_Type == ITEMGET(13,10) || lpObj->pInventory[RING_01].m_Type == ITEMGET(13,10))
		{
			SendMsg.MessageOut(aIndex, 0x01, "You unable to warp to %s while wearing Transformation Ring.",GetMapName(MapNumber));
			return;
		}
	}
	// -----
	//-- Checking Character If in Trade.
	if ( lpObj->m_IfState.use == 1 && lpObj->m_IfState.type == 1 )
	{
		CGTradeCancelButtonRecv(lpObj->m_Index);
	}
	// -----
	//-- Checking Personal Shop Status
	if ( lpObj->m_bPShopOpen == 1 )
	{
		CPShop.ClosePersonalShop(lpObj->m_Index);
	}
	// -----
	//-- Checking The Vault Status
	if ( lpObj->m_IfState.use == 1 && lpObj->m_IfState.type == 6 )
	{
		CGWarehouseUseEnd(lpObj->m_Index);
	}
	// -----
	//-- Checking NPC Status
	if ( lpObj->m_IfState.use == 1 && lpObj->m_IfState.type == 3 )
	{
		lpObj->TargetShopNumber = -1;
		lpObj->m_IfState.type	= 0;
		lpObj->m_IfState.use	= 0;
	}
	// -----
	//-- Checking If the User in Duel
	if( gDuel.IsOnDuel(lpObj) == true )
	{
		SendMsg.MessageOut(aIndex, 0x01, "You are in a Duel. You can't warp");
		return;
	}
}