but this is just for ELEVATOR_METALWORKS_ELVTR_2 ELEVATOR_METALWORKS_ELVTR_1
I haven't script them all yet..
The elevators seem to move every minute and a half unless triggered then they can move on call.
Code: Select all
void CTransportHandler::startElevator(Elevator_t * elevator)
{
/*
ELEVATOR_PSOXJA_ELVTR_1 = 1,
ELEVATOR_PSOXJA_ELVTR_2 = 2,
ELEVATOR_PSOXJA_ELVTR_3 = 3,
ELEVATOR_PSOXJA_MVNG_FLR_4 = 4,
ELEVATOR_PSOXJA_MVNG_FLR_3 = 5,
ELEVATOR_PSOXJA_MVNG_FLR_1 = 6,
ELEVATOR_PSOXJA_MVNG_FLR_2 = 7,
ELEVATOR_PSOXJA_1 = 8,
ELEVATOR_PSOXJA_2 = 9,
ELEVATOR_PSOXJA_3 = 10,
ELEVATOR_PSOXJA_4 = 11,
ELEVATOR_PSOXJA_5 = 12,
ELEVATOR_PSOXJA_6 = 13,
ELEVATOR_PSOXJA_ELVTR_4 = 14,
ELEVATOR_PSOXJA_ELVTR_5 = 15,
ELEVATOR_PSOXJA_ELVTR_6 = 16,
ELEVATOR_PSOXJA_ELVTR_7 = 17,
ELEVATOR_PSOXJA_DSPPRNG_TLS_4 = 18,
ELEVATOR_PSOXJA_DSPPRNG_TLS_1 = 19,
ELEVATOR_PSOXJA_DSPPRNG_TLS_2 = 20,
ELEVATOR_FORT_GHELSBA_ELVTR = 21,
ELEVATOR_PALBOROUGH_MINES_ELVTR = 22, // TODO: Verify NPC ID of upper and lower door
ELEVATOR_DAVOI_ELVTR = 23, // in elevators.sql
ELEVATOR_KUFTAL_TUNNEL_DSPPRNG_RCK = 24,
ELEVATOR_PORT_BASTOK_DRWBRDG = 25,
ELEVATOR_METALWORKS_ELVTR_1 = 26,
ELEVATOR_METALWORKS_ELVTR_2 = 27
*/
uint32 VanaTime = CVanaTime::getInstance()->getVanaTime();
uint8 tiemoffset = VanaTime; //USING UINT8 TO GET TWO VAULES OF EAITHER 16 OR 144 TO USE FOR UP OR DOWN SWITCHS
elevator->Elevator->name[8] = 6; //THIS SEEMS TO BE SOME TYPE OF SPEED THE LOWER THE VALUE THE FASTER IT GOES AND THE HIGHER THE SLOWER
WBUFL(&elevator->Elevator->name[0],4) = VanaTime;
if ((elevator->LowerDoor != NULL) && (elevator->UpperDoor != NULL))
{
if(tiemoffset == 16)//THIS IS A SWITCH OF THE TWO I USE FOR UP OR DOWN
{
if(elevator->id == ELEVATOR_METALWORKS_ELVTR_1)//SCRIPTING EACH ONE FOR THE WAY THEY ACT IN THIS CASE ONE IS UP WHILE THE OTHER IS DOWN
{
elevator->Elevator->animation = ANIMATION_ELEVATOR_DOWN;
ShowDebug(CL_GREEN"GOING DOWN\n"CL_RESET );
zoneutils::GetZone(elevator->zone)->PushPacket(NULL,CHAR_INZONE, new CEntityUpdatePacket(elevator->Elevator,ENTITY_UPDATE));
elevator->LowerDoor->animation = ANIMATION_CLOSE_DOOR;
zoneutils::GetZone(elevator->zone)->PushPacket(NULL,CHAR_INZONE, new CEntityUpdatePacket(elevator->LowerDoor,ENTITY_UPDATE));
elevator->UpperDoor->animation = ANIMATION_OPEN_DOOR;
zoneutils::GetZone(elevator->zone)->PushPacket(NULL,CHAR_INZONE, new CEntityUpdatePacket(elevator->UpperDoor,ENTITY_UPDATE));
}
if(elevator->id == ELEVATOR_METALWORKS_ELVTR_2)//SCRIPTING EACH ONE FOR THE WAY THEY ACT IN THIS CASE ONE IS UP WHILE THE OTHER IS DOWN
{
elevator->Elevator->animation = ANIMATION_ELEVATOR_UP;
ShowDebug(CL_GREEN"GOING UP\n"CL_RESET );
zoneutils::GetZone(elevator->zone)->PushPacket(NULL,CHAR_INZONE, new CEntityUpdatePacket(elevator->Elevator,ENTITY_UPDATE));
elevator->LowerDoor->animation = ANIMATION_OPEN_DOOR;
zoneutils::GetZone(elevator->zone)->PushPacket(NULL,CHAR_INZONE, new CEntityUpdatePacket(elevator->LowerDoor,ENTITY_UPDATE));
elevator->UpperDoor->animation = ANIMATION_CLOSE_DOOR;
zoneutils::GetZone(elevator->zone)->PushPacket(NULL,CHAR_INZONE, new CEntityUpdatePacket(elevator->UpperDoor,ENTITY_UPDATE));
}
}
if(tiemoffset == 144)//THIS IS A SWITCH OF THE TWO I USE FOR UP OR DOWN
{
if(elevator->id == ELEVATOR_METALWORKS_ELVTR_1) //SCRIPTING EACH ONE FOR THE WAY THEY ACT IN THIS CASE ONE IS UP WHILE THE OTHER IS DOWN
{
elevator->Elevator->animation = ANIMATION_ELEVATOR_UP;
ShowDebug(CL_GREEN"GOING UP\n"CL_RESET );
zoneutils::GetZone(elevator->zone)->PushPacket(NULL,CHAR_INZONE, new CEntityUpdatePacket(elevator->Elevator,ENTITY_UPDATE));
elevator->LowerDoor->animation = ANIMATION_OPEN_DOOR;
zoneutils::GetZone(elevator->zone)->PushPacket(NULL,CHAR_INZONE, new CEntityUpdatePacket(elevator->LowerDoor,ENTITY_UPDATE));
elevator->UpperDoor->animation = ANIMATION_CLOSE_DOOR;
zoneutils::GetZone(elevator->zone)->PushPacket(NULL,CHAR_INZONE, new CEntityUpdatePacket(elevator->UpperDoor,ENTITY_UPDATE));
}
if(elevator->id == ELEVATOR_METALWORKS_ELVTR_2)//SCRIPTING EACH ONE FOR THE WAY THEY ACT IN THIS CASE ONE IS UP WHILE THE OTHER IS DOWN
{
elevator->Elevator->animation = ANIMATION_ELEVATOR_DOWN;
ShowDebug(CL_GREEN"GOING DOWN\n"CL_RESET );
zoneutils::GetZone(elevator->zone)->PushPacket(NULL,CHAR_INZONE, new CEntityUpdatePacket(elevator->Elevator,ENTITY_UPDATE));
elevator->LowerDoor->animation = ANIMATION_CLOSE_DOOR;
zoneutils::GetZone(elevator->zone)->PushPacket(NULL,CHAR_INZONE, new CEntityUpdatePacket(elevator->LowerDoor,ENTITY_UPDATE));
elevator->UpperDoor->animation = ANIMATION_OPEN_DOOR;
zoneutils::GetZone(elevator->zone)->PushPacket(NULL,CHAR_INZONE, new CEntityUpdatePacket(elevator->UpperDoor,ENTITY_UPDATE));
}
}
}
}