summaryrefslogtreecommitdiff
path: root/world/map/npc/functions/default_npc_checks.txt
diff options
context:
space:
mode:
Diffstat (limited to 'world/map/npc/functions/default_npc_checks.txt')
-rw-r--r--world/map/npc/functions/default_npc_checks.txt155
1 files changed, 0 insertions, 155 deletions
diff --git a/world/map/npc/functions/default_npc_checks.txt b/world/map/npc/functions/default_npc_checks.txt
deleted file mode 100644
index cc5c4086..00000000
--- a/world/map/npc/functions/default_npc_checks.txt
+++ /dev/null
@@ -1,155 +0,0 @@
-// Default NPC Checks
-// Author: Wushin, mekolat
-
-// Range
-// Distance in Tiles
-// set @npc_distance, 4;
-function|script|PCtoNPCRange
-{
- set @npc_check, 0;
- set @Nmap$, strnpcinfo(3);
- if(!@npc_distance) set @npc_distance, 4; // <== default distance
- if(@npc_distance == (1-2)) set @npc_distance, ATTACKRANGE;
- cleararray @npc_loc, 0, 3;
- setarray @npc_loc, getnpcx(), getnpcy(), @npc_distance;
- set @Nx1, (@npc_loc[0] - @npc_loc[2]);
- set @Ny1, (@npc_loc[1] - @npc_loc[2]);
- set @Nx2, (@npc_loc[0] + @npc_loc[2]);
- set @Ny2, (@npc_loc[1] + @npc_loc[2]);
- if (isin(@Nmap$, @Nx1, @Ny1, @Nx2, @Ny2))
- goto L_Return;
- set @npc_check, 1;
- if(@distance_handler) goto L_Return;
- set @dnpc_name$, strnpcinfo(1);
- if(@dnpc_name$ != "") goto L_Named;
- message strcharinfo(0), "Server : ##BYou need to move closer to interact with this npc.";
- goto L_Return;
-
-L_Named:
- message strcharinfo(0), ""+@dnpc_name$+" : ##BPlease move closer.";
- goto L_Return;
-
-L_Return:
- set @dnpc_name$, "";
- set @distance_handler, 0;
- set @npc_distance, 0;
- cleararray @npc_loc, 0, 3;
- return;
-}
-
-// Inventory & Weight
-// @delitem_ids Items to delete
-// @delitem_counts Counts of Items to delete
-// @getitem_ids Items to get
-// @getitem_counts Counts of Items to get
-function|script|CheckInventory
-{
- set @del_loop, 0;
- set @get_loop, 0;
- set @delitem_loop, 0;
- set @getitem_loop, 0;
- set @check_fail, 0;
- set @msg_loop, 0;
-
- if (getarraysize(@delitem_ids))
- goto L_DelItemsLoop;
- goto L_CheckGet;
-
-L_DelItemsLoop:
- if(countitem(@delitem_ids[@delitem_loop]) >= @delitem_counts[@delitem_loop])
- goto L_DelLoopAgain;
- goto L_ReturnMissing;
-
-L_DelLoopAgain:
- set @delitem_loop, (@delitem_loop + 1);
- if(@delitem_loop == getarraysize(@delitem_ids))
- goto L_CheckGet;
- goto L_DelItemsLoop;
-
-L_CheckGet:
- if (getarraysize(@getitem_ids))
- goto L_CheckWeight;
- goto L_DelCheck;
-
-L_CheckWeight:
- getinventorylist;
- if (100 < (@inventorylist_count + getarraysize(@getitem_ids)))
- goto L_ReturnSpace;
- goto L_GetItemsLoop;
-
-L_GetItemsLoop:
- if (checkweight(@getitem_ids[@getitem_loop], @getitem_counts[@getitem_loop]))
- goto L_GetLoopAgain;
- goto L_ReturnWeight;
-
-L_GetLoopAgain:
- set @getitem_loop, (@getitem_loop + 1);
- if(@getitem_loop == getarraysize(@getitem_ids))
- goto L_DelCheck;
- goto L_GetItemsLoop;
-
-L_DelCheck:
- if (getarraysize(@delitem_ids))
- goto L_DelLoop;
- goto L_CheckGet2;
-
-L_DelLoop:
- delitem @delitem_ids[@del_loop], @delitem_counts[@del_loop];
- goto L_DelAgain;
-
-L_DelAgain:
- set @del_loop, (@del_loop + 1);
- if(@del_loop == getarraysize(@delitem_ids))
- goto L_GetLoop;
- goto L_DelLoop;
-
-L_CheckGet2:
- if (getarraysize(@getitem_ids))
- goto L_GetLoop;
- goto L_Return;
-
-L_GetLoop:
- misceffect FX_GETITEM, strcharinfo(0);
- getitem @getitem_ids[@get_loop], @getitem_counts[@get_loop];
- goto L_GetAgain;
-
-L_GetAgain:
- set @get_loop, (@get_loop + 1);
- if(@get_loop == getarraysize(@getitem_ids))
- goto L_Return;
- goto L_GetLoop;
-
-L_ReturnMissing:
- set @check_fail, 1;
- mes "\"You are missing required items.\"";
- goto L_MissingMsg;
-
-L_MissingMsg:
- mes "[@@"+@delitem_ids[@msg_loop]+"|"+getitemlink(@delitem_ids[@msg_loop])+"@@] "+countitem(getitemlink(@delitem_ids[@msg_loop]))+"/"+@delitem_counts[@msg_loop];
- goto L_NextMsgCheck;
-
-L_NextMsgCheck:
- set @msg_loop, (@msg_loop + 1);
- if(@msg_loop == getarraysize(@delitem_ids))
- goto L_Return;
- goto L_MissingMsg;
-
-L_ReturnWeight:
- mes "\"You need to be carrying less weight.\"";
- next;
- set @check_fail, 1;
- goto L_Return;
-
-L_ReturnSpace:
- mes "\"You need more room in your inventory.\"";
- next;
- set @check_fail, 1;
- goto L_Return;
-
-L_Return:
- cleararray @delitem_ids, "", getarraysize(@delitem_ids);
- cleararray @delitem_counts, "", getarraysize(@delitem_counts);
- cleararray @getitem_ids, "", getarraysize(@getitem_ids);
- cleararray @getitem_counts, "", getarraysize(@getitem_counts);
- return;
-}