View Single Post
Old 14.06.2007, 15:25   #11
humordwarf
Архивный участник
 
Join Date: Feb 2006
Posts: 453
Default

troubles:
1. when ur weight too high, u can not move, but can when u on strider
2. when u trading, u can go away too far and then confirm
проблемы:
1. при большом весе нельзя двигаться, но на страйдере почему-то можно
2. при передаче вещей можно убежать далеко, а затем только подтвердить

packet 0x01 handler fix this bugs

CP_01_MoveBackwardToLocation.cpp
Code:
#include "Globals.h"
#include "Creature.h"
#include "Structs.h"
#include "Item.h"
#include "ServerPackets.h"
#include "Trade.h"


UCHAR CP_01_MoveBackwardToLocation(CUserSocket *pUserSocket, UCHAR *pPacket)
{
	//int nX, nY, nZ;
	//int nToX, nToY, nToZ;

	//Disassemble(pPacket,"dddddd",&nX,&nY,&nZ,&nToX,&nToY,&nToZ);
	
	CCreature *pUser= pUserSocket->pUser;
	if (pUser==NULL) return 1; //handled

	//cant move if CTrade object created (trading)
	if (pUser->pTrade != NULL && pUser->pTrade->bIsInTrade)
	{
		SP_SM_TEXT(pUserSocket,SM_CANT_MOVE_IN_THIS_STATE);
		SP_ACTION_FAILED(pUserSocket);
		return 1; //handled
	}

	//cant move on strider/wyiern if your weight>70%
	if (pUser->GetMountType()!=0)
	{
		int nCurW = (int)pUser->GetCurrentWeight();
		int nMaxW = (int)pUser->GetMaxWeight();
		if (nMaxW<=0)
		{
			CLog_AddW(CLOG,2,L"WOW! CP_01_MoveBackwardToLocation: MaxWeight<=0 User=%s",pUser->Data->szName);
			nMaxW = 1;
		}

		int nPerc = 100*nCurW/nMaxW;
		if (nPerc>70)
		{
			SP_SM_TEXT(pUserSocket,SM_CANT_MOVE_WEIGHT_TOO_GREAT);
			SP_ACTION_FAILED(pUserSocket);
			return 1; //handled
		}
	}

	//in all other cases pass work to l2server
	return 0; //unhandled
}
humordwarf is offline