root/trunk/AE-go_GameServer/src/com/aionemu/gameserver/network/aion/serverpackets/SM_QUEST_ACCEPTED.java

6282440
20
20
21
import com.aionemu.gameserver.network.aion.AionConnection;
21
import com.aionemu.gameserver.network.aion.AionConnection;
22
import com.aionemu.gameserver.network.aion.AionServerPacket;
22
import com.aionemu.gameserver.network.aion.AionServerPacket;
23
import com.aionemu.gameserver.questEngine.model.QuestStatus;
23
24
24
/**
25
/**
25
 * @author MrPoke
26
 * @author MrPoke
26
 *
27
 * 
27
 */
28
 */
28
public class SM_QUEST_ACCEPTED extends AionServerPacket
29
public class SM_QUEST_ACCEPTED extends AionServerPacket
29
{
30
{
30
	private int questId;
31
	private int questId;
32
	private int status;
31
	private int step;
33
	private int step;
32
	private int unk2;
34
	private int action;
35
	private int timer;
36
37
 // accept = 1 - get quest 2 - quest steps/hand in 3 - fail/delete 4 - display client timer	
33
	
38
	
34
	public SM_QUEST_ACCEPTED(int questId, int step, int unk2)
39
	/**
40
	 *  Accept Quest(1)
41
	 */		
42
	public SM_QUEST_ACCEPTED(int questId, int status, int step)
35
	{
43
	{
44
		this.action = 1;
36
		this.questId = questId;
45
		this.questId = questId;
46
		this.status = status;
37
		this.step = step;
47
		this.step = step;
38
		this.unk2 = unk2;
39
	}
48
	}
49
40
	/**
50
	/**
51
	 *  Quest Steps/Finish (2)
52
	 */		
53
	public SM_QUEST_ACCEPTED(int questId, QuestStatus status, int step)
54
	{
55
		this.action = 2;
56
		this.questId = questId;
57
		this.status = status.value();
58
		this.step = step;
59
	}
60
61
	/**
62
	 *  Delete Quest(3)
63
	 */	
64
	public SM_QUEST_ACCEPTED(int questId)
65
	{
66
		this.action = 3;
67
		this.questId = questId;
68
		this.status = 0;
69
		this.step = 0;
70
	}
71
	
72
	/**
73
	 *  Display Timer(4)
74
	 */	
75
	public SM_QUEST_ACCEPTED(int questId, int timer)
76
	{
77
		this.action = 4;
78
		this.questId = questId;
79
		this.timer = timer;
80
		this.step = 0;
81
	}	
82
	/**
41
	 * {@inheritDoc}
83
	 * {@inheritDoc}
42
	 */
84
	 */
43
	@Override
85
	@Override
44
	protected void writeImpl(AionConnection con, ByteBuffer buf)
86
	protected void writeImpl(AionConnection con, ByteBuffer buf)
45
	{
87
	{
46
		writeH(buf, questId);
88
		switch(action)
47
		writeC(buf, step);
89
		{
48
		writeC(buf, unk2);
90
			case 1:
49
		writeD(buf, 0);
91
			case 2:
92
			case 3:
93
				writeC(buf, action);
94
				writeD(buf, questId);
95
				writeC(buf, status);// quest status goes by ENUM value
96
				writeC(buf, 0x0);
97
				writeD(buf, step);// current quest step
98
				writeH(buf, 0);
99
				break;
100
			case 4:
101
				writeC(buf, action);
102
				writeD(buf, questId);
103
				writeD(buf, timer);// sets client timer ie 84030000 is 900 seconds/15 mins
104
				writeC(buf, 0x01);
105
				writeH(buf, 0x0);
106
				writeC(buf, 0x01);
107
		}
50
	}
108
	}
51
52
}
109
}