1 | //===== eAthena Script ======================================= |
---|
2 | //= Kafra Express - Broadcasting Module |
---|
3 | //===== By: ================================================== |
---|
4 | //= Skotlex |
---|
5 | //===== Current Version: ===================================== |
---|
6 | //= 3.1 |
---|
7 | //===== Compatible With: ===================================== |
---|
8 | //= eAthena SVN8637+ |
---|
9 | //===== Description: ========================================= |
---|
10 | //= Part of the Kafra Express Script Package. |
---|
11 | //= Offers broadcasting for party requests, pvp, general |
---|
12 | //= and anonymous. Broadcasts can be to the current map |
---|
13 | //= or server-wide |
---|
14 | //===== Additional Comments: ================================= |
---|
15 | //= See config.txt for configuration. |
---|
16 | //= For the PVP broadcasts, variables from the Pvp Warping |
---|
17 | //= Module are used. |
---|
18 | //============================================================ |
---|
19 | |
---|
20 | - script keInit_broadcast -1,{ |
---|
21 | OnInit: //Load Config |
---|
22 | donpcevent "keConfig::OnLoadBroadcast"; |
---|
23 | end; |
---|
24 | } |
---|
25 | |
---|
26 | //Function F_keBroadcast(String currentMapName) |
---|
27 | function script F_keBroadcast { |
---|
28 | |
---|
29 | function SF_calcPrice; |
---|
30 | function SF_broadcasts; |
---|
31 | function SF_bcPvp; |
---|
32 | function SF_doBroadcast; |
---|
33 | |
---|
34 | if ($@kebc_showOnline) { |
---|
35 | set @kmenu, select( |
---|
36 | "- Return", |
---|
37 | "- Map Broadcasts ("+getarg(0)+"/"+getmapusers(getarg(0))+" "+$@ked_users$+")", |
---|
38 | "- Global Broadcasts ("+getusers(1)+" "+$@ked_users$+")" |
---|
39 | ); |
---|
40 | } else { |
---|
41 | set @kmenu, select( |
---|
42 | "- Return", |
---|
43 | "- Map Broadcasts ("+getarg(0)+")", |
---|
44 | "- Global Broadcasts" |
---|
45 | ); |
---|
46 | } |
---|
47 | switch(@kmenu) { |
---|
48 | case 2: |
---|
49 | SF_calcPrice(0); |
---|
50 | set @map$,getarg(0); |
---|
51 | SF_broadcasts("Map ("+getarg(0)+")"); |
---|
52 | break; |
---|
53 | case 3: |
---|
54 | SF_calcPrice(1); |
---|
55 | set @map$,""; |
---|
56 | SF_broadcasts("Global"); |
---|
57 | break; |
---|
58 | } |
---|
59 | return; |
---|
60 | |
---|
61 | //Sub Function SF_broadcasts: Handles main broadcast menu. |
---|
62 | function SF_broadcasts { |
---|
63 | |
---|
64 | do { |
---|
65 | switch (select ( |
---|
66 | "- Cancel "+getarg(0)+" Broadcast", |
---|
67 | "- Party request Broadcast ("+@partycost+"z)", |
---|
68 | "- PvP challenge Broadcast ("+@pvpcost+"z)", |
---|
69 | "- General Broadcast ("+@cost+"z)", |
---|
70 | "- General Anonymous Broadcast ("+@anoncost+"z)" |
---|
71 | )) { |
---|
72 | case 2: //Party |
---|
73 | SF_doBroadcast $@kebc_partyCost,@map$,"The "+jobname(class)+" "+strcharinfo(0)+" (levels "+baselevel+"/"+joblevel+") is looking for a party to join.",0; |
---|
74 | break; |
---|
75 | case 3: //Pvp |
---|
76 | if ($@kewp_advanced == 0) |
---|
77 | SF_bcPvp $@kebc_pvpCost,@map$,0,0; |
---|
78 | else { |
---|
79 | do { |
---|
80 | set @kmenu, select ( |
---|
81 | "- Cancel", |
---|
82 | "- advertise all levels rooms", |
---|
83 | "- advertise levels "+($@kewp_baseLv1-$@kewp_range)+"-"+($@kewp_baseLv1+$@kewp_range)+" rooms", |
---|
84 | "- advertise levels "+($@kewp_baseLv2-$@kewp_range)+"-"+($@kewp_baseLv2+$@kewp_range)+" rooms", |
---|
85 | "- advertise levels "+($@kewp_baseLv3-$@kewp_range)+"-"+($@kewp_baseLv3+$@kewp_range)+" rooms", |
---|
86 | "- advertise levels "+($@kewp_baseLv4-$@kewp_range)+"-"+($@kewp_baseLv4+$@kewp_range)+" rooms", |
---|
87 | "- advertise levels "+($@kewp_baseLv5-$@kewp_range)+"-"+($@kewp_baseLv5+$@kewp_range)+" rooms", |
---|
88 | "- advertise levels "+($@kewp_baseLv6-$@kewp_range)+"-"+($@kewp_baseLv6+$@kewp_range)+" rooms", |
---|
89 | "- advertise levels "+($@kewp_baseLv7-$@kewp_range)+"-"+($@kewp_baseLv7+$@kewp_range)+" rooms" |
---|
90 | ); |
---|
91 | switch (@kmenu) { |
---|
92 | case 2: //All levels |
---|
93 | SF_bcPvp $@kebc_pvpCost,@map$,0,0; |
---|
94 | break; |
---|
95 | case 3: //Lv1 |
---|
96 | SF_bcPvp $@kebc_pvpCost,@map$,$@kewp_baseLv1-$@kewp_range,$@kewp_baseLv1+$@kewp_range; |
---|
97 | break; |
---|
98 | case 4: //Lv2 |
---|
99 | SF_bcPvp $@kebc_pvpCost,@map$,$@kewp_baseLv2-$@kewp_range,$@kewp_baseLv2+$@kewp_range; |
---|
100 | break; |
---|
101 | case 5: //Lv3 |
---|
102 | SF_bcPvp $@kebc_pvpCost,@map$,$@kewp_baseLv3-$@kewp_range,$@kewp_baseLv3+$@kewp_range; |
---|
103 | break; |
---|
104 | case 6: //Lv4 |
---|
105 | SF_bcPvp $@kebc_pvpCost,@map$,$@kewp_baseLv4-$@kewp_range,$@kewp_baseLv4+$@kewp_range; |
---|
106 | break; |
---|
107 | case 7: //Lv5 |
---|
108 | SF_bcPvp $@kebc_pvpCost,@map$,$@kewp_baseLv5-$@kewp_range,$@kewp_baseLv5+$@kewp_range; |
---|
109 | break; |
---|
110 | case 8: //Lv6 |
---|
111 | SF_bcPvp $@kebc_pvpCost,@map$,$@kewp_baseLv6-$@kewp_range,$@kewp_baseLv6+$@kewp_range; |
---|
112 | break; |
---|
113 | case 9: //Lv7 |
---|
114 | SF_bcPvp $@kebc_pvpCost,@map$,$@kewp_baseLv7-$@kewp_range,$@kewp_baseLv7+$@kewp_range; |
---|
115 | break; |
---|
116 | default: |
---|
117 | break; |
---|
118 | } |
---|
119 | } while (@kmenu > 1); |
---|
120 | } |
---|
121 | break; |
---|
122 | case 4: //General |
---|
123 | SF_doBroadcast $@kebc_cost,@map$,"(From "+strcharinfo(0)+") ",1; |
---|
124 | break; |
---|
125 | case 5: //Anonymous |
---|
126 | SF_doBroadcast $@kebc_anonCost,@map$,"(Anonymous) ",1; |
---|
127 | break; |
---|
128 | default: |
---|
129 | return; |
---|
130 | } |
---|
131 | } while (1); |
---|
132 | } //SF_ end |
---|
133 | |
---|
134 | //SubFunction: Calculates prices for Broadcast services (argument 0 == 1 for global bc, 0 for map bc |
---|
135 | function SF_calcPrice { |
---|
136 | set @partycost,callfunc("F_keCost",$@kebc_partyCost,$@kebc_discount); |
---|
137 | set @pvpcost,callfunc("F_keCost",$@kebc_pvpCost,$@kebc_discount); |
---|
138 | set @cost,callfunc("F_keCost",$@kebc_cost,$@kebc_discount); |
---|
139 | set @anoncost,callfunc("F_keCost",$@kebc_anonCost,$@kebc_discount); |
---|
140 | if (getarg(0)) { //Global fix |
---|
141 | set @partycost,@partycost*$@kebc_globalFactor/100; |
---|
142 | set @pvpcost,@pvpcost*$@kebc_globalFactor/100; |
---|
143 | set @cost,@cost*$@kebc_globalFactor/100; |
---|
144 | set @anoncost,@anoncost*$@kebc_globalFactor/100; |
---|
145 | } |
---|
146 | } //SF_ end |
---|
147 | |
---|
148 | //SubFunction SF_doBroadcast(int cost, String map, String message, int input) |
---|
149 | //If map is "", do a global broadcast |
---|
150 | //If input is 1, concat a user string to message. |
---|
151 | function SF_doBroadcast { |
---|
152 | set @cost, getarg(0); |
---|
153 | if (getarg(1)=="") |
---|
154 | set @cost, @cost*$@kebc_globalFactor/100; |
---|
155 | if (getarg(3)) { //Input message |
---|
156 | input @msg$; |
---|
157 | set @msg$,getarg(2)+@msg$; |
---|
158 | } else |
---|
159 | set @msg$,getarg(2); |
---|
160 | |
---|
161 | mes "Broadcast '"+@msg$+"'?"; |
---|
162 | switch (select( |
---|
163 | "- Cancel Broadcast", |
---|
164 | "- Broadcast Message" |
---|
165 | )) { |
---|
166 | case 2: |
---|
167 | if (!(callfunc("F_keCharge",@cost,$@kebc_discount,1))) { |
---|
168 | callfunc "F_keIntro", e_pif, "You don't have enough Zeny..."; |
---|
169 | return; |
---|
170 | } |
---|
171 | |
---|
172 | callfunc "F_keIntro", e_what, "Broadcasting..."; |
---|
173 | if (getarg(1)=="") |
---|
174 | announce @msg$,16; |
---|
175 | else |
---|
176 | mapannounce getarg(1),@msg$,3; |
---|
177 | break; |
---|
178 | default: |
---|
179 | callfunc "F_keIntro", -1, "Ok..."; |
---|
180 | } |
---|
181 | } //SF_ end |
---|
182 | |
---|
183 | //SubFunction SF_bcPvp (int cost, String map, int min level, int max level) |
---|
184 | //Does the second part of PvP Room Advertising. Level is the level group to |
---|
185 | //advertise (1->8 where 8 is free for all) |
---|
186 | function SF_bcPvp { |
---|
187 | set @msg$, "advertising"; |
---|
188 | set @lvls$, ""; |
---|
189 | if (getarg(3)) { |
---|
190 | if (BaseLevel < getarg(2) || BaseLevel > getarg(3)) { |
---|
191 | callfunc "F_keIntro", e_bzz, "You can only broadcast requests for PvP rooms you can enter!"; |
---|
192 | return; |
---|
193 | } |
---|
194 | set @msg$,"levels "+getarg(2)+"-"+getarg(3); |
---|
195 | set @lvls$,"(levels "+getarg(2)+"-"+getarg(3)+") "; |
---|
196 | } |
---|
197 | set @pvpcost,getarg(0); |
---|
198 | switch(select( |
---|
199 | "- Cancel (PvP Rooms "+@msg$+")", |
---|
200 | "- advertise 'Room Sandwich'", |
---|
201 | "- advertise 'Room Rock On'", |
---|
202 | "- advertise 'Four Room'", |
---|
203 | "- advertise 'Room Undercross'", |
---|
204 | "- advertise 'Room Compass'" |
---|
205 | )) { |
---|
206 | case 2: //Sandwich |
---|
207 | SF_doBroadcast @pvpcost,@map$,"The "+jobname(class)+" "+strcharinfo(0)+" is looking for PvP challengers "+@lvls$+"in the 'Room Sandwich'!",0; |
---|
208 | break; |
---|
209 | case 3: //Rockon |
---|
210 | SF_doBroadcast @pvpcost,@map$,"The "+jobname(class)+" "+strcharinfo(0)+" is looking for PvP challengers "+@lvls$+"in the 'Room Rock On'!",0; |
---|
211 | break; |
---|
212 | case 4: //Room Four |
---|
213 | SF_doBroadcast @pvpcost,@map$,"The "+jobname(class)+" "+strcharinfo(0)+" is looking for PvP challengers "+@lvls$+"in the 'Four Room'!",0; |
---|
214 | break; |
---|
215 | case 5: //Undercross |
---|
216 | SF_doBroadcast @pvpcost,@map$,"The "+jobname(class)+" "+strcharinfo(0)+" is looking for PvP challengers "+@lvls$+"in the 'Room Undercross'!",0; |
---|
217 | break; |
---|
218 | case 6: //Compass |
---|
219 | SF_doBroadcast @pvpcost,@map$,"The "+jobname(class)+" "+strcharinfo(0)+" is looking for PvP challengers "+@lvls$+"in the 'Room Compass'!",0; |
---|
220 | break; |
---|
221 | } |
---|
222 | } //SF_ end |
---|
223 | |
---|
224 | } |
---|