Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: map/atcommand.c
- ===================================================================
- --- map/atcommand.c (revision 15632)
- +++ map/atcommand.c (working copy)
- @@ -5789,6 +5789,111 @@
- }
- return 0;
- }
- +
- +ACMD_FUNC(nolootitem)
- +{
- + struct item_data *item_data = NULL;
- + int i;
- + int action = 3;
- +
- + if (message && *message) {
- + if (message[0] == '+') {
- + message++;
- + action = 1;
- + }
- + else if (message[0] == '-') {
- + message++;
- + action = 2;
- + }
- + else if (!strcmp(message,"reset"))
- + action = 4;
- + }
- +
- + if ( sd->state.autoloot == 0 && action != 3) {
- + clif_displaymessage(fd, "You must enable Autoloot to use this command.");
- + return -1;
- + }
- +
- + if (action < 3)
- + {
- + if ((item_data = itemdb_exists(atoi(message))) == NULL)
- + item_data = itemdb_searchname(message);
- + if (!item_data) {
- + clif_displaymessage(fd, "Item not found.");
- + return -1;
- + }
- + }
- +
- + switch ( action ) {
- + case 1:
- + ARR_FIND(i = 0, AUTOLOOTITEM_SIZE, i, sd->state.nolootid[i] == item_data->nameid);
- + if ( i < AUTOLOOTITEM_SIZE ) {
- + clif_displaymessage(fd, "This item is already in your nolootitem list.");
- + return -1;
- + }
- + ARR_FIND(i = 0, AUTOLOOTITEM_SIZE, i, sd->state.autolootid[i] == item_data->nameid);
- + if ( i < AUTOLOOTITEM_SIZE )
- + sd->state.autolootid[i] = 0;
- + ARR_FIND(i = 0, AUTOLOOTITEM_SIZE, i, sd->state.nolootid[i] == 0);
- + if (i == AUTOLOOTITEM_SIZE) {
- + clif_displaymessage(fd, "Your nolootitem list is full. Remove some items first with @nolootitem -<item name or ID>.");
- + return -1;
- + }
- + sd->state.nolootid[i] = item_data->nameid;
- + sprintf(atcmd_output, "Ignoring loot for item: '%s'/'%s' {%d}", item_data->name, item_data->jname, item_data->nameid);
- + clif_displaymessage(fd, atcmd_output);
- + sd->state.nolooting = 1;
- + break;
- +
- + case 2:
- + ARR_FIND(i = 0, AUTOLOOTITEM_SIZE, i, sd->state.nolootid[i] == item_data->nameid);
- + if ( i == AUTOLOOTITEM_SIZE ) {
- + clif_displaymessage(fd, "This item is not in your nolootitem list.");
- + return -1;
- + }
- + sd->state.nolootid[i] = 0;
- + sprintf(atcmd_output, "Removed item: '%s'/'%s' {%d} from your nolootitem list.", item_data->name, item_data->jname, item_data->nameid);
- + clif_displaymessage(fd, atcmd_output);
- + ARR_FIND(i = 0, AUTOLOOTITEM_SIZE, i, sd->state.nolootid[i] == 0);
- + if ( i < AUTOLOOTITEM_SIZE )
- + sd->state.nolooting = 0;
- + break;
- +
- + case 3:
- + sprintf(atcmd_output, "You can have %d items on your nolootitem list.", AUTOLOOTITEM_SIZE);
- + clif_displaymessage(fd, atcmd_output);
- + clif_displaymessage(fd, "Autoloot must be enabled to use this command.");
- + clif_displaymessage(fd, "To add item to the list, use \"@nolootitem +<item name or ID>\". To remove item use \"@nolootitem -<item name or ID>\".");
- + clif_displaymessage(fd, "\"@alootid reset\" will clear your autolootitem list.");
- + ARR_FIND(0, AUTOLOOTITEM_SIZE, i, sd->state.nolootid[i] != 0);
- + if (i == AUTOLOOTITEM_SIZE) {
- + clif_displaymessage(fd, "Your nolootitem list is empty.");
- + } else {
- + clif_displaymessage(fd, "Items on your nolootitem list:");
- + for(i = 0; i < AUTOLOOTITEM_SIZE; i++)
- + {
- + if (sd->state.nolootid[i] == 0)
- + continue;
- + if (!(item_data = itemdb_exists(sd->state.nolootid[i]))) {
- + ShowDebug("Non-existant item %d on nolootitem list (account_id: %d, char_id: %d)", sd->state.nolootid[i], sd->status.account_id, sd->status.char_id);
- + continue;
- + }
- + sprintf(atcmd_output, "'%s'/'%s' {%d}", item_data->name, item_data->jname, item_data->nameid);
- + clif_displaymessage(fd, atcmd_output);
- + }
- + }
- + break;
- +
- + case 4:
- + memset(sd->state.nolootid, 0, sizeof(sd->state.nolootid));
- + clif_displaymessage(fd, "Your nolootitem list has been reset.");
- + sd->state.nolooting = 0;
- + break;
- + }
- + return 0;
- +}
- +
- +
- /**
- * No longer available, keeping here just in case it's back someday. [Ind]
- **/
- @@ -8578,6 +8683,8 @@
- ACMD_DEF(delitem),
- ACMD_DEF(charcommands),
- ACMD_DEF(font),
- + ACMD_DEF(nolootitem),
- + ACMD_DEF2("noloot", nolootitem),
- /**
- * For Testing Purposes, not going to be here after we're done.
- **/
- Index: map/mob.c
- ===================================================================
- --- map/mob.c (revision 15632)
- +++ map/mob.c (working copy)
- @@ -1746,7 +1746,8 @@
- if( sd == NULL ) sd = map_charid2sd(dlist->third_charid);
- if( sd
- - && (drop_rate <= sd->state.autoloot || pc_isautolooting(sd, ditem->item_data.nameid))
- +// && (drop_rate <= sd->state.autoloot || pc_isautolooting(sd, ditem->item_data.nameid))
- + && ( ( drop_rate <= sd->state.autoloot && !pc_isnolooting(sd, ditem->item_data.nameid) ) || pc_isautolooting(sd, ditem->item_data.nameid))
- && (battle_config.idle_no_autoloot == 0 || DIFF_TICK(last_tick, sd->idletime) < battle_config.idle_no_autoloot)
- && (battle_config.homunculus_autoloot?1:!flag)
- #ifdef AUTOLOOT_DISTANCE
- Index: map/pc.c
- ===================================================================
- --- map/pc.c (revision 15632)
- +++ map/pc.c (working copy)
- @@ -8263,6 +8263,15 @@
- return (i != AUTOLOOTITEM_SIZE);
- }
- +bool pc_isnolooting(struct map_session_data *sd, int nameid)
- +{
- + int i;
- + if( !sd->state.nolooting )
- + return true;
- + ARR_FIND(0, AUTOLOOTITEM_SIZE, i, sd->state.nolootid[i] == nameid);
- + return (i != AUTOLOOTITEM_SIZE);
- +}
- +
- /**
- * Checks if player can use @/#command
- * @param sd Player map session data
- Index: map/pc.h
- ===================================================================
- --- map/pc.h (revision 15632)
- +++ map/pc.h (working copy)
- @@ -869,6 +869,7 @@
- int pc_read_motd(void); // [Valaris]
- int pc_disguise(struct map_session_data *sd, int class_);
- bool pc_isautolooting(struct map_session_data *sd, int nameid);
- +bool pc_isnolooting(struct map_session_data *sd, int nameid);
- /**
- * Mechanic (Mado Gear)
- **/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement