Ejemplo n.º 1
0
void ShopPointEx::SendNotify(int UserIndex, int CoinC, int CoinP, int CoinG)
{
	gGameShop.GDSavePoint(UserIndex);
	// ----
	char Text[256];
	// ----
	if( CoinC > 0 )
	{
		ZeroMemory(Text, 255);
		wsprintf(Text, "Obtained %d WCoinC", CoinC);
		GCServerMsgStringSend(Text, UserIndex, 1);
	}
	// ----
	if( CoinP > 0 )
	{
		ZeroMemory(Text, 255);
		wsprintf(Text, "Obtained %d WCoinP", CoinP);
		GCServerMsgStringSend(Text, UserIndex, 1);
	}
	// ----
	if( CoinG > 0 )
	{
		ZeroMemory(Text, 255);
		wsprintf(Text, "Obtained %d GoblinPoint", CoinG);
		GCServerMsgStringSend(Text, UserIndex, 1);
	}
}
Ejemplo n.º 2
0
void PCPointShop::LevelUp(DWORD PlayerID, int MobID)
{
	if(PCPoint.AddWhenKillMobs==1)
	{

		int ID=PlayerID-MIN_PLAYERID;
		int RecvPoints		= 0;
		char sBuf[255]		= {0};
		LPGOBJSTRUCT pObj	= (LPGOBJSTRUCT)(PlayerID*gObjSize + gObjBaseAddr);

		if(pObjGS[ID].PCPlayerPoints<MaxPlayerPoints)
		{
			RecvPoints=GetRewardPoints(MobID);
			if (RecvPoints>0)
			{
				IncreasePoints(PlayerID,RecvPoints);

				//Send Blue Text with Points
				wsprintf(sBuf, MSG24,pObj->Name,RecvPoints);
				GCServerMsgStringSend(sBuf,PlayerID, 0x01);
				wsprintf(sBuf, "[PCPointShop][%s] Kill: %d, Earned %d, Total: %d",pObj->Name,MobID,RecvPoints,pObjGS[ID].PCPlayerPoints);
				Log.outNormal("%s\n",sBuf);

				if (pObjGS[ID].PCInfoReceived==0)
				{
					this->GetInfo(PlayerID);
				
				}
			}
		} else 
		{
			GCServerMsgStringSend(MSG25,PlayerID, 0x01);
		}
	}
}
// ----------------------------------------------------------------------------------------------------------------
//## функция сепаратора для протокола
void DuelSystem::RecvWatchRequest(LPOBJ lpObj, PMSG_DUEL_REQUEST_WATCH* lpMsg)
{
	if(lpObj->m_IfState.use == 0 || lpObj->m_IfState.type != 20) 
	{
		return;
	}
	// ----
	lpObj->m_IfState.use  = 0;
	lpObj->m_IfState.type = 0;
	// ----
	if(lpMsg->btRoomIndex >= 0 && lpMsg->btRoomIndex < MAX_DUEL_ROOMS)
	{
		if(this->g_DuelRooms[lpMsg->btRoomIndex].RoomFree == TRUE) 
		{
			GCServerMsgStringSend("Sorry, but this room is free!", lpObj->m_Index, 1);
			return;
		}
		// ----
		for(short i = 0; i < MAX_DUEL_SEPARATORS; ++i)
		{
			if(this->g_DuelRooms[lpMsg->btRoomIndex].szSeparators[i] == NULL)
			{
				if(gObjMoveGate(lpObj->m_Index, g_DuelGates[lpMsg->btRoomIndex].SeparatorGate))
				{
					this->g_DuelRooms[lpMsg->btRoomIndex].szSeparators[i] = lpObj;
					// ----
					this->SendSpectatorList(lpObj, lpMsg->btRoomIndex);
					// ----
					this->SendSpectatorList(lpMsg->btRoomIndex);
					// ----
					this->SendSpectatorAdd(i, lpMsg->btRoomIndex);
					// ----
					GCServerMsgStringSend("Please sit down and watch this duel. Have fun.", lpObj->m_Index, 1);
					// ----
							if(Config.Duel.Logging)
		{
					Log.ConsoleOutPut(1, c_Blue, t_Duel,"[Duel System][%s][%s] Spectator join to room: [%d]", 
									lpObj->AccountID, lpObj->Name, lpMsg->btRoomIndex + 1);
							}
					// ----
					GCStateInfoSendg(lpObj, 1, 98);
					// ----
					this->SendLifebarInit(lpObj, lpMsg->btRoomIndex);
					// ----
					this->SendLifebarStatus(lpObj, lpMsg->btRoomIndex);
					// ----
					this->UpdateDuelScore(lpMsg->btRoomIndex);
					// ----
					AddTab[lpObj->m_Index].DUEL_SpecVisible = 1;
					// ----
					return;
				}
				GCServerMsgStringSend("Failed to move to Duel Room!", lpObj->m_Index, 1);
				return;
			}
		}
		GCServerMsgStringSend("Sorry, but this room is full!", lpObj->m_Index, 1);
		return;
	}
}
Ejemplo n.º 4
0
void CVipSystem::ApplyVip(int aIndex)
{
	OBJECTSTRUCT *pObj = (OBJECTSTRUCT*)OBJECT_POINTER(aIndex);
	if(Vip[pObj[aIndex].m_Index - OBJECT_MIN] == 0)
	{
		char lvlmsg[100];
		sprintf(lvlmsg,"[Free] Welcome back, [ %s ].", pObj->AccountID);
		GCServerMsgStringSend(lvlmsg,aIndex,1);
	}
	if(Vip[pObj[aIndex].m_Index - OBJECT_MIN] == 1)
	{
		pObj[aIndex].m_wItemDropRate += this->m_PlatinumDrop;
		char lvlmsg[100];
		sprintf(lvlmsg,"[Bronze VIP] Welcome back, [ %s ].", pObj->AccountID);
		GCServerMsgStringSend(lvlmsg,aIndex,1);
	}
	else if(Vip[pObj[aIndex].m_Index - OBJECT_MIN] == 2)
	{
		pObj[aIndex].m_wItemDropRate += this->m_PlatinumDrop;
		char lvlmsg[100];
		sprintf(lvlmsg,"[Platinum VIP] Welcome back, [ %s ].", pObj->AccountID);
		GCServerMsgStringSend(lvlmsg,aIndex,1);
	}
	else if(Vip[pObj[aIndex].m_Index - OBJECT_MIN] == 3)
	{
		pObj[aIndex].m_wItemDropRate += this->m_GoldDrop;
		char lvlmsg[100];
		sprintf(lvlmsg,"[Gold VIP] Welcome back, [ %s ].", pObj->AccountID);
		GCServerMsgStringSend(lvlmsg,aIndex,1);
	}
}
// ----------------------------------------------------------------------------------------------------------------
//## Процесс убиства игрока
void DuelSystem::KillUserProc(LPOBJ lpObj, LPOBJ lpTarget)
{ 
	if(!this->DuelCheck(lpObj, lpTarget))
	{
		return;
	}
	// ----
	int iDuelRoom = this->GetUserDuelRoom(lpObj);
	// ----
	if(iDuelRoom == -1)
	{
		return;
	}
	// ----
	lpTarget->KillerType = 3;
	// ----
	int Points = ((lpObj == this->g_DuelRooms[iDuelRoom].szlpObjOne) ? this->g_DuelRooms[iDuelRoom].szPointsOne : this->g_DuelRooms[iDuelRoom].szPointsTy);
	// ----
	if(Points >= MAX_DUEL_WIN_POINTS)
	{
		this->g_DuelRooms[iDuelRoom].szWinner = TRUE;
		// ----
		this->SendEndDuel(lpTarget);
		this->SendEndDuel(lpObj);
		// ----
		this->SendEndDuelNotification(lpTarget, lpObj->Name, lpTarget->Name);
		this->SendEndDuelNotification(lpObj, lpObj->Name, lpTarget->Name);
		// ----
		char Buff[256];
		// ----
		wsprintf(Buff,"You emerge triumphant over %s!", lpTarget->Name);
		GCServerMsgStringSend(Buff,lpObj->m_Index,1);
		// ----
		wsprintf(Buff,"%s has defeated you!",lpObj->Name);
		GCServerMsgStringSend(Buff,lpTarget->m_Index,1);
		// ----
		PMSG_SERVERCMD ServerCmd;
		// ----
		PHeadSubSetB((LPBYTE)&ServerCmd, 0xF3, 0x40, sizeof(ServerCmd));
		// ----
		ServerCmd.CmdType = 0;
		ServerCmd.X		  = (int)lpObj->X;
		ServerCmd.Y		  = (int)lpObj->Y;
		// ----
		MsgSendV2(lpObj, (unsigned char *)&ServerCmd, sizeof(ServerCmd));
		DataSend(lpObj->m_Index, (unsigned char *)&ServerCmd, sizeof(ServerCmd));
		// ----
		WinnerBuff(lpObj);
		// ----
		this->g_DuelRooms[iDuelRoom].dwTicketCount = GetTickCount() + 10000;
		// ----
		Log.ConsoleOutPut(1, c_Blue,t_Duel,"[Duel System] [%s][%s] Has Won Duel, Looser [%s][%s] Room [%d]",
								lpObj->AccountID, lpObj->Name, lpTarget->AccountID, lpTarget->Name, iDuelRoom+1);
	}
}
Ejemplo n.º 6
0
// -----------------------------------------------------------------------------------------------------------------------
void CIllusionTemple::NpcRegister(OBJECTSTRUCT* lpObj, PMSG_IT_REGISTER* pMsg)
{
	if(lpObj->m_IfState.use > 0)
	{
		CLog.LogAdd("[IllusionTemple] Interface State Error (%d)(%d)(%s)", lpObj->m_IfState.use, lpObj->m_IfState.type, lpObj->Name); 
		return;
	}

	if(lpObj->pInventory[pMsg->TicketPosition].m_Type != ITEMGET(13, 51) || 
		lpObj->pInventory[pMsg->TicketPosition].m_Level != pMsg->TargetTemple )
	{
		GCServerMsgStringSend("You missed Illusion Temple Ticket.", lpObj->m_Index, 1);
		return;
	}

	pMsg->TargetTemple--;

	if(IT_FLOOR_RANGE(pMsg->TargetTemple) == FALSE)
	{
		CLog.LogAdd("[IllusionTemple] Index out of range (%d)(%s)", pMsg->TargetTemple, &lpObj->Name[0]);
		return;
	}

	if(this->m_IllusionTemple[pMsg->TargetTemple].m_iUserCount >= 10)
	{
		GCServerMsgStringSend("[IllusionTemple] Event is already Full!", lpObj->m_Index, 1);
		return;
	}

	ILLUSION_OBJ obj;
	obj.m_Index = lpObj->m_Index;
	obj.m_TeamIndex = -1;
	obj.m_BonusCount = 0;
	obj.m_TempleIndex = pMsg->TargetTemple;

	gObjInventoryDeleteItem(lpObj->m_Index, pMsg->TicketPosition);
	GCInventoryItemDeleteSend(lpObj->m_Index, pMsg->TicketPosition, 1);

	if ( lpObj->PartyNumber >= 0 )
	{
		PMSG_PARTYDELUSER pMsg;
		int iPartyIndex = gParty.GetIndex(lpObj->PartyNumber, lpObj->m_Index, lpObj->DBNumber);
		if ( iPartyIndex >= 0 )
		{
			pMsg.Number = iPartyIndex;
			CGPartyDelUser(&pMsg, lpObj->m_Index);
		}
	}

	lpObj->m_IllusionIndex = pMsg->TargetTemple;
	gObjSetIllusionKillCount(lpObj->m_Index, KILLCOUNT_RESET, 0);

	gObjMoveGate(lpObj->m_Index, 142 + pMsg->TargetTemple);
}
Ejemplo n.º 7
0
//Post Global Messages : "/post"
void cChat::ChatGlobal(DWORD aIndex,char* msg)
{
	char* Name;
	Name = (char*)gObj_GetChar(aIndex,gObjNick);
	GOBJSTRUCT *gObj = (GOBJSTRUCT*)OBJECT_POINTER(aIndex);

	if(Config.IsPost==0)
	{
		GCServerMsgStringSend(MSG01,aIndex,1);
		return;
	}

	else if(!strcmpi("/post ",msg))
	{
		GCServerMsgStringSend(MSG02,aIndex,1);
		Log.outError("[POST] [%s]: [%s] syntax error \n",gObj->AccountID,Name);
		return;
	}

	else if(strlen(msg)<1)
	{
		GCServerMsgStringSend(MSG03,aIndex,1);
		Log.outError("[POST] [%s]: [%s] syntax error \n",gObj->AccountID,Name);
		return;
	}

	else if((int)gObj_GetLevel(aIndex)<Config.PostLevel)
	{
		char levelmsg[120];
		sprintf_s(levelmsg,MSG04,Config.PostLevel);
		GCServerMsgStringSend(levelmsg,aIndex,1);
		Log.outError("[POST] [%s]: [%s] not enought Level \n",gObj->AccountID,Name);
		return;
	}
	
	else if(gObj->Money < Config.PostCost)
	{
		char OutputZenLack[120]={0};
		sprintf(OutputZenLack,MSG05,Config.PostCost);
		GCServerMsgStringSend(OutputZenLack,aIndex,1);
		Log.outError("[POST] [%s]: [%s] not enought Zend \n",gObj->AccountID,Name);
		return;
	}
	

	char Buff[255]={0};
	gObj->Money = gObj->Money - Config.PostCost;
	GCMoneySend(aIndex,gObj->Money);
	ServerMsgSend(0,1,Name,MSG06,msg);
	Log.outNormal("[POST] %s : %s \n",Name,msg);
	conLog.ConsoleOutputDT("[POST] %s : %s",Name,msg);
	sprintf(Buff,"[POST]: %s : %s",Name,msg);
	cWriteLog(Buff);
}
Ejemplo n.º 8
0
void CHacktoolBlockEx::OnRequestUserHacktoolUseInfo(LPOBJ lpObj, DWORD dwHacktoolIndex, BYTE btResult)
{
	HACKTOOL_DATA * lpHacktoolData;
	// ----
	for( int i = 0; i < HACKTOOL_DATA_SIZE; i++ )
	{
		if(	lpObj->m_HacktoolUseInfo[i].btCheckType	== 1 
			&&	lpObj->m_HacktoolUseInfo[i].wHacktoolIndex == dwHacktoolIndex )
		{
			if( btResult == 1 )
			{
				lpObj->m_HacktoolUseInfo[i].btUseType = 2;
				// ----
				if( this->SetHacktoolUseDisadvantage(lpObj, 2) )
				{
					GCServerMsgStringSend(lMsg.Get(3461), lpObj->m_Index, 1);
					CloseClient(lpObj->m_Index);
				}
				else if( this->SetHacktoolUseDisadvantage(lpObj, 4) )
				{
					GCServerMsgStringSend(lMsg.Get(3462), lpObj->m_Index, 1);
					this->SetUseForceMove2Town(lpObj);
				}
				else if( !this->SetHacktoolUseDisadvantage(lpObj, 8) && !this->SetHacktoolUseDisadvantage(lpObj, 16) )
				{
					if( this->SetHacktoolUseDisadvantage(lpObj, 32) )	//GM event?
					{
						GCServerMsgStringSend(lMsg.Get(3460), lpObj->m_Index, 1);
						gObjAddBuffEffect(lpObj, 120, 0, 0, 0, 0, g_iHacktoolUsePenaltyDuration);
					}
					else if( this->SetHacktoolUseDisadvantage(lpObj, 1) )
					{
						GCServerMsgStringSend(lMsg.Get(3463), lpObj->m_Index, 1);
					}
				}
				// ----
				lpHacktoolData = this->SearchHacktoolData(dwHacktoolIndex);
				// ----
				if( lpHacktoolData )
				{
					LogAddTD("[HackBlockEx][SetHackUseInfo] Use Hacktool User Id : %s(%d), Name : %s,  Hacktool Name : %s, Index : %d, BlockType : %d",
						lpObj->AccountID, lpObj->DBNumber, lpObj->Name,
						lpHacktoolData->chFilename, dwHacktoolIndex, lpHacktoolData->btHackBlockType);
				}
			}
			else
			{
				lpObj->m_HacktoolUseInfo[i].btUseType = 1;
				lpHacktoolData = this->SearchHacktoolData(dwHacktoolIndex);
			}
			break;
		}
	}
}
Ejemplo n.º 9
0
void PremiumSystem::BuyPremium(int UserIndex, int Days)
{
	bool Result = false;
	// ----
	for( int i = 0; i < this->m_Price.size(); i++ )
	{
		if( m_Price[i].Days != Days )
		{
			continue;
		}
		// ----
		switch(m_Price[i].PayType)
		{
		case 0:
			if( gObj[UserIndex].GameShop.WCoinC < m_Price[i].PayAmount )
			{
				GCServerMsgStringSend("You do not have enough WCoinC", UserIndex, 1);
				return;
			}
			gObj[UserIndex].GameShop.WCoinC -= m_Price[i].PayAmount;
			Result = true;
			break;
		case 1:
			if( gObj[UserIndex].GameShop.WCoinP < m_Price[i].PayAmount )
			{
				GCServerMsgStringSend("You do not have enough WCoinP", UserIndex, 1);
				return;
			}
			gObj[UserIndex].GameShop.WCoinP -= m_Price[i].PayAmount;
			Result = true;
			break;
		case 2:
			if( gObj[UserIndex].GameShop.GoblinPoint < m_Price[i].PayAmount )
			{
				GCServerMsgStringSend("You do not have enough WCoinG", UserIndex, 1);
				return;
			}
			gObj[UserIndex].GameShop.GoblinPoint -= m_Price[i].PayAmount;
			Result = true;
			break;
		}
	}
	// ----
	if( !Result )
	{
		GCServerMsgStringSend("Wrong premium period", UserIndex, 1);
		return;
	}
	// ----
	//Request to database
	// ----
	gGameShop.GDSavePoint(UserIndex);
}
Ejemplo n.º 10
0
bool OfflineTrade::CheckExchange(LPOBJ lpUser, LPOBJ lpTargetUser, int ItemPos)
{

	if(!strcmp(lpUser->m_szPShopText,WCOIN_SHOP))
	{
		if ( lpTargetUser->GameShop.WCoinP < lpUser->Inventory1[ItemPos].m_iPShopValue )
		{
			LogAddTD("[PShop] [%s][%s] PShop Item Buy Request Failed : [%s][%s] Lack of Wcoin",
				lpTargetUser->AccountID, lpTargetUser->Name, lpUser->AccountID, lpUser->Name);
			GCServerMsgStringSend("Need more WCoin to buy", lpUser->m_Index, 1);
			return false;
		}
	}
	else if(!strcmp(lpUser->m_szPShopText,SOUL_SHOP))	//Soul check
	{
		if ( this->GetSoulCount(lpTargetUser->m_Index) < lpUser->Inventory1[ItemPos].m_iPShopValue )
		{
			LogAddTD("[PShop] [%s][%s] PShop Item Buy Request Failed : [%s][%s] Lack of Soul",
				lpTargetUser->AccountID, lpTargetUser->Name, lpUser->AccountID, lpUser->Name);
			GCServerMsgStringSend("Need more Soul to buy", lpTargetUser->m_Index, 1);
			return false;
		}
		else if( this->EmptyPointInventory(lpUser, lpUser->Inventory1[ItemPos].m_iPShopValue) )
		{
			LogAddTD("[PShop] [%s][%s] PShop Item Buy Request Failed : [%s][%s] Empty Invintory",
				lpTargetUser->AccountID, lpTargetUser->Name, lpUser->AccountID, lpUser->Name);
			GCServerMsgStringSend("Need more Empty Inventory", lpTargetUser->m_Index, 1);
			return false;
		}
	}
	else
	{
		if ( lpTargetUser->Money < lpUser->Inventory1[ItemPos].m_iPShopValue )
		{
			LogAddTD("[PShop] [%s][%s] PShop Item Buy Request Failed : [%s][%s] Lack of Zen",
				lpTargetUser->AccountID, lpTargetUser->Name, lpUser->AccountID, lpUser->Name);
			::CGPShopAnsBuyItem(lpTargetUser->m_Index, lpUser->m_Index, 0, 7);
			return false;
		}

		if ( gObjCheckMaxZen(lpUser->m_Index, lpUser->Inventory1[ItemPos].m_iPShopValue) == FALSE )
		{
			LogAddTD("[PShop] [%s][%s] PShop Item Buy Request Failed : [%s][%s] Exceeding Zen of the Host",
				lpTargetUser->AccountID, lpTargetUser->Name, lpUser->AccountID, lpUser->Name);
			::CGPShopAnsBuyItem(lpTargetUser->m_Index, lpUser->m_Index, 0, 8);
			return false;
		}
	} 
	return true;
}
Ejemplo n.º 11
0
void cVipSystem::State(LPOBJ lpObj)
{
	char Tmp[512]={0};
	if (lpObj->VipDays >= 1)
	{
		wsprintf(Tmp,lMsg.Get(MSGGET(14, 57)),lpObj->VipDays,lpObj->VipMoney);
		GCServerMsgStringSend(Tmp,lpObj->m_Index, 0x00);
	} else {
		if (lpObj->VipMoney > 0)
		{
			wsprintf(Tmp,lMsg.Get(MSGGET(14, 153)),lpObj->VipMoney);
			GCServerMsgStringSend(Tmp,lpObj->m_Index, 0x00);
		}
	}
}
Ejemplo n.º 12
0
void cVipSystem::BuyItem(LPOBJ lpObj, int IDNumber)
{
	if(IDNumber >= 0 && IDNumber <= (this->ItemsCount-1))
	{
		BOOL IfBuy = FALSE;	
		PMSG_BUYRESULT pResult;
		PHeadSetB((LPBYTE)&pResult, 0x32, sizeof(pResult));

		if(this->Shop[IDNumber].Cost < lpObj->VipMoney)
		{
			pResult.Result = gObjShopBuyInventoryInsertItem(lpObj->m_Index,this->m_item[IDNumber]);
				
			if ( pResult.Result != 0xFF )
			{
				lpObj->AccountExtraInfoModified = 1;

				ItemByteConvert((LPBYTE)&pResult.ItemInfo, this->m_item[IDNumber]);
				DataSend(lpObj->m_Index, (LPBYTE)&pResult, pResult.h.size);
				lpObj->VipMoney -= this->Shop[IDNumber].Cost;
				IfBuy = TRUE;
			}else
			{				
				GCServerMsgStringSend(lMsg.Get(MSGGET(14, 58)),lpObj->m_Index, 0x01);
			}
		}
		//Log
		if(IfBuy == TRUE)
		{
			LogAddTD("[VIPShop] BuyItem [%s][%s] Item {%d %d} Cost: %d",lpObj->AccountID,lpObj->Name,this->Shop[IDNumber].Type,this->Shop[IDNumber].Index,this->Shop[IDNumber].Cost);
		} else 
		{
			LogAddTD("[VIPShop] Attempt to BuyItem [%s][%s] Item {%d %d} Cost: %d",lpObj->AccountID,lpObj->Name,this->Shop[IDNumber].Type,this->Shop[IDNumber].Index,this->Shop[IDNumber].Cost);
		}
	}
}
Ejemplo n.º 13
0
void JGOtherJoin(SDHP_OTHERJOINMSG * lpMsg)
{
	char szId[11];
	szId[10]=0;
	int n;

	memcpy(szId, lpMsg->AccountID, sizeof(lpMsg->AccountID));

	for (n= OBJ_STARTUSERINDEX; n<OBJMAX;n++)
	{
		if ( gObj[n].Connected >= PLAYER_LOGGED )
		{
			if ( gObj[n].AccountID[0] == szId[0] )
			{
				if ( gObj[n].AccountID[1] == szId[1] )
				{
					if ( strcmp(gObj[n].AccountID , szId) == 0 )
					{
						GCServerMsgStringSend(lMsg.Get( MSGGET(4, 107)), n, 1 );
						break;
					}
				}
			}
		}
	}
}
Ejemplo n.º 14
0
BOOL NpcGuildMasterTalk(LPOBJ lpNpc, LPOBJ lpObj)
{
	if ( gGuildCreate == FALSE )
	{
		ChatTargetSend(lpNpc, "Creation of the guild is DISABLED!", lpObj->m_Index);
		return TRUE;
	}

	if ( lpObj->GuildNumber > 0 )
	{
		ChatTargetSend(lpNpc, lMsg.Get(MSGGET(4, 116)), lpObj->m_Index);
		return TRUE;
	}

	int capacity = gObjGuildMasterCapacityTest(lpObj);

	if ( capacity == 0 )
	{
		ChatTargetSend(lpNpc, lMsg.Get(MSGGET(4, 117)), lpObj->m_Index);
	}
	else if ( capacity == 2 )
	{
		char buf[100]={0};
		wsprintf(buf,"You need at least %d resets",ReadConfig.ResetReq_NpcGuildMasterTalk);
		ChatTargetSend(lpNpc, buf, lpObj->m_Index);
		GCServerMsgStringSend(buf,lpObj->m_Index, 0x01);
	}
	else
	{
		GCGuildMasterQuestionSend(lpObj->m_Index);
	}

	return TRUE;
}
Ejemplo n.º 15
0
void JGOtherJoin(SDHP_OTHERJOINMSG * lpMsg)
{
    char szId[11];
    szId[10]=0;
    int n;

    memcpy(szId, lpMsg->AccountID, sizeof(lpMsg->AccountID));

    for (n= OBJ_STARTUSERINDEX; n<OBJMAX; n++)
    {
        if ( gObj[n].Connected >= PLAYER_LOGGED )
        {
            if ( gObj[n].AccountID[0] == szId[0] )
            {
                if ( gObj[n].AccountID[1] == szId[1] )
                {
                    if ( strcmp(gObj[n].AccountID , szId) == 0 )
                    {
                        GCServerMsgStringSend("Warning! Another user is trying to connect using this account.", n, 1 );
                        break;
                    }
                }
            }
        }
    }
}
Ejemplo n.º 16
0
void LoveHeartEventRecv( SDHP_LOVEHEARTEVENT_RESULT * lpMsg )
{
	char szName[11];
	int number;
	char Msg[256];

	szName[10]=0;

	memcpy(szName, lpMsg->Name, sizeof(lpMsg->Name));
	number = lpMsg->Number;

	switch ( lpMsg->Result )
	{
		case 0: // Registered Hearts of Love PangPangEvent
			{
				wsprintf(Msg, lMsg.Get( MSGGET(4, 80)), number );

				for (int n = OBJ_STARTUSERINDEX;n<OBJMAX;n++)
				{
					if ( gObj[n].Connected >= PLAYER_LOGGED )
					{
						if (gObj[n].Name[0] == szName[0] )
						{
							if ( gObj[n].Name[1] == szName[1] )
							{
								if ( strcmp( gObj[n].Name, szName ) == 0 )
								{
									GCServerMsgStringSend(Msg, n, 1);
									wsprintf(Msg, lMsg.Get( MSGGET( 4, 81 ) ) );
									GCServerMsgStringSend(Msg, n, 1);
									return;
								}
							}
						}
					}
					continue;
				} // For
			}
		break;

		case 1: // Winner of the Love Pang Pang Event
			wsprintf(Msg, lMsg.Get( MSGGET ( 4, 82 ) ), szName, number);
			AllSendServerMsg(Msg);
			break;
	}
}
Ejemplo n.º 17
0
void LoveHeartEventRecv( SDHP_LOVEHEARTEVENT_RESULT * lpMsg )
{
    char szName[11];
    int number;
    char Msg[256];

    szName[10]=0;

    memcpy(szName, lpMsg->Name, sizeof(lpMsg->Name));
    number = lpMsg->Number;

    switch ( lpMsg->Result )
    {
    case 0: // Registered Hearts of Love PangPangEvent
    {
        wsprintf(Msg, "You have registered No.%d heart item(s)", number );

        for (int n = OBJ_STARTUSERINDEX; n<OBJMAX; n++)
        {
            if ( gObj[n].Connected >= PLAYER_LOGGED )
            {
                if (gObj[n].Name[0] == szName[0] )
                {
                    if ( gObj[n].Name[1] == szName[1] )
                    {
                        if ( strcmp( gObj[n].Name, szName ) == 0 )
                        {
                            GCServerMsgStringSend(Msg, n, 1);
                            strcpy(Msg,"Sorry, better luck next time.");
                            GCServerMsgStringSend(Msg, n, 1);
                            return;
                        }
                    }
                }
            }
            continue;
        } // For
    }
    break;

    case 1: // Winner of the Love Pang Pang Event
        wsprintf(Msg, "%s is the lucky winner of the Love Pang Pang event.", szName);
        AllSendServerMsg(Msg);
        break;
    }
}
Ejemplo n.º 18
0
bool GameShop::CanBeBuy(int aIndex, short ItemID)
{
	LPOBJ lpUser = &gObj[aIndex];
	// ----
	if( GetItemCountInStorage(aIndex, 0x53) >= MAX_STORAGE_ITEM - 1 )
	{
		GCServerMsgStringSend("Your GameShop inventory is full", aIndex, 1);
		return false;
	}
	// ----
	if( ItemID == ITEMGET(13, 93) || ItemID == ITEMGET(13, 94) || ItemID == ITEMGET(14, 114) )
	{
		if( !lpUser->ThirdChangeUp )
		{
			GCServerMsgStringSend("You need 3rd class to buy master items", aIndex, 1);
			return false;
		}
	}
	else if( ItemID == ITEMGET(13, 138) || ItemID == ITEMGET(13, 143) )
	{
		if( lpUser->Class == CLASS_MONK )
		{
			GCServerMsgStringSend("This ticket not have items for you", aIndex, 1);
			return false;
		}
	}
	else if( ItemID == ITEMGET(14, 162) )
	{
		if( lpUser->ExpandedInventory >= 2 )
		{
			GCServerMsgStringSend("Your inventory expanded to maximum", aIndex, 1);
			return false;
		}
	}
	else if( ItemID == ITEMGET(14, 163) )
	{
		if( lpUser->ExpandedWarehouse >= 1 )
		{
			GCServerMsgStringSend("Your warehouse expanded to maximum", aIndex, 1);
			return false;
		}
	}
	// ----
	return true;
}
Ejemplo n.º 19
0
void cLuckyPenny::Exchange(int aIndex,BYTE Count)
{
	if(OBJMAX_RANGE(aIndex) == 0)
	{
		return;
	}

	if(this->Enabled == TRUE)
	{
		if ( gObj[aIndex].m_IfState.type != 97 )
		{
			ANTI_HACK_LOG.Output("[ANTI-HACK][Coins][Exchange] User in map(%d) [%s][%s] State(u:%d,t:%d,s:%d)",
				gObj[aIndex].MapNumber, gObj[aIndex].AccountID, gObj[aIndex].Name,
				gObj[aIndex].m_IfState.use,gObj[aIndex].m_IfState.type,gObj[aIndex].m_IfState.state);
			return;
		}

		if(Count != 10 && Count != 20 && Count != 30)
			return;

		int pos = gObjCheckItemPosByDur(aIndex,ITEMGET(14,100),Count);

		if(pos >= 0)
		{
			if ( ReadConfig.MAIN_INVENTORY_RANGE(aIndex,pos,false) != FALSE )
			{
				if(this->GetReward(aIndex,Count) == true)
				{
					gObj[aIndex].pInventory[pos].m_Durability -= Count;
				
					if(gObj[aIndex].pInventory[pos].m_Durability <= 0)
					{
						gObjInventoryItemSet(aIndex, pos, -1);
						gObj[aIndex].pInventory[pos].Clear();
						GCInventoryItemDeleteSend(aIndex, pos, 1);
					}else
					{
						GCItemDurSend(aIndex, pos, gObj[aIndex].pInventory[pos].m_Durability, 0);
					}

					LogAddTD("[LuckyPenny] [%s][%s][%d] LuckyPenny Item Buy Exchange Success",
						gObj[aIndex].AccountID, gObj[aIndex].Name,Count);
				}else
				{
					LogAddTD("[LuckyPenny] [%s][%s] LuckyPenny Item Buy Exchange Failed : No Room to Get Item",
						gObj[aIndex].AccountID, gObj[aIndex].Name);
					GCServerMsgStringSend("No Room in Inventory to Get Item!!",aIndex, 1);
				}
			}
		}else
		{
			char LackPacket[5] = {0xC1,0x05,0xBF,0x0C,0x00};
			DataSend(aIndex ,(UCHAR*)LackPacket, sizeof(LackPacket));
		}
	}
}
Ejemplo n.º 20
0
void CGMMng::ManagerSendData(LPSTR szMsg, int size)
{
	for ( int n=0;n<MAX_GAME_MASTER;n++ )
	{
		if ( this->ManagerIndex[n] != -1 )
		{
			GCServerMsgStringSend(szMsg, this->ManagerIndex[n], 0);
		}
	}
}
Ejemplo n.º 21
0
void CDevilSquare::DieProcDevilSquare(LPOBJ lpObj)
{
	char msg[255];

	wsprintf(msg, "Failed. Your score is %d. Try again next time.", lpObj->m_nEventScore);
	GCServerMsgStringSend(msg, lpObj->m_Index, 1);

	if ( lpObj->m_nEventScore <= 0 )
		return;

	PMSG_ANS_EVENTUSERSCORE pMsg;

	pMsg.h.c = 0xC1;
	pMsg.h.headcode = 0x01;
	pMsg.h.size = sizeof(pMsg);
	pMsg.SquareNum = lpObj->m_bDevilSquareIndex;
	pMsg.Class = lpObj->Class;
	pMsg.h.subcode = 0x01;

	if ( lpObj->Class == 1 )
	{
		if ( lpObj->Class >= 0 && lpObj->Class < MAX_TYPE_PLAYER )
		{
			if ( DS_LEVEL_RANGE(lpObj->m_bDevilSquareIndex) != FALSE )
			{
				lpObj->m_nEventScore+= this->m_BonusScoreTable[lpObj->Class][lpObj->m_bDevilSquareIndex]/100;
				
			}
		}

		pMsg.Score = lpObj->m_nEventScore;
	}
	else
	{
		pMsg.Score = lpObj->m_nEventScore;
	}

	pMsg.ServerCode = gGameServerCode;
	memcpy(pMsg.AccountID, lpObj->AccountID, sizeof(pMsg.AccountID));
	memcpy(pMsg.GameID, lpObj->Name, sizeof(pMsg.GameID));

	DataSendRank((char *)&pMsg, pMsg.h.size);

	LogAdd("[DevilSquare] Dead [%s][%s][%d][%d]",
		lpObj->AccountID, lpObj->Name, 
		lpObj->m_nEventExp, lpObj->m_nEventScore);

	lpObj->m_nEventScore = 0;
	lpObj->m_nEventMoney = 0;
	lpObj->m_nEventExp = 0;

}
Ejemplo n.º 22
0
void CPlayer::SendTextMsg(int Type,char * Text, ...)
{
	char szBuffer[1024];
	char Nickn[11];
	va_list pArguments;
	va_start(pArguments,Text);
	vsprintf(szBuffer,Text,pArguments);
	va_end(pArguments);

	GCServerMsgStringSend(szBuffer,this->aIndex,Type);
	this->GetName(Nickn);
	Console.Write("[SendTextMsg][Index: %d][Nick: %s] %s",this->aIndex,Nickn,szBuffer);
}
Ejemplo n.º 23
0
// -----------------------------------------------------------------------------------------------------------------------------------------
bool CSkillTree::IsMasterMagicExist(LPOBJ lpObj,int SkillNumber)
{
	for(int n = 0; n < MAGIC_SIZE; n++)
	{
		if(lpObj->Magic[n].IsMagic() == true)
		{
			if(lpObj->Magic[n].m_Skill == SkillNumber)
			{
				GCServerMsgStringSend("[MasterSkillTree]: Same Magic already exists",lpObj->m_Index,1);
				return false;
			}
		}
	}
	return true;
}
Ejemplo n.º 24
0
BOOL NpcChaosCardMaster(LPOBJ lpNpc, LPOBJ lpObj)
{
//#if (CRYSTAL_EDITION == 1)	
//	if(lpNpc->MapNumber == MAP_INDEX_ELBELAND)
//	{
//		SVShop.WindowState(lpObj->m_Index,1);
//		return TRUE;
//	}
//#endif

	if ( g_bUseLotterySystem == FALSE )
		return FALSE;

	if ( bCanChaosBox == TRUE )
	{
		if ( lpObj->m_IfState.use > 0 )
			return FALSE;

		if ( lpObj->m_bPShopOpen == true )
		{
			LogAdd("[%s][%s] is Already Opening PShop, ChaosBox Failed",
				lpObj->AccountID, lpObj->Name);

			GCServerMsgStringSend(lMsg.Get(MSGGET(4,194)), lpObj->m_Index, 1);
			return TRUE;
		}

		PMSG_TALKRESULT pMsg;

		pMsg.h.c = 0xC3;
		pMsg.h.headcode = 0x30;
		pMsg.h.size = sizeof(pMsg);
		pMsg.result = 0x15;

		DataSend(lpObj->m_Index, (LPBYTE)&pMsg, pMsg.h.size);

		lpObj->m_IfState.use = 1;
		lpObj->m_IfState.type = 7;

		LogAddTD("[ChaosCard] [%s][%s] ChaosCard Mix Dealer Start",
			lpObj->AccountID, lpObj->Name);

		gObjItemTextSave(lpObj);
		gObjWarehouseTextSave(lpObj);
	}

	return TRUE;
}
Ejemplo n.º 25
0
BOOL NpcRusipher(LPOBJ lpNpc, LPOBJ lpObj)
{
	if ( gDevilSquareEvent == FALSE )
	{
		return TRUE;
	}


	int aIndex = lpObj->m_Index;

#ifdef BEREZNUK
	if ( lpObj->m_PK_Level >= 4 && !g_AllowPKEventDS )
	{
		GCServerMsgStringSend(lMsg.Get(MSGGET(13,72)),lpObj->m_Index,1);
		return TRUE;
	}
#endif

	if ( (lpObj->m_IfState.use ) > 0 )
	{
		return TRUE;
	}

	if ( gUserFindDevilSquareInvitation(aIndex) == FALSE )
	{
		GCServerCmd(lpObj->m_Index, 1, 2 ,0);
	}
	else if (g_DevilSquare.GetState() == 1 )
	{
		PMSG_TALKRESULT pMsg;

		pMsg.h.c = 0xC3;
		pMsg.h.headcode = 0x30;
		pMsg.h.size = sizeof(pMsg);
		pMsg.result = 0x04;

		DataSend(aIndex, (LPBYTE)&pMsg, pMsg.h.size);

		lpObj->m_IfState.use = 1;
		lpObj->m_IfState.type = 12;
	}
	else
	{
		GCServerCmd(lpObj->m_Index, 1, 3, 0);
	}

	return TRUE;
}
Ejemplo n.º 26
0
void cVipSystem::BuyDays(LPOBJ lpObj, int Days)
{
	int RenewCost = (Days * this->VipRenewPoints);
	if(lpObj->VipMoney >= RenewCost)
	{
		lpObj->AccountExtraInfoModified = 1;

		lpObj->VipMoney -= RenewCost;
		lpObj->VipDays += Days;
		lpObj->Vip = 1;

		char sbuf[1024]={0};
		wsprintf(sbuf, "Status: VIP: %d / VIP Days: %d / VIP Money: %d",lpObj->Vip,lpObj->VipDays,lpObj->VipMoney);
		GCServerMsgStringSend(sbuf,lpObj->m_Index, 0x00);
	}
}
Ejemplo n.º 27
0
BOOL NpcAdniel(LPOBJ lpNpc,LPOBJ lpObj )
{
	if ( bCanChaosBox == TRUE )
	{
		PMSG_TALKRESULT pMsg;

		pMsg.h.c = 0xC3;
		pMsg.h.headcode = 0x30;
		pMsg.h.size = sizeof(pMsg);
		
		if ( lpObj->m_bPShopOpen == true )
		{
			LogAdd("[%s][%s] is Already Opening PShop, ChaosBox Failed",
				lpObj->AccountID, lpObj->Name);
			GCServerMsgStringSend(lMsg.Get(MSGGET(4, 194)), lpObj->m_Index, 1);
			return TRUE;
		}

		lpObj->m_IfState.type = 7;
		lpObj->m_IfState.state = 0;
		lpObj->m_IfState.use = 1;
		

		// 39 - entering acheron
		// 40 - arca war npc
		// 41 - mix npc

		pMsg.result = 41;
		lpObj->bIsChaosMixCompleted = false;
		pMsg.level1 = gDQChaosSuccessRateLevel1;
		pMsg.level2 = gDQChaosSuccessRateLevel2;
		pMsg.level3 = gDQChaosSuccessRateLevel3;
		pMsg.level4 = gDQChaosSuccessRateLevel4;
		pMsg.level5 = gDQChaosSuccessRateLevel5;
		pMsg.level6 = gDQChaosSuccessRateLevel6;

		DataSend(lpObj->m_Index, (LPBYTE)&pMsg, pMsg.h.size);

		GCAnsCsMapSvrTaxInfo(lpObj->m_Index, 1, g_CastleSiegeSync.GetTaxRateChaos(lpObj->m_Index));
		gObjInventoryTrans(lpObj->m_Index);

		LogAddTD("[%s][%s] Open Chaos Box", lpObj->AccountID, lpObj->Name);
		gObjItemTextSave(lpObj);
		gObjWarehouseTextSave(lpObj);
	}
	return true;
}
Ejemplo n.º 28
0
void GJPUserDisconnectRecv( SDHP_BILLKILLUSER * lpMsg)
{
    char szId[11];
    szId[10]=0;
    int number;

    memcpy( szId, lpMsg->Id , sizeof( lpMsg->Id ) );
    number = lpMsg->Number;

    if ( gObjIsAccontConnect(number, szId ) == 0 )
    {
        return;
    }

    GCServerMsgStringSend("You are currently being disconnected. Please check your account credits.", number, 0 );
    gObjUserKill(number);
}
Ejemplo n.º 29
0
void GJPUserKillRecv(SDHP_BILLKILLUSER * lpMsg)
{
    char szId[11];
    int number;
    szId[10] = 0;

    memcpy(szId, lpMsg->Id , sizeof(lpMsg->Id) );
    number = lpMsg->Number;

    if (gObjIsAccontConnect(number, szId) == 0 )
    {
        return;
    }

    GCServerMsgStringSend("Your account is expired. You will exit the game automatically.", number, 0);
    gObjUserKill(number);
}
Ejemplo n.º 30
0
void GJPUserDisconnectRecv( SDHP_BILLKILLUSER * lpMsg)
{
	char szId[11];
	szId[10]=0;
	int number;

	memcpy( szId, lpMsg->Id , sizeof( lpMsg->Id ) );
	number = lpMsg->Number;

	if ( gObjIsAccontConnect(number, szId ) == 0 )
	{
		return;
	}

	GCServerMsgStringSend(lMsg.Get( MSGGET(6, 67) ), number, 0 );
	//gObjUserKill(number);
	CloseClient(number);
}