summaryrefslogtreecommitdiff
path: root/src/map/party.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-03-01 18:18:32 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-03-01 18:18:32 +0000
commit7564712d7fc9d13890011fdd22215e9ff912e1a4 (patch)
tree029e50b1c4a0f231a784b8aae076926043dfb17a /src/map/party.c
parenta6bc36f6d9a6bbf163554e9cf9523b43216c0c04 (diff)
downloadhercules-7564712d7fc9d13890011fdd22215e9ff912e1a4.tar.gz
hercules-7564712d7fc9d13890011fdd22215e9ff912e1a4.tar.bz2
hercules-7564712d7fc9d13890011fdd22215e9ff912e1a4.tar.xz
hercules-7564712d7fc9d13890011fdd22215e9ff912e1a4.zip
- Turn Undead and Offensive Resurrection should now work on undead players.
- Fixed the range checking of Repair weapon - Rude attacked is now also triggered when you hit a target that can't move out of their melee attack range. - Mob ai will attempt to do a long-range attacked condition skill before unlocking a target when it is attacked and said target is out of melee range of a non-walking mob. - Corrected mobskill event to set the target_id before triggering. - Moved MSC_SKILLUSED trigger to mobskill_event which is triggered in battle_calc_damage. It is also triggered on skill_castend_nodamage_id - Added party_share_loot for handling party-share loot. it should now work with autoloot as well. - Fixed skill_break_rate breaking stuff even if the rate is 0. - pc_stopwalking will not send a fixpos packet if you are sitting. - mob_can_reach rude-attacked condition now uses the mob's field of view. - SC_NOCHAT is automatically started on pc_authok if manner is negative. - Map server now refuses to start if you try to define a label with the same name as some const.txt defined character parameter. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5414 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/party.c')
-rw-r--r--src/map/party.c69
1 files changed, 66 insertions, 3 deletions
diff --git a/src/map/party.c b/src/map/party.c
index 65486dcea..98f4b80ca 100644
--- a/src/map/party.c
+++ b/src/map/party.c
@@ -696,13 +696,76 @@ int party_exp_share(struct party *p,int map,unsigned int base_exp,unsigned int j
return 0;
}
-int party_send_dot_remove(struct map_session_data *sd)
+int party_share_loot(struct party *p, TBL_PC *sd, struct item *item_data)
{
- if (sd->status.party_id)
- clif_party_xy_remove(sd);
+ TBL_PC *target=NULL;
+ int i;
+ if (p && p->item&2) {
+ //item distribution to party members.
+ if (battle_config.party_share_type) { //Round Robin
+ TBL_PC *psd;
+ i = p->itemc;
+ do {
+ i++;
+ if (i >= MAX_PARTY)
+ i = 0; // reset counter to 1st person in party so it'll stop when it reaches "itemc"
+ if ((psd=p->member[i].sd)==NULL || sd->bl.m != psd->bl.m)
+ continue;
+
+ if (pc_additem(psd,item_data,item_data->amount))
+ continue; //Chosen char can't pick up loot.
+ //Successful pick.
+ p->itemc = i;
+ target = psd;
+ break;
+ } while (i != p->itemc);
+ } else { //Random pick
+ TBL_PC *psd[MAX_PARTY];
+ int count=0;
+ //Collect pick candidates
+ for (i = 0; i < MAX_PARTY; i++) {
+ if ((psd[count]=p->member[i].sd) && psd[count]->bl.m == sd->bl.m)
+ count++;
+ }
+ if (count > 0) { //Pick a random member.
+ do {
+ i = rand()%count;
+ if (pc_additem(psd[i],item_data,item_data->amount))
+ { //Discard this receiver.
+ psd[i] = psd[count-1];
+ count--;
+ } else { //Successful pick.
+ target = psd[i];
+ break;
+ }
+ } while (count > 0);
+ }
+ }
+ }
+ if (!target) { //Give it to the owner.
+ target = sd;
+ if (!(i=pc_additem(sd,item_data,item_data->amount)))
+ return i;
+ }
+
+ if(log_config.pick) //Logs items, taken by (P)layers [Lupus]
+ log_pick(target, "P", 0, item_data->nameid, item_data->amount, item_data);
+ //Logs
+ if(battle_config.party_show_share_picker && target != sd){
+ char output[80];
+ sprintf(output, "%s acquired the item.",target->status.name);
+ clif_disp_onlyself(sd,output,strlen(output));
+ }
return 0;
}
+int party_send_dot_remove(struct map_session_data *sd)
+{
+if (sd->status.party_id)
+ clif_party_xy_remove(sd);
+return 0;
+}
+
// To use for Taekwon's "Fighting Chant"
// int c = 0;
// party_foreachsamemap(party_sub_count, sd, 0, &c);