pvp/pk reword protect

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
public void onKillUpdatePvPKarma(L2Character target)
{
//...............
//code...
//...............
if(targetPlayer.getObjectId() != _lastKill && count < Config.REWORD_PROTECT)
{
count += 1;
addItemReword(targetPlayer);
}
else if(count >= Config.REWORD_PROTECT && targetPlayer.getObjectId() == _lastKill)
{
count = 0;
addItemReword(targetPlayer);
}
else
{
//_lastKill = targetPlayer.getObjectId();
//addItemReword(targetPlayer);
}
targetPlayer = null;
}
private void addItemReword(L2PcInstance targetPlayer)
{
//IP check
if(targetPlayer.getClient().getConnection().getInetAddress() != this.getClient().getConnection().getInetAddress())
{
if (targetPlayer.getKarma() > 0 || targetPlayer.getPvpFlag() >= 0)
{
// Reward PVP win by giving them an Incarnadine Coin,
// Description: Winning PvP, item Id: 6392, Count: 1, medal: this, Reference: none
if (Config.PVP_REWARD_ENABLED)
{
int item = Config.PVP_REWORD_ID;
int amount = Config.PVP_REWORD_AMOUNT;
getInventory().addItem("Winning PvP", (Config.PVP_REWORD_ID) , (Config.PVP_REWORD_AMOUNT), this, null);
this.sendMessage("You have earned " + amount + " item(s) of ID " + item + ".");
}
if (!Config.FORCE_INVENTORY_UPDATE)
{
InventoryUpdate iu = new InventoryUpdate();
iu.addItem(_inventory.getItemByItemId(Config.PVP_REWORD_ID));
sendPacket(iu);
iu = null;
}
}
else
{
// Reward PK win by giving them an Incarnadine Coin,
// Description: Winning PK, item Id: 6392, Count: 1, medal: this, Reference: none
if (Config.PK_REWARD_ENABLED)
{
int item = Config.PK_REWORD_ID;
int amount = Config.PK_REWORD_AMOUNT;
getInventory().addItem("Winning PK", (Config.PK_REWORD_ID) , (Config.PK_REWORD_AMOUNT), this, null);
this.sendMessage("You have earned " + amount + " item(s) of ID " + item + ".");
}
if (!Config.FORCE_INVENTORY_UPDATE)
{
InventoryUpdate iu = new InventoryUpdate();
iu.addItem(_inventory.getItemByItemId(Config.PK_REWORD_ID));
sendPacket(iu);
iu = null;
}
}
}
}