return;
}
-int Achievements_get_achievement_value(entity this, string achieve) {
+int Achievements_get_achievement_value(entity this, string achieve) {
if (achieve == "triple_kill") return this.triple_kill;
if (achieve == "rage") return this.rage;
if (achieve == "massacre") return this.massacre;
return 0;
}
+string Achievements_get_achievement_title(string achieve) {
+
+ if (achieve == "triple_kill") return "Tripple Kill!";
+ if (achieve == "rage") return "Rage!";
+ if (achieve == "massacre") return "Massacre!";
+ if (achieve == "mayhem") return "Mayhem!";
+ if (achieve == "berserker") return "Berserker!";
+ if (achieve == "carnage") return "Carnage!";
+ if (achieve == "armageddon") return "Armageddon!";
+
+ if (achieve == "firstblood") return "First Blood!";
+
+ if (achieve == "airshot") return "Air Shot!";
+ if (achieve == "amazing") return "Amazing!";
+ if (achieve == "awesome") return "Awesome!";
+ if (achieve == "botlike") return "Botlike!";
+ if (achieve == "electrobitch") return "Electro-BITCH!";
+ if (achieve == "impressive") return "Impressive!";
+ if (achieve == "flyingyoda") return "Yoda!";
+
+ if (achieve == "multirailed") return "Multi Railed!";
+ if (achieve == "pointblank") return "Point Blank!";
+ if (achieve == "selfimmolation") return "Self-Immolation!";
+ return "";
+}
+
string Achievements_get_achievement_name_from_kills(int kills) {
if (kills == 3) return "triple_kill";
return "";
}
-string Achievements_get_achievement_title_from_kills(int kills) {
-
- if (kills == 3) return "Tripple Kill!";
- if (kills == 5) return "Rage!";
- if (kills == 10) return "Massacre!";
- if (kills == 15) return "Mayhem!";
- if (kills == 20) return "Berserker!";
- if (kills == 25) return "Carnage!";
- if (kills == 30) return "Armageddon!";
- return "";
-}
-
void Achievements_inc_kill_achievement(entity this, int kills) {
return Achievements_inc_achievement(this, Achievements_get_achievement_name_from_kills(kills));
return Achievements_add_achievement_value(this, achieve, 1);
}
-void Achievements_announce(Achievements this, entity whom, string title, string achieve) {
+void Achievements_announce(Achievements this, entity whom, string achieve) {
#ifdef SVQC
+ string title = Achievements_get_achievement_title(achieve);
centerprint(whom, strcat(title, " [", ftos(this.get_achievement_value(this, achieve)), "]"));
print(strcat(whom.netname, " got ", achieve, " achievement.\n"));
#endif
METHOD(Achievements, inc_kill_achievement, void(Achievements this, int kills));
METHOD(Achievements, inc_achievement, void(Achievements this, string achieve));
+ //Static methods
METHOD(Achievements, get_achievement_name_from_kills, string(int kills));
- METHOD(Achievements, get_achievement_title_from_kills, string(int kills));
+ METHOD(Achievements, get_achievement_title, string(string achieve));
//Announce functions
- METHOD(Achievements, announce, void(Achievements this, entity whom, string title, string achieve));
+ METHOD(Achievements, announce, void(Achievements this, entity whom, string achieve));
CONSTRUCTOR(Achievements, entity aplayer)
{
if(IsFlying(directhitentity)) {
Send_Notification(NOTIF_ONE, this.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_AIRSHOT);
achs.inc_achievement(achs, "airshot");
- achs.announce(achs, this.realowner, "Air Shot!", "airshot");
+ achs.announce(achs, this.realowner, "airshot");
}
this.event_damage = func_null;
if(IsFlying(directhitentity)) {
Send_Notification(NOTIF_ONE, this.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_ELECTROBITCH);
achs.inc_achievement(achs, "electrobitch");
- achs.announce(achs, this.realowner, "Electro-BITCH!", "electrobitch");
+ achs.announce(achs, this.realowner, "electrobitch");
}
this.event_damage = func_null;
if(IsFlying(directhitentity)) {
Send_Notification(NOTIF_ONE, this.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_AIRSHOT);
achs.inc_achievement(achs, "airshot");
- achs.announce(achs, this.realowner, "Air Shot!", "airshot");
+ achs.announce(achs, this.realowner, "airshot");
}
this.event_damage = func_null;
if(IsFlying(directhitentity)) {
Send_Notification(NOTIF_ONE, this.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_AIRSHOT);
achs.inc_achievement(achs, "airshot");
- achs.announce(achs, this.realowner, "Air Shot!", "airshot");
+ achs.announce(achs, this.realowner, "airshot");
}
this.event_damage = func_null;
if(IsFlying(directhitentity)){
Send_Notification(NOTIF_ONE, this.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_AIRSHOT);
achs.inc_achievement(achs, "airshot");
- achs.announce(achs, this.realowner, "Air Shot!", "airshot");
+ achs.announce(achs, this.realowner, "airshot");
}
this.event_damage = func_null;
if (damage_goodhits > 1) {
Send_Notification(NOTIF_ONE, actor, MSG_ANNCE, ANNCE_ACHIEVEMENT_ELECTROBITCH);
achs.inc_achievement(achs, "multirailed");
- achs.announce(achs, actor, "Multi Railed!", "multirailed");
+ achs.announce(achs, actor, "multirailed");
}
if(yoda && flying) {
{
Send_Notification(NOTIF_ONE, actor, MSG_ANNCE, ANNCE_ACHIEVEMENT_IMPRESSIVE);
achs.inc_achievement(achs, "impressive");
- achs.announce(achs, actor, "Impressive!", "impressive");
+ achs.announce(achs, actor, "impressive");
damage_goodhits = 0; // only every second time
}
if(IsFlying(directhitentity)) {
Send_Notification(NOTIF_ONE, this.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_ELECTROBITCH);
achs.inc_achievement(achs, "electrobitch");
- achs.announce(achs, this.realowner, "Electro-BITCH!", "electrobitch");
+ achs.announce(achs, this.realowner, "electrobitch");
}
this.event_damage = func_null;
if (damage_goodhits > 1) {
Send_Notification(NOTIF_ONE, actor, MSG_ANNCE, ANNCE_ACHIEVEMENT_ELECTROBITCH);
achs.inc_achievement(achs, "multirailed");
- achs.announce(achs, actor, "Multi Railed!", "multirailed");
+ achs.announce(achs, actor, "multirailed");
}
if(yoda && flying) {
{
Send_Notification(NOTIF_ONE, actor, MSG_ANNCE, ANNCE_ACHIEVEMENT_IMPRESSIVE);
achs.inc_achievement(achs, "impressive");
- achs.announce(achs, actor, "Impressive!", "impressive");
+ achs.announce(achs, actor, "impressive");
damage_goodhits = 0; // only every second time
}
entity achv = this.achievements;
achv.inc_achievement(achv, "pointblank");
- achv.announce(achv, this, "Point Blank!", "pointblank");
+ achv.announce(achv, this, "pointblank");
}
this.pointblank_checker = 0;
if (this.suicide) {
entity achv = this.achievements;
achv.inc_achievement(achv, "selfimmolation");
- achv.announce(achv, this, "Self-Immolation!", "selfimmolation");
+ achv.announce(achv, this, "selfimmolation");
}
this.suicide = 0;
void announce_spree(int counta, entity achv, entity element) {
achv.inc_kill_achievement(achv, counta);
- achv.announce(achv, element, achv.get_achievement_title_from_kills(counta), achv.get_achievement_name_from_kills(counta));
+ achv.announce(achv, element, achv.get_achievement_name_from_kills(counta));
}
void Obituary(entity attacker, entity inflictor, entity targ, int deathtype, .entity weaponentity)
//Send achievement for first blood
entity achv = attacker.achievements;
achv.set_achievement_value(achv, "firstblood", 1);
- achv.announce(achv, attacker, "First Blood!", "firstblood");
+ achv.announce(achv, attacker, "firstblood");
// tell spree_inf and spree_cen that this is a first-blood and first-victim event
kill_count_to_attacker = -1;