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
|
// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL.
// Copyright (c) 2014 - 2015 Evol developers
#include "common/hercules.h"
#include "common/nullpo.h"
#include "common/timer.h"
#include "common/socket.h" // last_tick
#include "common/utils.h"
#include "map/battle.h"
#include "map/intif.h"
#include "map/map.h"
#include "map/party.h"
#include "map/pc.h"
#include "plugins/HPMHooking.h"
HPExport struct HPMHooking_interface HPMHooking_s;
#include "common/HPMDataCheck.h" /* should always be the last file included! (if you don't make it last, it'll intentionally break compile time) */
// exp share and added zeny share [Valaris]
int eparty_exp_share(struct party_data **p, struct block_list **src, unsigned int *baseexp, unsigned int *jobexp, int *zeny __attribute__ ((unused)))
{
hookStop();
struct map_session_data* sd[MAX_PARTY];
unsigned int i, c, lvl;
unsigned int base_exp, job_exp;
nullpo_ret(p);
nullpo_ret(src);
// count the number of players eligible for exp sharing
// TODO: (battle_config.idle_no_share && pc_isidle(sd[c]))
// i.e. Do not force the battle conf settings!! (Specially if it can explode)
for (i = c = 0; i < MAX_PARTY; i++) {
if( (sd[c] = (*p)->data[i].sd) == NULL || sd[c]->bl.m != (*src)->m || pc_isdead(sd[c]) || pc_isidle(sd[c]) )
continue;
c++;
lvl += sd[c]->status.base_level; // XXX
}
if (c < 1)
return 0;
// We don't care for pointers...
base_exp=*baseexp;
job_exp=*jobexp;
/* GP sharing defunct */
//zeny/=c;
// TODO: Apply bonuses
/*
if (battle_config.party_even_share_bonus && c > 1) {
double bonus = 100 + battle_config.party_even_share_bonus*(c-1);
if (base_exp)
base_exp = (unsigned int) cap_value(base_exp * bonus/100, 0, UINT_MAX);
if (job_exp)
job_exp = (unsigned int) cap_value(job_exp * bonus/100, 0, UINT_MAX);
//if (zeny)
// zeny = (unsigned int) cap_value(zeny * bonus/100, INT_MIN, INT_MAX);
}
*/
for (i = 0; i < c; i++) {
//pc->gainexp(sd[i], src, base_exp, job_exp, false);
// XXX
pc->gainexp(sd[i], (*src),
base_exp*sd[i]->status.base_level/lvl,
job_exp*sd[i]->status.base_level/lvl,
false);
//if (zeny) // zeny from mobs [Valaris]
// pc->getzeny(sd[i],zeny,LOG_TYPE_PICKDROP_MONSTER,NULL);
}
return 0;
}
// TODO: Override party_share_loot
// party_share_type does not contains 2 ("random")
// Use level as randomness criteria
|