forked from Watcher187/UWoWScripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkillsystem.cpp
145 lines (128 loc) · 5.7 KB
/
killsystem.cpp
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#include "ScriptPCH.h"
#include <cstring>
/////////////////////// CONFIG /////////////////////////////
/////////////////////////////////////////////////////////////////////
float Version = 2.50f; //Don't touch this.
bool PvPSystemEnabled = true; //Set to false if you want to disable the PvP System
bool OnlyInBattlegrounds = true; //Set to true if you want to enable this only in battlegrounds.
bool LooseTokenOnPvPDeath = true; //Set to true if you want the victim to loose tokens when the victim dies.
int32 AmountOfItemsYouWantTheVictimToLoose = 1; //Amount of items you want the victim to loose when victim dies.
bool AddTokenOnPvPKill = true; //Set to false if you don't want the killer to be rewarded.
int32 ItemReward = 23247; //The ItemID of the reward.
int32 AmountOfRewardsOnKillStreak[5] = { 5, 10, 15, 20, 25 }; //With how many items you want to reward the killer when he slays the victim.
int32 HowManyTimesYouWantTheKillerToGetAwardedForKillingTheSameVictim = 2; //Name speaks for It self.
const int32 KillerStreak1 = 05;
const int32 KillerStreak2 = 10;
const int32 KillerStreak3 = 15;
const int32 KillerStreak4 = 20;
const int32 KillerStreak5 = 30;
int32 KillStreaks[5] = { KillerStreak1, KillerStreak2, KillerStreak3, KillerStreak4, KillerStreak5 };
///////////////////////////////////////////////////////////////////
/////////////////////// END ////////////////////////////
/////////////////////////////////////////////////////////////////
struct SystemInfo
{
uint32 KillStreak;
uint32 LastGUIDKill;
uint8 KillCount;
};
static std::map<uint32, SystemInfo> KillingStreak;
class System_OnPvPKill : public PlayerScript
{
public:
System_OnPvPKill() : PlayerScript("System_OnPvPKill") {}
void OnPVPKill(Player *pKiller, Player *pVictim)
{
if(PvPSystemEnabled == false)
{
return;
}
else if(PvPSystemEnabled == true)
{
uint32 kGUID;
uint32 vGUID;
char msg[500];
kGUID = pKiller->GetGUID();
vGUID = pVictim->GetGUID();
if(kGUID == vGUID)
{
return;
}
if(KillingStreak[kGUID].LastGUIDKill == vGUID)
{
KillingStreak[kGUID].KillCount++;
KillingStreak[vGUID].KillCount = 1;
pKiller->AddItem(ItemReward, 1);
if(LooseTokenOnPvPDeath == true)
pVictim->DestroyItemCount(ItemReward, AmountOfItemsYouWantTheVictimToLoose, true, false);
ChatHandler(pVictim->GetSession()).PSendSysMessage("You died, because of that you have lost an Event Token!");
}
if(KillingStreak[kGUID].LastGUIDKill != vGUID)
{
KillingStreak[kGUID].KillCount = 1;
KillingStreak[vGUID].KillCount = 1;
}
if(KillingStreak[kGUID].KillCount == HowManyTimesYouWantTheKillerToGetAwardedForKillingTheSameVictim)
{
return;
}
if(OnlyInBattlegrounds == true)
{
if(!pKiller->GetMap()->IsBattleground() || pKiller->GetMapId() == 30)
return;
}
KillingStreak[kGUID].KillStreak++;
KillingStreak[vGUID].KillStreak = 0;
KillingStreak[kGUID].LastGUIDKill = vGUID;
KillingStreak[vGUID].LastGUIDKill = 0;
if(AddTokenOnPvPKill == true)
pKiller->AddItem(29435, 1);
ChatHandler(pKiller->GetSession()).PSendSysMessage("You killed a player therefor you have been rewarded with his soul!");
if(LooseTokenOnPvPDeath == true)
pVictim->DestroyItemCount(ItemReward, AmountOfItemsYouWantTheVictimToLoose, true, false);
switch(KillingStreak[kGUID].KillStreak)
{
case KillerStreak1:
sprintf(msg, "|cffFF0000%s|cffFFFF05 killed |cffFF0000%s|cffFFFF05 and is on a |cffFF00005|cffFFFF05 kill streak. ", pKiller->GetName(), pVictim->GetName());
sWorld->SendWorldText(LANG_PVPKILL_SYSTEM, msg);
pKiller->AddItem(ItemReward, AmountOfRewardsOnKillStreak[1]);
pKiller->ModifyHonorPoints(250);
pKiller->CastSpell(pKiller, 24378, true);
break;
case KillerStreak2:
sprintf(msg, "|cffFF0000%s|cffFFFF05 killed |cffFF0000%s|cffFFFF05 and is on a |cffFF000010|cffFFFF05 kill streak. ", pKiller->GetName(), pVictim->GetName());
sWorld->SendWorldText(LANG_PVPKILL_SYSTEM, msg);
pKiller->AddItem(ItemReward, AmountOfRewardsOnKillStreak[2]);
pKiller->ModifyHonorPoints(250);
pKiller->CastSpell(pKiller, 24378, true);
break;
case KillerStreak3:
sprintf(msg, "|cffFF0000%s|cffFFFF05 killed |cffFF0000%s|cffFFFF05 and is on a |cffFF000015|cffFFFF05 kill streak. ", pKiller->GetName(), pVictim->GetName());
sWorld->SendWorldText(LANG_PVPKILL_SYSTEM, msg);
pKiller->AddItem(ItemReward, AmountOfRewardsOnKillStreak[3]);
pKiller->ModifyHonorPoints(250);
pKiller->CastSpell(pKiller, 24378, true);
break;
case KillerStreak4:
sprintf(msg, "|cffFF0000%s|cffFFFF05 killed |cffFF0000%s|cffFFFF05 and is on a |cffFF000020|cffFFFF05 kill streak. ", pKiller->GetName(), pVictim->GetName());
sWorld->SendWorldText(LANG_PVPKILL_SYSTEM, msg);
pKiller->AddItem(ItemReward, AmountOfRewardsOnKillStreak[4]);
pKiller->ModifyHonorPoints(250);
pKiller->CastSpell(pKiller, 24378, true);
break;
case KillerStreak5:
sprintf(msg, "|cffFF0000%s|cffFFFF05 killed |cffFF0000%s|cffFFFF05 and is on a |cffFF000030|cffFFFF05 kill streak. ", pKiller->GetName(), pVictim->GetName());
sWorld->SendWorldText(LANG_PVPKILL_SYSTEM, msg);
pKiller->AddItem(23247, 25);
KillingStreak[kGUID].KillStreak = 0;
pKiller->ModifyHonorPoints(250);
pKiller->CastSpell(pKiller, 24378, true);
break;
}
}
}
};
void AddSC_System()
{
new System_OnPvPKill;
}