|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Quests::Plugins & Mods Completed plugins for public use as well as modifications. |
|
|
|
02-21-2010, 11:50 AM
|
|
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
Plugin::RandomWeapons()
Here is a long but interesting plugin. It will randomly select a weapon for the primary slot and a weapon or shield for the secondary slot. Other than the first 2 fields, the rest are all optional.
This plugin requires the RandomRange() plugin from this link:
http://www.eqemulator.org/forums/showthread.php?t=30421
This plugin also requires at least SVN Source Code Revision 1259 or later!
Here are the steps to add this plugin to your server:
1. Open notepad, or whatever text editor you prefer.
2. Copy and paste the following code into Notepad:
Code:
#Usage: plugin::RandomWeapons(MinModelNum, MaxModelNum, MyChance, MinShieldNum, MaxShieldNum, NoDualWield?, IgnoreClass? );
#Example: plugin::RandomWeapons(1, 11169, 50, 200, 230, 0, 0);
#MinModelNum - Minimum Model Number to use for selecting Primary/Offhand Weapons
#MaxModelNum - Maximum Model Number to use for selecting Primary/Offhand Weapons
#MyChance - The percent chance that the NPC will wield any weapons (1 - 100)
#MinShieldNum - Minimum Model Number to use for selecting Shields
#MaxShieldNum - Maximum Model Number to use for selecting Shields
#NoDualWield? - 1 = NPCs won't dual wield or use shield, 0 = They have a chance to dual wield / shield
#IgnoreClass? - 1 = Weapon selection will choose any random model number within the range given, 0 = Smart weapon selection based on NPC class
sub RandomWeapons {
my $npc = plugin::val('$npc');
my $MinModelNum = $_[0];
my $MaxModelNum = $_[1];
my $MyChance = $_[2];
my $MinShieldNum = $_[3];
my $MaxShieldNum = $_[4];
my $NoDualWield = $_[5];
my $IgnoreClass = $_[6];
%WeaponModels = (
#BEGIN Classic Weapon Models
1 => "1HS",
2 => "2HS",
3 => "1HS",
4 => "BOW",
5 => "1HP",
6 => "CASTER",
7 => "1HB",
8 => "2HB",
9 => "1HS",
10 => "OTHER", #Arrow
11 => "1HS", #SOE Fanfair Reward
12 => "STAFF", #SOE Fanfair Reward
13 => "STAFF", #SOE Fanfair Reward
14 => "1HB",
15 => "BARD",
16 => "1HP",
17 => "1HP",
18 => "1HB",
19 => "1HB",
20 => "1HP",
21 => "BARD",
22 => "1HS",
23 => "2HS",
24 => "2HB",
25 => "2HS",
26 => "1HS",
27 => "CASTER",
28 => "CASTER",
29 => "STAFF",
30 => "2HP",
31 => "1HB",
32 => "OTHER", #Broom
33 => "1HB",
34 => "1HS",
35 => "1HB",
36 => "OTHER", #Torch
37 => "1HB",
38 => "OTHER", #Fishing Pole
39 => "2HS",
40 => "1HS",
41 => "1HS",
42 => "1HS",
43 => "1HB",
44 => "1HS",
45 => "STAFF",
46 => "CASTER",
47 => "CASTER",
48 => "OTHER", #Lantern
49 => "1HB",
50 => "1HP",
51 => "1HB",
52 => "OTHER", #Shovel
53 => "2HS",
54 => "OTHER", #Cigar
55 => "OTHER", #Pipe
56 => "OTHER", #Mug
57 => "1HS",
58 => "1HS",
59 => "1HB",
60 => "1HS",
61 => "1HS",
62 => "1HS", #SoulFire
63 => "OTHER", #Small Bag
64 => "OTHER", #Large Bag
65 => "OTHER", #Scroll
66 => "TRADESKILL", #Forge
67 => "CASTER", #Voodoo Doll
68 => "H2H",
69 => "TRADESKILL", #Oven
70 => "TRADESKILL", #Brew Barrel
71 => "H2H",
72 => "CASTER",
73 => "TRADESKILL", #Kiln
74 => "TRADESKILL", #Pottery Wheel
75 => "STAFF",
76 => "2HS", #Luclin Weapn Model
78 => "OTHER", #Fire
79 => "2HP",
80 => "2HS",
81 => "1HS",
82 => "1HS",
83 => "2HS",
84 => "2HS",
85 => "1HS",
86 => "2HS",
87 => "1HS",
#END Classic Weapon Models
#BEGIN Kunark Weapon Models
88 => "2HS",
89 => "1HS",
90 => "1HS",
91 => "H2H",
92 => "2HP",
93 => "2HS",
94 => "H2H",
95 => "2HS",
96 => "CASTER", #Added for special quest later
97 => "1HS", #GM Sword
98 => "H2H",
99 => "1HS",
100 => "1HS",
101 => "2HB",
102 => "1HB",
103 => "2HP",
104 => "1HS",
105 => "1HS",
106 => "2HS",
107 => "1HS",
108 => "1HS",
109 => "1HS",
110 => "2HS",
111 => "2HB",
112 => "1HB",
113 => "1HS",
115 => "1HB",
117 => "2HB",
118 => "1HP",
119 => "1HP",
120 => "1HS",
121 => "1HS",
122 => "STAFF",
123 => "STAFF",
124 => "2HB",
125 => "STAFF",
126 => "STAFF",
127 => "STAFF",
128 => "TRADESKILL", #Loom
129 => "STAFF",
130 => "1HB",
131 => "1HS",
132 => "2HP",
133 => "CASTER",
134 => "CASTER",
135 => "H2H",
136 => "H2H",
137 => "BARD",
138 => "BARD",
139 => "1HP",
#BEGIN Epic 1.0s
140 => "1HP",
141 => "1HS",
142 => "1HS",
145 => "2HS",
146 => "2HS",
148 => "1HS",
149 => "1HS",
150 => "1HS",
151 => "CASTER",
153 => "STAFF",
154 => "2HP",
155 => "CASTER",
156 => "1HB",
157 => "CASTER",
160 => "2HS",
#END Epic 1.0s
#END Kunark Weapon Models
#BEGIN Velious Weapon Models
161 => "1HS",
162 => "1HS",
163 => "1HS",
164 => "1HS",
165 => "1HS",
166 => "2HS",
167 => "1HP",
168 => "1HS",
169 => "2HB",
170 => "1HS",
171 => "1HS",
172 => "2HP",
173 => "2HS",
174 => "1HS",
175 => "1HS",
176 => "2HS",
177 => "1HB",
178 => "2HB",
179 => "1HB",
180 => "1HB",
181 => "1HS",
182 => "1HS",
183 => "1HS",
184 => "1HS",
185 => "1HB",
186 => "STAFF",
187 => "2HP",
188 => "1HS",
189 => "1HB",
190 => "2HS",
191 => "1HS",
192 => "1HS",
193 => "1HB",
194 => "1HP",
195 => "1HP",
196 => "1HS",
197 => "2HP",
198 => "BOW",
199 => "BOW",
200 => "SHIELD",
201 => "SHIELD",
202 => "SHIELD",
203 => "SHIELD",
204 => "SHIELD",
205 => "SHIELD",
206 => "SHIELD",
207 => "SHIELD",
208 => "SHIELD",
209 => "SHIELD",
210 => "SHIELD",
211 => "SHIELD",
212 => "SHIELD",
213 => "SHIELD",
214 => "SHIELD",
215 => "SHIELD",
216 => "SHIELD",
217 => "SHIELD",
218 => "SHIELD",
219 => "SHIELD",
220 => "SHIELD",
221 => "SHIELD",
222 => "SHIELD",
223 => "SHIELD",
224 => "SHIELD",
225 => "SHIELD",
226 => "SHIELD",
227 => "SHIELD",
228 => "SHIELD",
250 => "OTHER", #Lollipop
300 => "2HS",
301 => "1HS",
308 => "STAFF",
#END Velious Weapon Models
#BEGIN Luclin Weapon Models
10000 => "1HS",
10001 => "2HB",
10002 => "1HS",
10003 => "1HB",
10004 => "2HS",
10005 => "1HS",
10006 => "1HP",
10007 => "1HB",
10008 => "1HB",
10009 => "1HP",
10010 => "1HS",
10011 => "2HS",
10012 => "1HB",
10013 => "2HB",
10014 => "1HS",
10015 => "H2H", #EPIC
10016 => "1HP",
10017 => "1HS",
10018 => "1HS",
10019 => "1HS",
10020 => "1HB",
10021 => "1HB",
10022 => "1HS",
10023 => "1HS",
10024 => "1HS",
10025 => "2HS",
10026 => "1HS",
10027 => "1HS",
10028 => "2HP",
10029 => "H2H", #EPIC
10100 => "2HP",
10101 => "2HP",
10103 => "1HP",
10104 => "1HP",
10105 => "1HP",
10106 => "2HP",
10107 => "1HP",
10108 => "2HP",
10109 => "1HP",
10200 => "STAFF",
10201 => "STAFF",
10202 => "STAFF",
10203 => "STAFF",
10300 => "BOW",
10301 => "BARD",
#END Luclin Weapon Models
#BEGIN PoP Weapon Models
#BEGIN PoP Gods Weapons
10400 => "1HB",
10401 => "2HS",
10402 => "2HP",
10403 => "STAFF",
10404 => "1HS",
10405 => "2HS",
10406 => "STAFF",
10407 => "STAFF",
10408 => "2HB",
10409 => "1HB",
10410 => "STAFF",
#END PoP Gods Weapons
10411 => "1HS",
10412 => "BOW",
10413 => "2HS",
10501 => "1HB",
10502 => "CASTER",
10503 => "CASTER",
10504 => "CASTER",
10505 => "STAFF",
10506 => "STAFF",
10507 => "STAFF",
10508 => "2HP",
10509 => "H2H",
10510 => "H2H",
10511 => "H2H",
10512 => "H2H",
10513 => "1HS",
10514 => "1HP",
10515 => "1HS",
10516 => "H2H",
10517 => "1HB",
10518 => "1HB",
10519 => "1HB",
10520 => "STAFF",
10521 => "STAFF",
10522 => "1HB",
10523 => "STAFF",
10524 => "1HB",
10525 => "CASTER",
10526 => "1HP",
10527 => "1HP",
10528 => "1HP",
10545 => "1HS",
10600 => "BARD",
10601 => "BARD",
10602 => "BARD",
10603 => "BARD",
10604 => "1HB",
10605 => "1HB",
10606 => "1HB",
10607 => "1HB",
10608 => "1HB",
10609 => "1HB",
10610 => "1HP",
10611 => "OTHER", #Snowball
10612 => "2HP",
10613 => "2HP",
10614 => "BOW",
10615 => "2HS",
10616 => "1HS",
10617 => "1HS",
10618 => "1HP",
10619 => "1HS",
10620 => "1HS",
10621 => "1HP",
10622 => "2HS",
10623 => "1HS",
10624 => "1HP",
10625 => "2HS",
10626 => "1HS",
10627 => "1HP",
10628 => "2HS",
10629 => "1HS",
10630 => "1HP",
10631 => "2HS",
10632 => "1HS",
10633 => "1HP",
10634 => "2HB",
10635 => "1HB",
10636 => "2HB",
10637 => "1HB",
10638 => "2HB",
10639 => "2HB",
10640 => "2HS",
10641 => "BOW",
10642 => "CASTER",
10643 => "STAFF",
10644 => "2HP",
10645 => "CASTER",
10646 => "CASTER",
10647 => "1HB",
10648 => "1HS",
10649 => "1HS",
10650 => "1HP",
10651 => "2HS",
10652 => "1HS",
10653 => "1HP",
10654 => "2HS",
10655 => "1HS",
10656 => "1HP",
10657 => "2HS",
10658 => "1HS",
10659 => "1HP",
10660 => "2HS",
10661 => "1HS",
10662 => "1HS",
10663 => "CASTER",
#END PoP Weapon Models
#BEGIN LoY Weapon Models
10664 => "SHIELD",
10665 => "SHIELD",
10666 => "SHIELD",
10667 => "SHIELD",
10668 => "SHIELD",
10669 => "SHIELD",
10670 => "SHIELD",
10671 => "SHIELD",
10672 => "1HB",
10673 => "1HS",
10674 => "1HS",
10675 => "2HB",
10676 => "2HS",
10677 => "STAFF",
10678 => "1HS",
10679 => "1HP",
10680 => "1HP",
10681 => "1HB",
10682 => "1HS",
10683 => "STAFF",
10685 => "2HS",
10686 => "1HS",
10687 => "1HP",
10688 => "1HB",
10689 => "1HP",
10690 => "1HP",
10691 => "SHIELD",
10692 => "1HP",
10693 => "1HP",
10694 => "1HS",
10695 => "CASTER",
10696 => "1HS",
10697 => "CASTER",
#END LoY Weapon Models
#BEGIN LDoN Weapon Models
10700 => "1HS",
10701 => "1HP",
10702 => "1HS",
10703 => "1HB",
10704 => "1HS",
10705 => "1HS",
10706 => "1HB",
10707 => "1HB",
10708 => "1HS",
10709 => "1HP",
10710 => "1HS",
10711 => "1HP",
10712 => "1HP",
#END LDoN Weapon Models
#BEGIN GoD Weapon Models
10713 => "1HB",
10714 => "TRADESKILL", #Augment Pool
10715 => "1HS",
10716 => "1HB",
10717 => "BOW",
10718 => "1HB",
10719 => "1HS",
10720 => "2HS",
10722 => "1HP",
10723 => "STAFF",
10724 => "OTHER", #Small Rock
10725 => "OTHER", #Chinese Star
10726 => "1HS",
10727 => "2HS", #Epic 1.5
10728 => "1HS",
10729 => "SHIELD",
10730 => "SHIELD",
10731 => "1HB",
10732 => "1HP",
10733 => "CASTER",
#BEGIN Epic 2.0s
10735 => "1HS",
10736 => "1HB",
10737 => "2HS",
10738 => "SHIELD",
10739 => "STAFF",
10740 => "STAFF",
10741 => "STAFF",
10742 => "H2H",
10743 => "STAFF",
10744 => "2HS",
10745 => "1HS",
10746 => "1HP",
10747 => "2HS",
10748 => "1HB",
10749 => "1HS",
10750 => "STAFF",
#END Epic 2.0s
#BEGIN Epic 1.5s
10751 => "1HS",
10752 => "1HB",
10753 => "2HS",
10754 => "SHIELD",
10755 => "STAFF",
10756 => "STAFF",
10757 => "STAFF",
10758 => "H2H",
10759 => "STAFF",
10760 => "2HS",
10761 => "1HS",
10762 => "1HP",
10763 => "2HS",
10764 => "1HB",
10765 => "1HS",
10766 => "STAFF",
#END Epic 1.5s
#BEGIN OOW+ Weapon Models
10767 => "CASTER",
10768 => "1HB",
10769 => "1HP",
10770 => "1HS",
10771 => "1HS",
10772 => "SHIELD",
10773 => "2HS",
10774 => "STAFF",
10775 => "SHIELD",
10776 => "2HS",
10777 => "1HB",
10778 => "1HS",
10779 => "1HS",
10780 => "1HS",
10781 => "SHIELD",
10782 => "2HP",
10783 => "H2H",
10784 => "1HS",
10785 => "1HS",
10786 => "2HS",
10787 => "1HS",
10788 => "CASTER",
10789 => "BOW",
10790 => "SHIELD",
10791 => "1HS",
10792 => "2HS",
10793 => "1HP",
10794 => "STAFF",
10795 => "1HB",
10796 => "2HB",
10797 => "2HS",
10798 => "1HP",
10799 => "1HP",
10806 => "CASTER",
10807 => "CASTER",
10808 => "CASTER",
10810 => "2HS",
10811 => "1HS",
10812 => "2HS",
10813 => "1HP",
10814 => "1HP",
10815 => "1HP",
10816 => "1HP",
10817 => "1HB",
10818 => "2HB",
10819 => "CASTER",
10820 => "STAFF",
10821 => "1HS",
10822 => "CASTER",
10823 => "STAFF",
10824 => "1HP",
10825 => "1HS",
10826 => "SHIELD",
10827 => "SHIELD",
10828 => "STAFF",
10829 => "1HB",
10830 => "2HB",
10831 => "1HP",
10832 => "SHIELD",
10833 => "SHIELD",
10834 => "1HS",
10835 => "2HS",
10836 => "CASTER",
10837 => "CASTER",
10838 => "1HB",
10839 => "2HB",
10840 => "1HS",
10841 => "2HS",
10842 => "H2H",
#END TITANIUM Weapon Models
#BEGIN SoF Weapon Models
10843 => "OTHER", #Broom
10844 => "1HP",
10845 => "2HB",
10846 => "1HB",
10847 => "2HB",
10848 => "1HS",
10849 => "SHIELD",
10850 => "SHIELD",
10851 => "OTHER", #Shovel
10852 => "STAFF",
10853 => "STAFF",
10854 => "CASTER",
10855 => "1HS",
10856 => "2HS",
10857 => "SHIELD",
10858 => "SHIELD",
10859 => "1HB",
10860 => "1HS",
10861 => "OTHER", #Beer Mug
10862 => "STAFF",
10866 => "1HP",
10867 => "1HS",
10868 => "1HP",
10869 => "2HS",
10870 => "1HP",
10871 => "2HS",
10872 => "1HS",
10873 => "2HS",
10874 => "1HS",
10875 => "2HS",
10876 => "1HS",
10877 => "2HS",
10878 => "1HS",
10879 => "2HS",
10880 => "1HS",
10881 => "2HS",
10882 => "1HP",
10883 => "1HS",
10884 => "2HS",
10885 => "1HS",
10886 => "2HS",
10887 => "1HS",
10888 => "2HS",
10889 => "1HS",
10890 => "2HS",
10891 => "1HS",
10892 => "2HS",
10893 => "1HS",
10894 => "2HS",
10895 => "1HS",
10896 => "2HS",
10897 => "1HS",
10898 => "2HS",
10899 => "1HS",
10900 => "2HS",
10901 => "1HS",
10902 => "2HS",
10903 => "1HP",
10904 => "1HS",
10905 => "2HS",
10906 => "1HS",
10907 => "2HS",
10908 => "1HS",
10909 => "2HS",
10910 => "1HP",
10911 => "1HP",
10912 => "1HP",
10913 => "1HP",
10914 => "1HP",
10915 => "1HP",
10916 => "1HP",
10917 => "1HP",
10918 => "1HP",
10919 => "1HP",
10920 => "1HS",
10921 => "2HS",
10922 => "1HS",
10923 => "2HS",
10924 => "1HB",
10925 => "2HB",
10926 => "1HB",
10927 => "2HB",
10928 => "1HB",
10929 => "2HB",
10930 => "1HB",
10931 => "2HB",
10932 => "1HB",
10933 => "2HB",
10934 => "1HB",
10935 => "2HB",
10936 => "1HB",
10937 => "2HB",
10938 => "STAFF",
10939 => "CASTER",
10940 => "STAFF",
10941 => "STAFF",
10942 => "STAFF",
10943 => "1HB",
10944 => "STAFF",
10945 => "1HB",
10946 => "1HB",
10947 => "2HB",
10948 => "1HB",
10949 => "2HB",
10950 => "2HP",
10951 => "2HP",
10952 => "2HP",
10953 => "2HP",
10954 => "2HP",
10955 => "2HP",
10956 => "2HP",
10957 => "2HP",
10958 => "1HP",
10959 => "STAFF",
10960 => "SHIELD",
10961 => "SHIELD",
10962 => "SHIELD",
10963 => "SHIELD",
10964 => "SHIELD",
10965 => "SHIELD",
10966 => "SHIELD",
10967 => "SHIELD",
10968 => "SHIELD",
10969 => "SHIELD",
10970 => "SHIELD",
10971 => "SHIELD",
10972 => "SHIELD",
10973 => "SHIELD",
10974 => "SHIELD",
10975 => "SHIELD",
10976 => "SHIELD",
10977 => "SHIELD",
10978 => "SHIELD",
10979 => "SHIELD",
10980 => "SHIELD",
10981 => "SHIELD",
10982 => "SHIELD",
10983 => "SHIELD",
10984 => "SHIELD",
10985 => "SHIELD",
10986 => "SHIELD",
10987 => "SHIELD",
10988 => "SHIELD",
10989 => "SHIELD",
10990 => "SHIELD",
10991 => "SHIELD",
10992 => "SHIELD",
10993 => "SHIELD",
10994 => "SHIELD",
10995 => "SHIELD",
10996 => "SHIELD",
10997 => "BOW",
10998 => "BOW",
10999 => "1HB",
11001 => "SHIELD",
11002 => "SHIELD",
11003 => "SHIELD",
11013 => "SHIELD",
11017 => "SHIELD",
11018 => "SHIELD",
11019 => "SHIELD",
11020 => "SHIELD",
11031 => "OTHER", #Torch
11032 => "STAFF",
11033 => "OTHER", #Hoe
11034 => "OTHER", #Rake
11035 => "OTHER", #Pitch Fork
11036 => "OTHER", #Bucket full of Dirt
11037 => "OTHER", #Bucket full of Apples
11038 => "OTHER", #Bucket full of Rocks
11039 => "OTHER", #Bucket full of Gems
11040 => "OTHER", #Bucket full of Ash?
11041 => "1HP",
11042 => "1HS",
11043 => "2HS",
11044 => "1HB",
11045 => "2HB",
11046 => "1HS",
11047 => "2HS",
11048 => "SHIELD",
11049 => "SHIELD",
11050 => "H2H",
11051 => "H2H",
11052 => "1HB",
11053 => "1HS",
11054 => "OTHER", #Box
11055 => "OTHER", #Rock
11056 => "OTHER", #Bush
11057 => "OTHER", #Rock
11058 => "OTHER", #3 Bones
11059 => "OTHER", #3 Large Books
11060 => "OTHER", #Green Leaf
11061 => "OTHER", #Mushroom
11062 => "OTHER", #Box
11063 => "OTHER", #Box
11064 => "OTHER", #Rock
11065 => "OTHER", #Rock
11066 => "OTHER", #Bush
11067 => "OTHER", #Bush
11068 => "OTHER", #Rock
11069 => "OTHER", #Red Apple
11070 => "OTHER", #Green Apple
11071 => "OTHER", #Pumpkin
11072 => "OTHER", #3 Bones
11073 => "OTHER", #3 Large Books
11074 => "OTHER", #White Branch
11075 => "OTHER", #Palm Tree Leaf
11076 => "OTHER", #Bamboo
11077 => "OTHER", #Brown Branch
11078 => "OTHER", #Dead Branch
11079 => "OTHER", #Brown Leaf
11080 => "OTHER", #Red Maple Leaf
11081 => "OTHER", #Yellow Mushroom
11082 => "OTHER", #Green Mushroom
11083 => "OTHER", #Brown Mushroom
11084 => "OTHER", #Green Branch
11085 => "SHIELD",
11086 => "SHIELD",
11087 => "CASTER",
11088 => "1HS",
11089 => "1HS",
11090 => "1HS",
11091 => "1HP",
11092 => "2HP",
11093 => "1HP",
11094 => "1HS",
11095 => "1HP",
11096 => "OTHER", #Rolling Pin
11097 => "STAFF",
11098 => "CASTER",
11099 => "H2H",
11100 => "2HS",
11101 => "1HP",
11102 => "SHIELD",
11103 => "SHIELD",
11104 => "STAFF",
11105 => "1HS",
11106 => "1HB",
11107 => "2HB",
11108 => "1HS",
11109 => "2HS",
11110 => "SHIELD",
11111 => "SHIELD",
11112 => "1HP",
11113 => "1HS",
11114 => "1HP",
11115 => "1HS",
11116 => "1HS",
11117 => "STAFF",
11118 => "OTHER", #Fish
11119 => "2HP",
11120 => "H2H",
11121 => "OTHER", #Gold Coin
11122 => "OTHER", #Silver Coin
11123 => "OTHER", #Crystal
11124 => "OTHER", #Crystal
11129 => "1HS",
11130 => "2HB",
11131 => "1HP",
11132 => "2HS",
11133 => "2HB",
11139 => "H2H",
11140 => "SHIELD",
11144 => "SHIELD",
11154 => "OTHER", #Large Crystal
11155 => "OTHER", #Large Crystal
11156 => "OTHER", #Large Crystal
11157 => "OTHER", #Large Crystal
11158 => "OTHER", #Large Crystal
11159 => "OTHER", #Large Crystal
11160 => "OTHER", #Large Crystal
11161 => "OTHER", #Large Crystal
11162 => "OTHER", #Small Crystal
11163 => "OTHER", #Small Crystal
11164 => "OTHER", #Small Crystal
11165 => "OTHER", #Small Crystal
11166 => "OTHER", #Small Crystal
11167 => "OTHER", #Small Crystal
11168 => "OTHER", #Small Crystal
11169 => "OTHER" #Small Crystal
#END SoF Weapon Models
);
%ClassPrimaryTypes = (
1 => [ "1HS", "2HS", "1HB", "2HB", "1HP", "2HP" ], #Warrior
2 => [ "1HB", "2HB", "STAFF", "CASTER" ], #Cleric
3 => [ "1HS", "2HS", "1HB", "2HB", "1HP", "2HP" ], #Paladin
4 => [ "1HS", "2HS", "1HB", "2HB", "1HP", "2HP" ], #Ranger
5 => [ "1HS", "2HS", "1HB", "2HB", "1HP", "2HP" ], #Shadow Knight
6 => [ "1HS", "1HB", "2HB", "STAFF", "CASTER" ], #Druid
7 => [ "1HB", "2HB", "H2H", "STAFF" ], #Monk
8 => [ "1HS", "1HB", "1HP", "BARD" ], #Bard
9 => [ "1HS", "1HB", "1HP" ], #Rogue
10 => [ "1HB", "2HB", "1HP", "STAFF", "CASTER" ], #Shaman
11 => [ "1HB", "2HB", "1HP", "STAFF", "CASTER" ], #Necromancer
12 => [ "1HB", "2HB", "1HP", "STAFF", "CASTER" ], #Wizard
13 => [ "1HB", "2HB", "1HP", "STAFF", "CASTER" ], #Mage
14 => [ "1HB", "2HB", "1HP", "STAFF", "CASTER" ], #Enchanter
15 => [ "1HB", "2HB", "1HP", "H2H", "STAFF" ], #Beastlord
16 => [ "2HS", "2HB", "2HP" ] #Berserker
);
%ClassSecondaryTypes = (
1 => [ "1HS", "1HB", "1HP", "SHIELD" ], #Warrior
2 => [ "CASTER", "SHIELD" ], #Cleric
3 => [ "SHIELD" ], #Paladin
4 => [ "1HS", "1HB", "1HP" ], #Ranger
5 => [ "SHIELD" ], #Shadow Knight
6 => [ "CASTER", "SHIELD" ], #Druid
7 => [ "1HB", "2HB", "H2H", "STAFF" ], #Monk
8 => [ "1HS", "1HB", "1HP" ], #Bard
9 => [ "1HS", "1HB", "1HP" ], #Rogue
10 => [ "CASTER", "SHIELD" ], #Shaman
11 => [ "CASTER", "SHIELD" ], #Necromancer
12 => [ "CASTER", "SHIELD" ], #Wizard
13 => [ "CASTER", "SHIELD" ], #Mage
14 => [ "CASTER", "SHIELD" ], #Enchanter
15 => [ "1HB", "1HP", "H2H" ], #Beastlord
16 => [ "NONE" ] #Berserker
);
%AttackTypes = (
"1HS" => 1,
"2HS" => 3,
"1HB" => 0,
"2HB" => 2,
"1HP" => 36,
"2HP" => 36,
"ARCHERY" => 7,
"THROWING" => 51,
"H2H" => 28,
"CASTER" => 28,
"SHIELD" => 28,
"BARD" => 28
);
my $RandChance = plugin::RandomRange(1, 100);
if($RandChance <= $MyChance || $MyChance == 0) {
if(!$IgnoreClass) {
my $NPCClass = $npc->GetClass();
my $PrimMax = $#{$ClassPrimaryTypes{$NPCClass}};
my $PrimTypeNum = plugin::RandomRange(0, $PrimMax + 1);
my $PrimType = $ClassPrimaryTypes{$NPCClass}[$PrimTypeNum];
my $SecMax = $#{$ClassSecondaryTypes{$NPCClass}};
my $SecTypeNum = plugin::RandomRange(0, $SecMax + 1);
my $SecType = $ClassSecondaryTypes{$NPCClass}[$SecTypeNum];
my @AvailPrims = (); #clear out the array of Available Primary Weapon Models
my @AvailSecs = (); #clear out the array of Available Secondary Weapon Models
foreach $k (keys (%WeaponModels)) {
if($k >= $MinModelNum && $k <= $MaxModelNum) {
if($WeaponModels{$k} eq $PrimType){
push(@AvailPrims, $k);
}
}
if($ClassSecondaryTypes{$NPCClass}[$SecType] eq "SHIELD" && $MinShieldNum && $MaxShieldNum) {
if($k >= $MinShieldNum && $k <= $MaxShieldNum) {
if($WeaponModels{$k} eq $SecType){
push(@AvailSecs, $k);
}
}
}
else {
if($k >= $MinModelNum && $k <= $MaxModelNum) {
if($WeaponModels{$k} eq $SecType){
push(@AvailSecs, $k);
}
}
}
}
my $TotalAvailPrims = @AvailPrims;
my $TotalAvailSecs = @AvailSecs;
if($TotalAvailPrims) {
my $PrimSelect = plugin::RandomRange(0, $TotalAvailPrims);
quest::wearchange(7, $AvailPrims[$PrimSelect]);
my $PrimSkill = $AttackTypes{$PrimType};
$npc->SetPrimSkill($PrimSkill);
my $chance = quest::ChooseRandom(1,2);
if(!$NoDualWield == 1 && $chance == 2 && $PrimType ne "2HS" && $PrimType ne "2HB" && $PrimType ne "2HP" && $PrimType ne "STAFF" && $PrimType ne "BARD" && $NPCClass != 16) {
my $SecSelect = plugin::RandomRange(0, $TotalAvailSecs);
quest::wearchange(8, $AvailSecs[$SecSelect]);
my $SecSkill = $AttackTypes{$SecType};
$npc->SetSecSkill($SecSkill);
}
}
}
else {
if ($MinModelNum && $MaxModelNum) {
my $PrimSelect = plugin::RandomRange($MinModelNum, $MaxModelNum);
quest::wearchange(7, $PrimSelect);
if(!$NoDualWield) {
my $chance2 = quest::ChooseRandom(1,2,3);
if ($chance2 == 1) { # if True, then choose a secondary weapon to use
my $SecSelect = plugin::RandomRange($MinModelNum, $MaxModelNum);
quest::wearchange(8, $SecSelect);
}
elsif ($chance2 == 2 && $MinShieldNum && $MaxShieldNum) { # if True, then choose a shield to use
my $SecSelect = plugin::RandomRange($MinShieldNum, $MaxShieldNum);
quest::wearchange(8, $SecSelect);
}
}
}
}
}
}
#Usage: plugin::SetWeapons(PrimaryModel, SecondaryModel, EnableRemoving? );
#Example: plugin::SetWeapons(11, 200);
sub SetWeapons {
my $npc = plugin::val('$npc');
my $PrimaryModel = $_[0];
my $SecondaryModel = $_[1];
my $EnableRemoving = $_[2];
%WeaponModels = (
#BEGIN Classic Weapon Models
1 => "1HS",
2 => "2HS",
3 => "1HS",
4 => "BOW",
5 => "1HP",
6 => "CASTER",
7 => "1HB",
8 => "2HB",
9 => "1HS",
10 => "OTHER", #Arrow
11 => "1HS", #SOE Fanfair Reward
12 => "STAFF", #SOE Fanfair Reward
13 => "STAFF", #SOE Fanfair Reward
14 => "1HB",
15 => "BARD",
16 => "1HP",
17 => "1HP",
18 => "1HB",
19 => "1HB",
20 => "1HP",
21 => "BARD",
22 => "1HS",
23 => "2HS",
24 => "2HB",
25 => "2HS",
26 => "1HS",
27 => "CASTER",
28 => "CASTER",
29 => "STAFF",
30 => "2HP",
31 => "1HB",
32 => "OTHER", #Broom
33 => "1HB",
34 => "1HS",
35 => "1HB",
36 => "OTHER", #Torch
37 => "1HB",
38 => "OTHER", #Fishing Pole
39 => "2HS",
40 => "1HS",
41 => "1HS",
42 => "1HS",
43 => "1HB",
44 => "1HS",
45 => "STAFF",
46 => "CASTER",
47 => "CASTER",
48 => "OTHER", #Lantern
49 => "1HB",
50 => "1HP",
51 => "1HB",
52 => "OTHER", #Shovel
53 => "2HS",
54 => "OTHER", #Cigar
55 => "OTHER", #Pipe
56 => "OTHER", #Mug
57 => "1HS",
58 => "1HS",
59 => "1HB",
60 => "1HS",
61 => "1HS",
62 => "1HS", #SoulFire
63 => "OTHER", #Small Bag
64 => "OTHER", #Large Bag
65 => "OTHER", #Scroll
66 => "TRADESKILL", #Forge
67 => "CASTER", #Voodoo Doll
68 => "H2H",
69 => "TRADESKILL", #Oven
70 => "TRADESKILL", #Brew Barrel
71 => "H2H",
72 => "CASTER",
73 => "TRADESKILL", #Kiln
74 => "TRADESKILL", #Pottery Wheel
75 => "STAFF",
76 => "2HS", #Luclin Weapn Model
78 => "OTHER", #Fire
79 => "2HP",
80 => "2HS",
81 => "1HS",
82 => "1HS",
83 => "2HS",
84 => "2HS",
85 => "1HS",
86 => "2HS",
87 => "1HS",
#END Classic Weapon Models
#BEGIN Kunark Weapon Models
88 => "2HS",
89 => "1HS",
90 => "1HS",
91 => "H2H",
92 => "2HP",
93 => "2HS",
94 => "H2H",
95 => "2HS",
96 => "CASTER", #Added for special quest later
97 => "1HS", #GM Sword
98 => "H2H",
99 => "1HS",
100 => "1HS",
101 => "2HB",
102 => "1HB",
103 => "2HP",
104 => "1HS",
105 => "1HS",
106 => "2HS",
107 => "1HS",
108 => "1HS",
109 => "1HS",
110 => "2HS",
111 => "2HB",
112 => "1HB",
113 => "1HS",
115 => "1HB",
117 => "2HB",
118 => "1HP",
119 => "1HP",
120 => "1HS",
121 => "1HS",
122 => "STAFF",
123 => "STAFF",
124 => "2HB",
125 => "STAFF",
126 => "STAFF",
127 => "STAFF",
128 => "TRADESKILL", #Loom
129 => "STAFF",
130 => "1HB",
131 => "1HS",
132 => "2HP",
133 => "CASTER",
134 => "CASTER",
135 => "H2H",
136 => "H2H",
137 => "BARD",
138 => "BARD",
139 => "1HP",
#BEGIN Epic 1.0s
140 => "1HP",
141 => "1HS",
142 => "1HS",
145 => "2HS",
146 => "2HS",
148 => "1HS",
149 => "1HS",
150 => "1HS",
151 => "CASTER",
153 => "STAFF",
154 => "2HP",
155 => "CASTER",
156 => "1HB",
157 => "CASTER",
160 => "2HS",
#END Epic 1.0s
#END Kunark Weapon Models
#BEGIN Velious Weapon Models
161 => "1HS",
162 => "1HS",
163 => "1HS",
164 => "1HS",
165 => "1HS",
166 => "2HS",
167 => "1HP",
168 => "1HS",
169 => "2HB",
170 => "1HS",
171 => "1HS",
172 => "2HP",
173 => "2HS",
174 => "1HS",
175 => "1HS",
176 => "2HS",
177 => "1HB",
178 => "2HB",
179 => "1HB",
180 => "1HB",
181 => "1HS",
182 => "1HS",
183 => "1HS",
184 => "1HS",
185 => "1HB",
186 => "STAFF",
187 => "2HP",
188 => "1HS",
189 => "1HB",
190 => "2HS",
191 => "1HS",
192 => "1HS",
193 => "1HB",
194 => "1HP",
195 => "1HP",
196 => "1HS",
197 => "2HP",
198 => "BOW",
199 => "BOW",
200 => "SHIELD",
201 => "SHIELD",
202 => "SHIELD",
203 => "SHIELD",
204 => "SHIELD",
205 => "SHIELD",
206 => "SHIELD",
207 => "SHIELD",
208 => "SHIELD",
209 => "SHIELD",
210 => "SHIELD",
211 => "SHIELD",
212 => "SHIELD",
213 => "SHIELD",
214 => "SHIELD",
215 => "SHIELD",
216 => "SHIELD",
217 => "SHIELD",
218 => "SHIELD",
219 => "SHIELD",
220 => "SHIELD",
221 => "SHIELD",
222 => "SHIELD",
223 => "SHIELD",
224 => "SHIELD",
225 => "SHIELD",
226 => "SHIELD",
227 => "SHIELD",
228 => "SHIELD",
250 => "OTHER", #Lollipop
300 => "2HS",
301 => "1HS",
308 => "STAFF",
#END Velious Weapon Models
#BEGIN Luclin Weapon Models
10000 => "1HS",
10001 => "2HB",
10002 => "1HS",
10003 => "1HB",
10004 => "2HS",
10005 => "1HS",
10006 => "1HP",
10007 => "1HB",
10008 => "1HB",
10009 => "1HP",
10010 => "1HS",
10011 => "2HS",
10012 => "1HB",
10013 => "2HB",
10014 => "1HS",
10015 => "H2H", #EPIC
10016 => "1HP",
10017 => "1HS",
10018 => "1HS",
10019 => "1HS",
10020 => "1HB",
10021 => "1HB",
10022 => "1HS",
10023 => "1HS",
10024 => "1HS",
10025 => "2HS",
10026 => "1HS",
10027 => "1HS",
10028 => "2HP",
10029 => "H2H", #EPIC
10100 => "2HP",
10101 => "2HP",
10103 => "1HP",
10104 => "1HP",
10105 => "1HP",
10106 => "2HP",
10107 => "1HP",
10108 => "2HP",
10109 => "1HP",
10200 => "STAFF",
10201 => "STAFF",
10202 => "STAFF",
10203 => "STAFF",
10300 => "BOW",
10301 => "BARD",
#END Luclin Weapon Models
#BEGIN PoP Weapon Models
#BEGIN PoP Gods Weapons
10400 => "1HB",
10401 => "2HS",
10402 => "2HP",
10403 => "STAFF",
10404 => "1HS",
10405 => "2HS",
10406 => "STAFF",
10407 => "STAFF",
10408 => "2HB",
10409 => "1HB",
10410 => "STAFF",
#END PoP Gods Weapons
10411 => "1HS",
10412 => "BOW",
10413 => "2HS",
10501 => "1HB",
10502 => "CASTER",
10503 => "CASTER",
10504 => "CASTER",
10505 => "STAFF",
10506 => "STAFF",
10507 => "STAFF",
10508 => "2HP",
10509 => "H2H",
10510 => "H2H",
10511 => "H2H",
10512 => "H2H",
10513 => "1HS",
10514 => "1HP",
10515 => "1HS",
10516 => "H2H",
10517 => "1HB",
10518 => "1HB",
10519 => "1HB",
10520 => "STAFF",
10521 => "STAFF",
10522 => "1HB",
10523 => "STAFF",
10524 => "1HB",
10525 => "CASTER",
10526 => "1HP",
10527 => "1HP",
10528 => "1HP",
10545 => "1HS",
10600 => "BARD",
10601 => "BARD",
10602 => "BARD",
10603 => "BARD",
10604 => "1HB",
10605 => "1HB",
10606 => "1HB",
10607 => "1HB",
10608 => "1HB",
10609 => "1HB",
10610 => "1HP",
10611 => "OTHER", #Snowball
10612 => "2HP",
10613 => "2HP",
10614 => "BOW",
10615 => "2HS",
10616 => "1HS",
10617 => "1HS",
10618 => "1HP",
10619 => "1HS",
10620 => "1HS",
10621 => "1HP",
10622 => "2HS",
10623 => "1HS",
10624 => "1HP",
10625 => "2HS",
10626 => "1HS",
10627 => "1HP",
10628 => "2HS",
10629 => "1HS",
10630 => "1HP",
10631 => "2HS",
10632 => "1HS",
10633 => "1HP",
10634 => "2HB",
10635 => "1HB",
10636 => "2HB",
10637 => "1HB",
10638 => "2HB",
10639 => "2HB",
10640 => "2HS",
10641 => "BOW",
10642 => "CASTER",
10643 => "STAFF",
10644 => "2HP",
10645 => "CASTER",
10646 => "CASTER",
10647 => "1HB",
10648 => "1HS",
10649 => "1HS",
10650 => "1HP",
10651 => "2HS",
10652 => "1HS",
10653 => "1HP",
10654 => "2HS",
10655 => "1HS",
10656 => "1HP",
10657 => "2HS",
10658 => "1HS",
10659 => "1HP",
10660 => "2HS",
10661 => "1HS",
10662 => "1HS",
10663 => "CASTER",
#END PoP Weapon Models
#BEGIN LoY Weapon Models
10664 => "SHIELD",
10665 => "SHIELD",
10666 => "SHIELD",
10667 => "SHIELD",
10668 => "SHIELD",
10669 => "SHIELD",
10670 => "SHIELD",
10671 => "SHIELD",
10672 => "1HB",
10673 => "1HS",
10674 => "1HS",
10675 => "2HB",
10676 => "2HS",
10677 => "STAFF",
10678 => "1HS",
10679 => "1HP",
10680 => "1HP",
10681 => "1HB",
10682 => "1HS",
10683 => "STAFF",
10685 => "2HS",
10686 => "1HS",
10687 => "1HP",
10688 => "1HB",
10689 => "1HP",
10690 => "1HP",
10691 => "SHIELD",
10692 => "1HP",
10693 => "1HP",
10694 => "1HS",
10695 => "CASTER",
10696 => "1HS",
10697 => "CASTER",
#END LoY Weapon Models
#BEGIN LDoN Weapon Models
10700 => "1HS",
10701 => "1HP",
10702 => "1HS",
10703 => "1HB",
10704 => "1HS",
10705 => "1HS",
10706 => "1HB",
10707 => "1HB",
10708 => "1HS",
10709 => "1HP",
10710 => "1HS",
10711 => "1HP",
10712 => "1HP",
#END LDoN Weapon Models
#BEGIN GoD Weapon Models
10713 => "1HB",
10714 => "TRADESKILL", #Augment Pool
10715 => "1HS",
10716 => "1HB",
10717 => "BOW",
10718 => "1HB",
10719 => "1HS",
10720 => "2HS",
10722 => "1HP",
10723 => "STAFF",
10724 => "OTHER", #Small Rock
10725 => "OTHER", #Chinese Star
10726 => "1HS",
10727 => "2HS", #Epic 1.5
10728 => "1HS",
10729 => "SHIELD",
10730 => "SHIELD",
10731 => "1HB",
10732 => "1HP",
10733 => "CASTER",
#BEGIN Epic 2.0s
10735 => "1HS",
10736 => "1HB",
10737 => "2HS",
10738 => "SHIELD",
10739 => "STAFF",
10740 => "STAFF",
10741 => "STAFF",
10742 => "H2H",
10743 => "STAFF",
10744 => "2HS",
10745 => "1HS",
10746 => "1HP",
10747 => "2HS",
10748 => "1HB",
10749 => "1HS",
10750 => "STAFF",
#END Epic 2.0s
#BEGIN Epic 1.5s
10751 => "1HS",
10752 => "1HB",
10753 => "2HS",
10754 => "SHIELD",
10755 => "STAFF",
10756 => "STAFF",
10757 => "STAFF",
10758 => "H2H",
10759 => "STAFF",
10760 => "2HS",
10761 => "1HS",
10762 => "1HP",
10763 => "2HS",
10764 => "1HB",
10765 => "1HS",
10766 => "STAFF",
#END Epic 1.5s
#BEGIN OOW+ Weapon Models
10767 => "CASTER",
10768 => "1HB",
10769 => "1HP",
10770 => "1HS",
10771 => "1HS",
10772 => "SHIELD",
10773 => "2HS",
10774 => "STAFF",
10775 => "SHIELD",
10776 => "2HS",
10777 => "1HB",
10778 => "1HS",
10779 => "1HS",
10780 => "1HS",
10781 => "SHIELD",
10782 => "2HP",
10783 => "H2H",
10784 => "1HS",
10785 => "1HS",
10786 => "2HS",
10787 => "1HS",
10788 => "CASTER",
10789 => "BOW",
10790 => "SHIELD",
10791 => "1HS",
10792 => "2HS",
10793 => "1HP",
10794 => "STAFF",
10795 => "1HB",
10796 => "2HB",
10797 => "2HS",
10798 => "1HP",
10799 => "1HP",
10806 => "CASTER",
10807 => "CASTER",
10808 => "CASTER",
10810 => "2HS",
10811 => "1HS",
10812 => "2HS",
10813 => "1HP",
10814 => "1HP",
10815 => "1HP",
10816 => "1HP",
10817 => "1HB",
10818 => "2HB",
10819 => "CASTER",
10820 => "STAFF",
10821 => "1HS",
10822 => "CASTER",
10823 => "STAFF",
10824 => "1HP",
10825 => "1HS",
10826 => "SHIELD",
10827 => "SHIELD",
10828 => "STAFF",
10829 => "1HB",
10830 => "2HB",
10831 => "1HP",
10832 => "SHIELD",
10833 => "SHIELD",
10834 => "1HS",
10835 => "2HS",
10836 => "CASTER",
10837 => "CASTER",
10838 => "1HB",
10839 => "2HB",
10840 => "1HS",
10841 => "2HS",
10842 => "H2H",
#END TITANIUM Weapon Models
#BEGIN SoF Weapon Models
10843 => "OTHER", #Broom
10844 => "1HP",
10845 => "2HB",
10846 => "1HB",
10847 => "2HB",
10848 => "1HS",
10849 => "SHIELD",
10850 => "SHIELD",
10851 => "OTHER", #Shovel
10852 => "STAFF",
10853 => "STAFF",
10854 => "CASTER",
10855 => "1HS",
10856 => "2HS",
10857 => "SHIELD",
10858 => "SHIELD",
10859 => "1HB",
10860 => "1HS",
10861 => "OTHER", #Beer Mug
10862 => "STAFF",
10866 => "1HP",
10867 => "1HS",
10868 => "1HP",
10869 => "2HS",
10870 => "1HP",
10871 => "2HS",
10872 => "1HS",
10873 => "2HS",
10874 => "1HS",
10875 => "2HS",
10876 => "1HS",
10877 => "2HS",
10878 => "1HS",
10879 => "2HS",
10880 => "1HS",
10881 => "2HS",
10882 => "1HP",
10883 => "1HS",
10884 => "2HS",
10885 => "1HS",
10886 => "2HS",
10887 => "1HS",
10888 => "2HS",
10889 => "1HS",
10890 => "2HS",
10891 => "1HS",
10892 => "2HS",
10893 => "1HS",
10894 => "2HS",
10895 => "1HS",
10896 => "2HS",
10897 => "1HS",
10898 => "2HS",
10899 => "1HS",
10900 => "2HS",
10901 => "1HS",
10902 => "2HS",
10903 => "1HP",
10904 => "1HS",
10905 => "2HS",
10906 => "1HS",
10907 => "2HS",
10908 => "1HS",
10909 => "2HS",
10910 => "1HP",
10911 => "1HP",
10912 => "1HP",
10913 => "1HP",
10914 => "1HP",
10915 => "1HP",
10916 => "1HP",
10917 => "1HP",
10918 => "1HP",
10919 => "1HP",
10920 => "1HS",
10921 => "2HS",
10922 => "1HS",
10923 => "2HS",
10924 => "1HB",
10925 => "2HB",
10926 => "1HB",
10927 => "2HB",
10928 => "1HB",
10929 => "2HB",
10930 => "1HB",
10931 => "2HB",
10932 => "1HB",
10933 => "2HB",
10934 => "1HB",
10935 => "2HB",
10936 => "1HB",
10937 => "2HB",
10938 => "STAFF",
10939 => "CASTER",
10940 => "STAFF",
10941 => "STAFF",
10942 => "STAFF",
10943 => "1HB",
10944 => "STAFF",
10945 => "1HB",
10946 => "1HB",
10947 => "2HB",
10948 => "1HB",
10949 => "2HB",
10950 => "2HP",
10951 => "2HP",
10952 => "2HP",
10953 => "2HP",
10954 => "2HP",
10955 => "2HP",
10956 => "2HP",
10957 => "2HP",
10958 => "1HP",
10959 => "STAFF",
10960 => "SHIELD",
10961 => "SHIELD",
10962 => "SHIELD",
10963 => "SHIELD",
10964 => "SHIELD",
10965 => "SHIELD",
10966 => "SHIELD",
10967 => "SHIELD",
10968 => "SHIELD",
10969 => "SHIELD",
10970 => "SHIELD",
10971 => "SHIELD",
10972 => "SHIELD",
10973 => "SHIELD",
10974 => "SHIELD",
10975 => "SHIELD",
10976 => "SHIELD",
10977 => "SHIELD",
10978 => "SHIELD",
10979 => "SHIELD",
10980 => "SHIELD",
10981 => "SHIELD",
10982 => "SHIELD",
10983 => "SHIELD",
10984 => "SHIELD",
10985 => "SHIELD",
10986 => "SHIELD",
10987 => "SHIELD",
10988 => "SHIELD",
10989 => "SHIELD",
10990 => "SHIELD",
10991 => "SHIELD",
10992 => "SHIELD",
10993 => "SHIELD",
10994 => "SHIELD",
10995 => "SHIELD",
10996 => "SHIELD",
10997 => "BOW",
10998 => "BOW",
10999 => "1HB",
11001 => "SHIELD",
11002 => "SHIELD",
11003 => "SHIELD",
11013 => "SHIELD",
11017 => "SHIELD",
11018 => "SHIELD",
11019 => "SHIELD",
11020 => "SHIELD",
11031 => "OTHER", #Torch
11032 => "STAFF",
11033 => "OTHER", #Hoe
11034 => "OTHER", #Rake
11035 => "OTHER", #Pitch Fork
11036 => "OTHER", #Bucket full of Dirt
11037 => "OTHER", #Bucket full of Apples
11038 => "OTHER", #Bucket full of Rocks
11039 => "OTHER", #Bucket full of Gems
11040 => "OTHER", #Bucket full of Ash?
11041 => "1HP",
11042 => "1HS",
11043 => "2HS",
11044 => "1HB",
11045 => "2HB",
11046 => "1HS",
11047 => "2HS",
11048 => "SHIELD",
11049 => "SHIELD",
11050 => "H2H",
11051 => "H2H",
11052 => "1HB",
11053 => "1HS",
11054 => "OTHER", #Box
11055 => "OTHER", #Rock
11056 => "OTHER", #Bush
11057 => "OTHER", #Rock
11058 => "OTHER", #3 Bones
11059 => "OTHER", #3 Large Books
11060 => "OTHER", #Green Leaf
11061 => "OTHER", #Mushroom
11062 => "OTHER", #Box
11063 => "OTHER", #Box
11064 => "OTHER", #Rock
11065 => "OTHER", #Rock
11066 => "OTHER", #Bush
11067 => "OTHER", #Bush
11068 => "OTHER", #Rock
11069 => "OTHER", #Red Apple
11070 => "OTHER", #Green Apple
11071 => "OTHER", #Pumpkin
11072 => "OTHER", #3 Bones
11073 => "OTHER", #3 Large Books
11074 => "OTHER", #White Branch
11075 => "OTHER", #Palm Tree Leaf
11076 => "OTHER", #Bamboo
11077 => "OTHER", #Brown Branch
11078 => "OTHER", #Dead Branch
11079 => "OTHER", #Brown Leaf
11080 => "OTHER", #Red Maple Leaf
11081 => "OTHER", #Yellow Mushroom
11082 => "OTHER", #Green Mushroom
11083 => "OTHER", #Brown Mushroom
11084 => "OTHER", #Green Branch
11085 => "SHIELD",
11086 => "SHIELD",
11087 => "CASTER",
11088 => "1HS",
11089 => "1HS",
11090 => "1HS",
11091 => "1HP",
11092 => "2HP",
11093 => "1HP",
11094 => "1HS",
11095 => "1HP",
11096 => "OTHER", #Rolling Pin
11097 => "STAFF",
11098 => "CASTER",
11099 => "H2H",
11100 => "2HS",
11101 => "1HP",
11102 => "SHIELD",
11103 => "SHIELD",
11104 => "STAFF",
11105 => "1HS",
11106 => "1HB",
11107 => "2HB",
11108 => "1HS",
11109 => "2HS",
11110 => "SHIELD",
11111 => "SHIELD",
11112 => "1HP",
11113 => "1HS",
11114 => "1HP",
11115 => "1HS",
11116 => "1HS",
11117 => "STAFF",
11118 => "OTHER", #Fish
11119 => "2HP",
11120 => "H2H",
11121 => "OTHER", #Gold Coin
11122 => "OTHER", #Silver Coin
11123 => "OTHER", #Crystal
11124 => "OTHER", #Crystal
11129 => "1HS",
11130 => "2HB",
11131 => "1HP",
11132 => "2HS",
11133 => "2HB",
11139 => "H2H",
11140 => "SHIELD",
11144 => "SHIELD",
11154 => "OTHER", #Large Crystal
11155 => "OTHER", #Large Crystal
11156 => "OTHER", #Large Crystal
11157 => "OTHER", #Large Crystal
11158 => "OTHER", #Large Crystal
11159 => "OTHER", #Large Crystal
11160 => "OTHER", #Large Crystal
11161 => "OTHER", #Large Crystal
11162 => "OTHER", #Small Crystal
11163 => "OTHER", #Small Crystal
11164 => "OTHER", #Small Crystal
11165 => "OTHER", #Small Crystal
11166 => "OTHER", #Small Crystal
11167 => "OTHER", #Small Crystal
11168 => "OTHER", #Small Crystal
11169 => "OTHER" #Small Crystal
#END SoF Weapon Models
);
%AttackTypes = (
"1HS" => 1,
"2HS" => 3,
"1HB" => 0,
"2HB" => 2,
"1HP" => 36,
"2HP" => 36,
"STAFF" => 2,
"ARCHERY" => 7,
"BOW" => 7,
"THROWING" => 51,
"H2H" => 28,
"CASTER" => 28,
"SHIELD" => 28,
"BARD" => 28,
"OTHER" => 28
);
if($EnableRemoving) {
quest::wearchange(7, $PrimaryModel);
quest::wearchange(8, $SecondaryModel);
if ($PrimaryModel) {
my $PrimSkill = $AttackTypes{$WeaponModels{$PrimaryModel}};
$npc->SetPrimSkill($PrimSkill);
}
else {
$npc->SetPrimSkill(28);
}
if($SecondaryModel) {
my $SecSkill = $AttackTypes{$WeaponModels{$SecondaryModel}};
$npc->SetSecSkill($SecSkill);
}
else {
$npc->SetSecSkill(28);
}
}
else {
if ($PrimaryModel) {
quest::wearchange(7, $PrimaryModel);
my $PrimSkill = $AttackTypes{$WeaponModels{$PrimaryModel}};
$npc->SetPrimSkill($PrimSkill);
}
if ($SecondaryModel) {
quest::wearchange(8, $SecondaryModel);
my $SecSkill = $AttackTypes{$WeaponModels{$SecondaryModel}};
$npc->SetSecSkill($SecSkill);
}
}
}
return 1; #Added because all other plugins have this, but it may not actually be required.
3. Save that file to your server /plugins/ folder and name it "weapon_tools.pl".
4. Do a #questreload and the new plugin should be ready for use
Here is an example script:
Code:
sub EVENT_SPAWN {
quest::settimer("WeaponChange", 5);
}
sub EVENT_TIMER {
if($timer eq "WeaponChange") {
quest::stoptimer("WeaponChange");
#Any random weapon and shield available through SoF
plugin::RandomWeapons(1, 11169, 50, 200, 230);
}
}
Note that in the example, I didn't set NoDualWield? and IgnoreClass?, because I wanted to show that they are just optional.
The hash of weapon types for every weapon model is something I have been wanting to do for a while. I finally wrote a simple script using saylinks that did most of the work for me while I just looked and clicked the type of weapon I saw. I am sure there are other good uses to having this weapon model type hash. I may adjust this script again, but for now I figured it was good enough to at least post.
Last edited by trevius; 02-27-2010 at 07:10 AM..
|
|
|
|
02-21-2010, 01:22 PM
|
|
Demi-God
|
|
Join Date: Mar 2009
Location: Umm
Posts: 1,492
|
|
question: so basically this is just displaying random model on npc.
But I presume that model to skill animation still not implemented, so npc will still PUNCHING?
|
02-21-2010, 05:36 PM
|
Hill Giant
|
|
Join Date: Jul 2009
Location: Southern United States
Posts: 107
|
|
Thanks for posting this, works quite well.
Just a heads up though: Your example script passes parameters in the wrong sequence to RandomWeapons(). Using the usage notes I was able to correct the order and confirm that it works as intended.
|
02-21-2010, 07:17 PM
|
|
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
Thanks Taurinus, I got it corrected.
And Chaos, that is correct. At some point, I hope we do have the option to change the hit messages for both primary and secondary hands. If we ever get that functioning, we can add that feature to this plugin and really finish it off
|
02-22-2010, 01:49 AM
|
|
Administrator
|
|
Join Date: Feb 2009
Location: MN
Posts: 2,071
|
|
Once again, very nice Trevius, I can do a ton with this. Infact, I use random range for this kind of stuff already. I knew you were working on this but I didn't know exactly how you intended to implement the organization, but very good.
|
02-22-2010, 10:17 AM
|
|
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
Ok, now the plugin is pretty-much completed. Not only does it set their weapon model randomly, but it also sets their attack animation and attack messages to match the type of model it is! I edited the code in the original post with the updates. Note that in order to use the latest feature of being able to have matching animations/messages, you must be running Rev1259 or later.
If anyone finds incorrect labels for weapons in the hash, please reply here and I will update the hash with the correction(s). I just found a 2HB that was set to 1HP, so I am sure there are some that are still wrong. But, at least 95+% of the list should be very accurate to match the model with it's type.
|
02-22-2010, 11:58 AM
|
|
Demi-God
|
|
Join Date: Mar 2009
Location: Umm
Posts: 1,492
|
|
ah cool!
but what about just using this for specific models only?
Like I do not actually want to make mob use randomized weapons, but I want say all orcs to use specific weapon models which i will set in Animation field in npctypes table?
same applies to enchanter pets
|
02-22-2010, 02:31 PM
|
|
Administrator
|
|
Join Date: Feb 2009
Location: MN
Posts: 2,071
|
|
The thing about the new fields you opened up for the attack types... When I started compiling I had ran into this
Quote:
1>Compiling...
1>attack.cpp
1>.\attack.cpp(1659) : error C2440: '=' : cannot convert from 'int8' to 'SkillType'
1> Conversion to enumeration type requires an explicit cast (static_cast, C-style cast or function-style cast)
1>.\attack.cpp(1662) : error C2440: '=' : cannot convert from 'int8' to 'SkillType'
1> Conversion to enumeration type requires an explicit cast (static_cast, C-style cast or function-style cast)
|
|
02-22-2010, 04:27 PM
|
Hill Giant
|
|
Join Date: Jul 2009
Location: Southern United States
Posts: 107
|
|
Great work, Trevius.
I had actually started implementing the exact same thing, but was going about it a different way. I was going to export a new perl function that allowed setting the damage type on a per-mob basis.
About the compiler error, just feed it what it wants so it stops moaning:
Code:
SkillType skillinuse = HAND_TO_HAND;
if (Hand == 13) {
skillinuse = static_cast<SkillType> ( GetPrimSkill() );
}
if (Hand == 14) {
skillinuse = static_cast<SkillType>( GetSecSkill() );
}
|
02-22-2010, 04:28 PM
|
|
Administrator
|
|
Join Date: Feb 2009
Location: MN
Posts: 2,071
|
|
Yeah I was just about to post the same thing.
|
02-22-2010, 05:09 PM
|
|
Administrator
|
|
Join Date: Feb 2009
Location: MN
Posts: 2,071
|
|
Another thing I've found with this is that the NPC in this case (Script-made pet/mercenary) does not alternate piercing animations, not a huge downfall but just throwing that out there for Trevius's strive for perfection 8 D
|
|
|
|
02-22-2010, 07:40 PM
|
|
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
ChaosSlayer,
If you want to set certain NPCs to use certain weapon models and certain attack messages and animations, you can now just set them in the 2 new fields I added to the npc_types table. By default, the new fields are set to 28, which is hand to hand (punching), but you can change those to other skill IDs to use as long as you have a weapon model set for the npc already.
If you want to set the attack message/animations via quests after the NPC is already spawned, you can do it using the new quest objects I added in. I am probably going to make a plugin just for setting a specific weapon model that will automatically set the animation and message to match it.
Taurinus/Akkadius,
Thanks for the heads-up on the compile error. It worked fine for me in Linux, and I didn't bother trying it in Windows. At least it shouldn't be too hard to correct it.
For the piercing animations, I assume you mean there is no difference between the 1 handed and the 2 handed versions of piercing? That is because there is no actual 2 handed piercing skill, they both use the same skill. So, unless I make up a non-existent skill for 2 handed piercing, I can't easily make 2 handed piercing animations show properly. Or, is there some other alternate 1 handed piercing animations you are referring to? As far as the animations go, it should be working the same as using an item with that same skill type, other than for the 2 handed pierce ones.
Either way, at least the majority of the work is done to get this new feature working. Any adjustments can be added later if needed. I may check with KLS and see what she thinks about adding in a skill type of 100 (skill types only go to 76 currently on Live I believe) or something to use for 2 handed piercing.
For reference, here are the new quest objects I added last night:
$npc->GetPrimSkill() - Gets the NPCs primary weapon skill type as it is currently set
$npc->GetSecSkill() - Gets the NPCs secondary weapon skill type as it is currently set
$npc->SetPrimSkill(skill_type) - Sets the NPCs Primary slot skill to use for Animations and Hit Messages
$npc->SetSecSkill(skill_type) - Sets the NPCs Secondary slot skill to use for Animations and Hit Messages
When you get or set them, just know that it always uses the numeric value for the skill ID (not the skill name). Note that the changes these commands make are only temporary and do not update what is set in the database for the NPC.
Here is a list of the numeric values for the skills you can set with these commands:
0 1H Blunt
1 1H Slashing
2 2H Blunt
3 2H Slashing
7 Archery
28 Hand To Hand
36 Piercing
51 Throwing
Last edited by trevius; 02-22-2010 at 07:50 PM..
|
|
|
|
02-22-2010, 09:32 PM
|
|
Demi-God
|
|
Join Date: Mar 2009
Location: Umm
Posts: 1,492
|
|
AWESOME! I have been waiting for something like this for years =)
Thank you much Trev! =)
|
02-22-2010, 09:47 PM
|
|
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
Haha yeah, we have discussed it a few times in threads and I finally figured it was time to look into seeing how hard it would be to code it. It was actually much easier than I thought, lol. If I had known that, I would have done it long ago :P
The only other related idea to this that was discussed was the ability to make custom hit messages as well. For example, a snake might "bite" you instead of hit, slash, crush, etc. Unfortunately, doing that would take more work, as it would mean overriding the normal damage packets and instead sending an actual message to the client(s). Maybe some day, but I am pretty happy with what we have so far.
|
|
|
|
02-22-2010, 10:39 PM
|
|
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
Ok, I added another plugin to the original post in this thread (edited in the code). The new plugin works similar to the quest::wearchange() command, accept this plugin will set the wearchange weapon model(s) and also set the appropriate attack animation and message type as well.
Here is the usage for the new plugin:
Code:
#Usage: plugin::SetWeapons(PrimaryModel, SecondaryModel, EnableRemoving? );
#Example: plugin::SetWeapons(11, 200);
The EnableRemoving? argument is a bool for if you want 0s in primary or secondary to remove the weapon model from that slot. Otherwise, 0s will just prevent any changes for that slot. So, here are a few examples with explainations:
Code:
plugin::SetWeapons(11); # Will set the primary weapon model to 11 but not change what the second weapon model is currently.
plugin::SetWeapons(11, 200); # Will set the primary to 11 and secondary to 200.
plugin::SetWeapons(0, 200); # Will set the secondary to model 200 without changing whatever model might be set in the primary.
plugin::SetWeapons(0, 200, 1); # Will remove the weapon model from the primary and set the secondary to model 200
plugin::SetWeapons(11, 0, 1); # Will set the primary model to 11 and remove any secondary model.
Note that I have not yet tested the new SetWeapons plugin yet, but I am pretty sure it will work as described. I will test it when I get home and edit this post if it has any issues.
|
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 10:49 AM.
|
|
|
|
|
|
|
|
|
|
|
|
|