props
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@508 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
db56870d32
commit
717714e5b8
@ -1,18 +1,18 @@
|
||||
// Athena charcommand Configuration file.
|
||||
// Translated by Peter Kieser <pfak@telus.net>
|
||||
|
||||
// Set here the symbol that you want to use for your commands
|
||||
// Only 1 character is get (default is '#'). You can set any character,
|
||||
// except control-character (0x00-0x1f), '%' (party chat speaking) and '/' (standard ragnarok GM commands)
|
||||
// and '@' (Standard GM Commands)
|
||||
// With default character, all commands begin by a '#', example: #save SomePlayer
|
||||
command_symbol: #
|
||||
|
||||
job: 60
|
||||
jobchange: 60
|
||||
petrename: 50
|
||||
petfriendly: 50
|
||||
stats: 40
|
||||
option: 60
|
||||
save: 60
|
||||
statsall: 40
|
||||
// Athena charcommand Configuration file.
|
||||
// Translated by Peter Kieser <pfak@telus.net>
|
||||
|
||||
// Set here the symbol that you want to use for your commands
|
||||
// Only 1 character is get (default is '#'). You can set any character,
|
||||
// except control-character (0x00-0x1f), '%' (party chat speaking) and '/' (standard ragnarok GM commands)
|
||||
// and '@' (Standard GM Commands)
|
||||
// With default character, all commands begin by a '#', example: #save SomePlayer
|
||||
command_symbol: #
|
||||
|
||||
job: 60
|
||||
jobchange: 60
|
||||
petrename: 50
|
||||
petfriendly: 50
|
||||
stats: 40
|
||||
option: 60
|
||||
save: 60
|
||||
statsall: 40
|
||||
|
3394
db/item_db.txt
3394
db/item_db.txt
File diff suppressed because it is too large
Load Diff
@ -1,17 +1,17 @@
|
||||
//<Skill ID> <Mode>
|
||||
//
|
||||
// Mode:
|
||||
// 1 - Cannot be used in normal maps
|
||||
// 2 - Cannot be used in PvP maps
|
||||
// 4 - Cannot be used in GvG maps
|
||||
// 8 - Cannot be used when WoE is on
|
||||
// 16 - Cannot be used in PK Mode maps
|
||||
// Example: 8,6 = Endure cannot be used in PvP and GvG maps (2+4)
|
||||
8,12
|
||||
26,12
|
||||
27,12
|
||||
87,12
|
||||
150,12
|
||||
361,12
|
||||
362,12
|
||||
//<Skill ID> <Mode>
|
||||
//
|
||||
// Mode:
|
||||
// 1 - Cannot be used in normal maps
|
||||
// 2 - Cannot be used in PvP maps
|
||||
// 4 - Cannot be used in GvG maps
|
||||
// 8 - Cannot be used when WoE is on
|
||||
// 16 - Cannot be used in PK Mode maps
|
||||
// Example: 8,6 = Endure cannot be used in PvP and GvG maps (2+4)
|
||||
8,12
|
||||
26,12
|
||||
27,12
|
||||
87,12
|
||||
150,12
|
||||
361,12
|
||||
362,12
|
||||
389,12
|
@ -1,360 +1,360 @@
|
||||
Effect list - #'s I found while testing, lots of possible advanced class effects we missed
|
||||
(mixed old effect list of valaris and spira's new list...)
|
||||
|
||||
0-5. Attack Display
|
||||
6. Being Warped
|
||||
7. Being Healed
|
||||
8. Yellow Ripple Effect
|
||||
9. Different Type of Heal?
|
||||
10. Mammomite
|
||||
11. Endure
|
||||
12. Yellow cast aura
|
||||
13. Blue Box
|
||||
14. Blue heal? Blue pot?
|
||||
15. Soul Strike
|
||||
16. Hide animation
|
||||
17. Magnum Break
|
||||
18. Steal
|
||||
19. Invalid
|
||||
20. Envenom/Poison
|
||||
21. Slow Poison? (Envenom In Blue)
|
||||
22. Sight
|
||||
23. Stone Curse
|
||||
24. FireBall
|
||||
25. FireWall
|
||||
26. Nothing?
|
||||
27. Frost Driver Cast
|
||||
28. Frost Driver Hitting
|
||||
29. Lightning Bolt
|
||||
30. ThunderStorm
|
||||
31. Bubbles Appearing From The Character?
|
||||
32. Explosion
|
||||
33. Ruwach
|
||||
34. Warp out aura (blue)
|
||||
35. Casting Warp portal (blue)
|
||||
36. Warp portal (blue)
|
||||
37. Agi up
|
||||
38. Agi down
|
||||
39. Something being made
|
||||
40. Cross thing (paladin skill?)
|
||||
41. Angelus bell
|
||||
42. Blessing angels
|
||||
43. Dex + Agi up
|
||||
44. Little fog smoke.
|
||||
45. Faint little ball things.
|
||||
46. Sand?
|
||||
47. Torch
|
||||
48. Circle of blue flat things
|
||||
49. Firebolt/wall hits
|
||||
50. Spinning fire thing
|
||||
51. Icebolt hit
|
||||
52. JT Hit
|
||||
53. Puff of purpulish smoke?
|
||||
54-59. Cast animations
|
||||
60. Cast target circle
|
||||
61. Warp portal (for maps)
|
||||
62. Sight rasher
|
||||
63. Fire sphere from some skill
|
||||
64. Weird purple/red light
|
||||
65. some sort of mob hit???
|
||||
66. potion effect?
|
||||
67. Provoke
|
||||
68. MVP
|
||||
69. Skid trap sign
|
||||
70. Blue purple aura thing
|
||||
71. Spiral Yellow balls
|
||||
72. Bigger Spiral Yellow balls
|
||||
73. Blue/yellow ripple
|
||||
74. Icewall sicle
|
||||
75. Acolyte skill (3 singing girls)
|
||||
76. Big angel that spreads wings (some aco skill)
|
||||
77. Resurrection angel
|
||||
78. Status recovery
|
||||
79. Heaven drive spike? Earth spike?
|
||||
80. Spear boomerange
|
||||
81. Skill hit
|
||||
82. Detect hidden
|
||||
83. Another aco skill i don't know (angel comes out of green light)
|
||||
84. Yet another stupid angel.
|
||||
85. Lex Divinia
|
||||
86. Holy water?
|
||||
87. Lex aeterna
|
||||
88. Another damn priest/aco skill
|
||||
89. SG
|
||||
90. LoV
|
||||
91. Aco priest skill
|
||||
92. Meteor Storm
|
||||
93. JT ball
|
||||
94. JT hit
|
||||
95. Quagmire
|
||||
96. Some sort of cool looking fire hit?
|
||||
97. Firepillar hit
|
||||
98.
|
||||
99. Big blue light
|
||||
100. Yellow ball fountain
|
||||
101. Forge?
|
||||
102. Hammerfall
|
||||
103. Powerthrust?
|
||||
104. Weapon perfection?
|
||||
105. Nothing?
|
||||
106. Fire explosion.
|
||||
107. Fire explosion (from trap?)
|
||||
108. blue smoke with noise
|
||||
109. blue bubbles
|
||||
110. yellow smoke (trap?)
|
||||
111. some bs skill or something
|
||||
117. Waterball
|
||||
120. Sound effect
|
||||
132. Single Grimtooth
|
||||
138. Fire pillar
|
||||
139. Fireworks
|
||||
154. refine success
|
||||
155. refine fail
|
||||
156. Jobchange.str (crashes client)
|
||||
157. Levelup.str (crashes client)
|
||||
158. joblvup
|
||||
159. Pvp circle
|
||||
160. Woe circle?
|
||||
161. Rain
|
||||
162. Snow
|
||||
163. Sakura leaves
|
||||
164. nothing (npc/mob?)
|
||||
165. Weird ball thing
|
||||
166. turns sprite blue
|
||||
167. Taming Success (crashes client)
|
||||
168. Taming failed (crashes client)
|
||||
169. blue light
|
||||
170. explosion
|
||||
171. venom dust
|
||||
172. black aura
|
||||
173. red aura
|
||||
174. blue aura
|
||||
175. yellow aura
|
||||
176. purple aura
|
||||
177. red aura
|
||||
178. white aura
|
||||
179. purple aura
|
||||
180. darkness attack hit?
|
||||
181. water attack hit?
|
||||
182. wind attack hit
|
||||
183. self destruction
|
||||
184. nothing (npc/mob?)
|
||||
185. nothing (npc/mob?)
|
||||
186. yellow effect
|
||||
187. yellow effect
|
||||
188. yellow effect
|
||||
189. yellow effect
|
||||
190. yellow effect
|
||||
191. target (piercing attack or something)
|
||||
192. purple cloud hit
|
||||
193. mute or something (npc skill)
|
||||
194. stun attack?
|
||||
195. stone curse
|
||||
196. curse
|
||||
197. sleep
|
||||
198. nothing (npc/mob?)
|
||||
199. some weird bubble
|
||||
200-203. Parts of the level 99 Aura
|
||||
204-211. Healing Items Effect
|
||||
212. Damage Effect (9999)
|
||||
213. Shield Appears (Guard?)
|
||||
214. 3 Weird Things Appear Around You (They All Look The Same)
|
||||
215. Hide/Unhide?
|
||||
216. 2 Red Balls shoot out
|
||||
217. 2 Blue Balls shoot out
|
||||
218. Concentration Potion Effect
|
||||
219. Other Speed Potion
|
||||
220. Berserk Potion
|
||||
221. White Alien Abduction Beam
|
||||
222. Defender Skill Effect (Black Circle)
|
||||
223. Invalid Effect
|
||||
224. White Wisp Revolving around you
|
||||
225. Volcano Effect
|
||||
226. Grand Cross Effect
|
||||
227-230. Blank
|
||||
231. Yuno Effect (Takes Alittle While)
|
||||
232. Blank
|
||||
233. Fog
|
||||
234. Unknown To Me
|
||||
235. Unknown To Me
|
||||
236. Deluge Effect
|
||||
237. Wind Gale Effect
|
||||
238. Land Protect Effect
|
||||
239. Volcano Effect 2
|
||||
240. Deluge Effect 2
|
||||
241. Wind Gale Effect 2
|
||||
242. Land Protect Effect 2
|
||||
243. Invalid Effect
|
||||
244. Unknown To Me.
|
||||
245. Holy Cross Effect
|
||||
246. Shield Charge Effect
|
||||
247. Yuno Effect 2 (Larger)
|
||||
248. Status Recovery? (Shows An Angel On Top Of Your Head)
|
||||
249. Shield Boomerang
|
||||
250. Spear Quicken
|
||||
251. Devotion
|
||||
252. Reflect Shield (Yellow Circle)
|
||||
259. Green Abduction Beam
|
||||
260. Orange Abduction Beam
|
||||
261. red aura thing
|
||||
262. yellow things that shoot out
|
||||
263. Yellow ground effect.
|
||||
264. nothing (npc/mob?)
|
||||
265. laser beam ?!
|
||||
266. bunch of white shit flies out
|
||||
267. gun shot!
|
||||
268. money bag
|
||||
269. sword thing
|
||||
270. shield thing
|
||||
271. armor thing
|
||||
272. cape thing?
|
||||
273. Outter spinning white balls.
|
||||
274. flying gold
|
||||
275. spit
|
||||
276. stuff that flies out somewhat like crits
|
||||
277. white stuff that comes out around sprite
|
||||
295. frost joke
|
||||
296. scream
|
||||
298. fire bottle throwing
|
||||
300. Chemical Protection
|
||||
301. Blank
|
||||
302. Demonstration Fire Effect
|
||||
303. Weird Effect you turn yellow and see six lines (3 sets of 2) going slanted
|
||||
304. After being warped
|
||||
305. Pharmacy Success
|
||||
306. Pharmacy Failed
|
||||
307. Sunlight through the roof effect in Geffenia
|
||||
308. Blank
|
||||
309. Unknown to me
|
||||
310. Unknown to me
|
||||
311. Shout/Yell/Loud (Merchant Skill) Effect
|
||||
312-313. Heal Effect?
|
||||
314. Another Part of Warp/ Yuno Effect?
|
||||
315. Newer Safety Wall (Pink Portal)
|
||||
316. Another Part of Warp (The Ripple Floor Part)
|
||||
317. Full Warp Effect
|
||||
322. daylight
|
||||
323. daylight
|
||||
324. daylight
|
||||
328. asura strike word
|
||||
329. tripple strike
|
||||
333. Orange Leaves Falling
|
||||
334. blind (can stack it)
|
||||
335. poison (can stack it)
|
||||
336. defender shield?
|
||||
337. joblvup
|
||||
338. supernovice angel
|
||||
341. pink warp portal
|
||||
342. pink aura
|
||||
343. pink heart thing (cool)
|
||||
344. teleport in
|
||||
346. big blue ball
|
||||
347. wedding effect
|
||||
349. waterfall (horizonatal)
|
||||
350. waterfall (vertical)
|
||||
351. sm waterfall (horizonatal)
|
||||
352. sm waterfall (vertical)
|
||||
353. drk waterfall (horizonatal)
|
||||
354. drk waterfall (vertical)
|
||||
355. drk sm waterfall (horizonatal)
|
||||
356. drk sm waterfall (vertical)
|
||||
358. niflheim ghost
|
||||
359. niflheim bat slow
|
||||
360. niflheim bat fast
|
||||
361. shoots purple wave out
|
||||
362. nothing?
|
||||
363. valentine's day heart (wings)
|
||||
364. valentine's day heart
|
||||
365. falling cross
|
||||
368. make you red (berserk?)
|
||||
369. 2h quicken?
|
||||
371. lvup
|
||||
372. death
|
||||
373. smoke
|
||||
375. white outline around sprite
|
||||
376. makes red and shoots out stuff
|
||||
377. shoots out yellow shit
|
||||
380. shakes screen turns you all different colors
|
||||
387. spins you around shakes screen flashes white
|
||||
394. big red ball around you
|
||||
|
||||
403 = mind breaker
|
||||
404 = spider web
|
||||
405 = nothing
|
||||
406 = explosion effect on the head
|
||||
407 = effect that starts big and fades in to your characters head
|
||||
|
||||
408. Orange Bubble Grows Around
|
||||
409. Weird Poision Like Effect
|
||||
410. Rainbow
|
||||
411. (Usable, Just add in folder effect file called peong1.tga).errors/detoxify like.
|
||||
413. nothing?
|
||||
417. flash
|
||||
418. red critical explosion?
|
||||
419. Pulsating grey aura
|
||||
420. gradual shrink char (possible minimize effect?)
|
||||
421. instant minimize
|
||||
422. grow back, but not all the way (baby height)
|
||||
423. mega size
|
||||
424. makes sprite bright
|
||||
425. 4 brownish replicas of sprite fly off?
|
||||
426. shakes sprites (works on player sprites!)
|
||||
427. nothing? (maybe for npc/mobs)
|
||||
428. yellow sparks
|
||||
429. blue sparks
|
||||
430. blue sparks in different direction
|
||||
431. another blue spark variant
|
||||
432. can't find effect\elec1.tga
|
||||
433. nothing? (npc/mob?)
|
||||
434. white sparks
|
||||
435. can't find effect\storm2.tga (sometimes works and shows little tornado thing!
|
||||
436. white shield (for one of the defense skills?)
|
||||
437. blue aura (kinda like a comet!)
|
||||
438. another defense aura? blue ripples. blue pulsating shield
|
||||
439. can't fine effect\line3.tga
|
||||
440. high priest skill angel? Angelus type effect but with a cross
|
||||
441. another cast aura
|
||||
442. nothing? (npc/mob?)
|
||||
443. nothing? (npc/mob?)
|
||||
444. white lines that fire out
|
||||
445. your sprite flies up and disappears sometime sprite errors
|
||||
446. your sprite falls down
|
||||
447. nothing? (npc/mob?)
|
||||
448. nothing? (npc/mob?)
|
||||
449. turns you bright blue real quick
|
||||
450. darkcross effect (black grand cross)
|
||||
451. red soul strike?! (high wiz skill?)
|
||||
452. A jupital thunder type of effect, electricity pulsates around your char
|
||||
453. Smoke (electricity type) surrounds char, can move and effect is still their.
|
||||
454. black cast aura
|
||||
455. red electric that covers body
|
||||
456. looks like wind rushes up (reminds me of agi up but slower, bigger, and grey)
|
||||
457. forces attack animation. makes a dash like stance
|
||||
458. causes sprite to jiggle. char pulsates and distorts (like 426)
|
||||
459. effect\storm2.tga error, causes player sprite to spin around and you see a faint tornado aura
|
||||
460. same as 459.
|
||||
461. faint tornado aura
|
||||
462. same as 459.
|
||||
463. same as 459.
|
||||
464. same as 459.
|
||||
465. same as 459.
|
||||
466. nothing (npc/mob?)
|
||||
467. sprite error (effect\hanmoon1.tga?)
|
||||
468. sprite error (effect\hanmoon2.tga?)
|
||||
469. sprite error (effect\hanmoon3.tga?)
|
||||
470. sprite error (effect\hanmoon4.tga?)
|
||||
471. sprite error (effect\hanmoon5.tga?)
|
||||
472. sprite error (effect\hanmoon6.tga?)
|
||||
473. sprite error (effect\hanmoon7.tga?)
|
||||
474. nothing (npc/mob?)
|
||||
|
||||
475-484 = slow fade to blind, each one continues to make it smaller and smaller
|
||||
485 = white critical explosion thing
|
||||
486 = blue critical explosion thing
|
||||
487 = black portal ground effect
|
||||
488 = orange spikey aura that stretches up to fire type points
|
||||
489 = yellow/gold of 488
|
||||
489 = blue version
|
||||
491 = a small expoision above the head
|
||||
492 = creates 1 small venom poison type of point on the ground
|
||||
493+ = invalid effects
|
||||
Effect list - #'s I found while testing, lots of possible advanced class effects we missed
|
||||
(mixed old effect list of valaris and spira's new list...)
|
||||
|
||||
0-5. Attack Display
|
||||
6. Being Warped
|
||||
7. Being Healed
|
||||
8. Yellow Ripple Effect
|
||||
9. Different Type of Heal?
|
||||
10. Mammomite
|
||||
11. Endure
|
||||
12. Yellow cast aura
|
||||
13. Blue Box
|
||||
14. Blue heal? Blue pot?
|
||||
15. Soul Strike
|
||||
16. Hide animation
|
||||
17. Magnum Break
|
||||
18. Steal
|
||||
19. Invalid
|
||||
20. Envenom/Poison
|
||||
21. Slow Poison? (Envenom In Blue)
|
||||
22. Sight
|
||||
23. Stone Curse
|
||||
24. FireBall
|
||||
25. FireWall
|
||||
26. Nothing?
|
||||
27. Frost Driver Cast
|
||||
28. Frost Driver Hitting
|
||||
29. Lightning Bolt
|
||||
30. ThunderStorm
|
||||
31. Bubbles Appearing From The Character?
|
||||
32. Explosion
|
||||
33. Ruwach
|
||||
34. Warp out aura (blue)
|
||||
35. Casting Warp portal (blue)
|
||||
36. Warp portal (blue)
|
||||
37. Agi up
|
||||
38. Agi down
|
||||
39. Something being made
|
||||
40. Cross thing (paladin skill?)
|
||||
41. Angelus bell
|
||||
42. Blessing angels
|
||||
43. Dex + Agi up
|
||||
44. Little fog smoke.
|
||||
45. Faint little ball things.
|
||||
46. Sand?
|
||||
47. Torch
|
||||
48. Circle of blue flat things
|
||||
49. Firebolt/wall hits
|
||||
50. Spinning fire thing
|
||||
51. Icebolt hit
|
||||
52. JT Hit
|
||||
53. Puff of purpulish smoke?
|
||||
54-59. Cast animations
|
||||
60. Cast target circle
|
||||
61. Warp portal (for maps)
|
||||
62. Sight rasher
|
||||
63. Fire sphere from some skill
|
||||
64. Weird purple/red light
|
||||
65. some sort of mob hit???
|
||||
66. potion effect?
|
||||
67. Provoke
|
||||
68. MVP
|
||||
69. Skid trap sign
|
||||
70. Blue purple aura thing
|
||||
71. Spiral Yellow balls
|
||||
72. Bigger Spiral Yellow balls
|
||||
73. Blue/yellow ripple
|
||||
74. Icewall sicle
|
||||
75. Acolyte skill (3 singing girls)
|
||||
76. Big angel that spreads wings (some aco skill)
|
||||
77. Resurrection angel
|
||||
78. Status recovery
|
||||
79. Heaven drive spike? Earth spike?
|
||||
80. Spear boomerange
|
||||
81. Skill hit
|
||||
82. Detect hidden
|
||||
83. Another aco skill i don't know (angel comes out of green light)
|
||||
84. Yet another stupid angel.
|
||||
85. Lex Divinia
|
||||
86. Holy water?
|
||||
87. Lex aeterna
|
||||
88. Another damn priest/aco skill
|
||||
89. SG
|
||||
90. LoV
|
||||
91. Aco priest skill
|
||||
92. Meteor Storm
|
||||
93. JT ball
|
||||
94. JT hit
|
||||
95. Quagmire
|
||||
96. Some sort of cool looking fire hit?
|
||||
97. Firepillar hit
|
||||
98.
|
||||
99. Big blue light
|
||||
100. Yellow ball fountain
|
||||
101. Forge?
|
||||
102. Hammerfall
|
||||
103. Powerthrust?
|
||||
104. Weapon perfection?
|
||||
105. Nothing?
|
||||
106. Fire explosion.
|
||||
107. Fire explosion (from trap?)
|
||||
108. blue smoke with noise
|
||||
109. blue bubbles
|
||||
110. yellow smoke (trap?)
|
||||
111. some bs skill or something
|
||||
117. Waterball
|
||||
120. Sound effect
|
||||
132. Single Grimtooth
|
||||
138. Fire pillar
|
||||
139. Fireworks
|
||||
154. refine success
|
||||
155. refine fail
|
||||
156. Jobchange.str (crashes client)
|
||||
157. Levelup.str (crashes client)
|
||||
158. joblvup
|
||||
159. Pvp circle
|
||||
160. Woe circle?
|
||||
161. Rain
|
||||
162. Snow
|
||||
163. Sakura leaves
|
||||
164. nothing (npc/mob?)
|
||||
165. Weird ball thing
|
||||
166. turns sprite blue
|
||||
167. Taming Success (crashes client)
|
||||
168. Taming failed (crashes client)
|
||||
169. blue light
|
||||
170. explosion
|
||||
171. venom dust
|
||||
172. black aura
|
||||
173. red aura
|
||||
174. blue aura
|
||||
175. yellow aura
|
||||
176. purple aura
|
||||
177. red aura
|
||||
178. white aura
|
||||
179. purple aura
|
||||
180. darkness attack hit?
|
||||
181. water attack hit?
|
||||
182. wind attack hit
|
||||
183. self destruction
|
||||
184. nothing (npc/mob?)
|
||||
185. nothing (npc/mob?)
|
||||
186. yellow effect
|
||||
187. yellow effect
|
||||
188. yellow effect
|
||||
189. yellow effect
|
||||
190. yellow effect
|
||||
191. target (piercing attack or something)
|
||||
192. purple cloud hit
|
||||
193. mute or something (npc skill)
|
||||
194. stun attack?
|
||||
195. stone curse
|
||||
196. curse
|
||||
197. sleep
|
||||
198. nothing (npc/mob?)
|
||||
199. some weird bubble
|
||||
200-203. Parts of the level 99 Aura
|
||||
204-211. Healing Items Effect
|
||||
212. Damage Effect (9999)
|
||||
213. Shield Appears (Guard?)
|
||||
214. 3 Weird Things Appear Around You (They All Look The Same)
|
||||
215. Hide/Unhide?
|
||||
216. 2 Red Balls shoot out
|
||||
217. 2 Blue Balls shoot out
|
||||
218. Concentration Potion Effect
|
||||
219. Other Speed Potion
|
||||
220. Berserk Potion
|
||||
221. White Alien Abduction Beam
|
||||
222. Defender Skill Effect (Black Circle)
|
||||
223. Invalid Effect
|
||||
224. White Wisp Revolving around you
|
||||
225. Volcano Effect
|
||||
226. Grand Cross Effect
|
||||
227-230. Blank
|
||||
231. Yuno Effect (Takes Alittle While)
|
||||
232. Blank
|
||||
233. Fog
|
||||
234. Unknown To Me
|
||||
235. Unknown To Me
|
||||
236. Deluge Effect
|
||||
237. Wind Gale Effect
|
||||
238. Land Protect Effect
|
||||
239. Volcano Effect 2
|
||||
240. Deluge Effect 2
|
||||
241. Wind Gale Effect 2
|
||||
242. Land Protect Effect 2
|
||||
243. Invalid Effect
|
||||
244. Unknown To Me.
|
||||
245. Holy Cross Effect
|
||||
246. Shield Charge Effect
|
||||
247. Yuno Effect 2 (Larger)
|
||||
248. Status Recovery? (Shows An Angel On Top Of Your Head)
|
||||
249. Shield Boomerang
|
||||
250. Spear Quicken
|
||||
251. Devotion
|
||||
252. Reflect Shield (Yellow Circle)
|
||||
259. Green Abduction Beam
|
||||
260. Orange Abduction Beam
|
||||
261. red aura thing
|
||||
262. yellow things that shoot out
|
||||
263. Yellow ground effect.
|
||||
264. nothing (npc/mob?)
|
||||
265. laser beam ?!
|
||||
266. bunch of white shit flies out
|
||||
267. gun shot!
|
||||
268. money bag
|
||||
269. sword thing
|
||||
270. shield thing
|
||||
271. armor thing
|
||||
272. cape thing?
|
||||
273. Outter spinning white balls.
|
||||
274. flying gold
|
||||
275. spit
|
||||
276. stuff that flies out somewhat like crits
|
||||
277. white stuff that comes out around sprite
|
||||
295. frost joke
|
||||
296. scream
|
||||
298. fire bottle throwing
|
||||
300. Chemical Protection
|
||||
301. Blank
|
||||
302. Demonstration Fire Effect
|
||||
303. Weird Effect you turn yellow and see six lines (3 sets of 2) going slanted
|
||||
304. After being warped
|
||||
305. Pharmacy Success
|
||||
306. Pharmacy Failed
|
||||
307. Sunlight through the roof effect in Geffenia
|
||||
308. Blank
|
||||
309. Unknown to me
|
||||
310. Unknown to me
|
||||
311. Shout/Yell/Loud (Merchant Skill) Effect
|
||||
312-313. Heal Effect?
|
||||
314. Another Part of Warp/ Yuno Effect?
|
||||
315. Newer Safety Wall (Pink Portal)
|
||||
316. Another Part of Warp (The Ripple Floor Part)
|
||||
317. Full Warp Effect
|
||||
322. daylight
|
||||
323. daylight
|
||||
324. daylight
|
||||
328. asura strike word
|
||||
329. tripple strike
|
||||
333. Orange Leaves Falling
|
||||
334. blind (can stack it)
|
||||
335. poison (can stack it)
|
||||
336. defender shield?
|
||||
337. joblvup
|
||||
338. supernovice angel
|
||||
341. pink warp portal
|
||||
342. pink aura
|
||||
343. pink heart thing (cool)
|
||||
344. teleport in
|
||||
346. big blue ball
|
||||
347. wedding effect
|
||||
349. waterfall (horizonatal)
|
||||
350. waterfall (vertical)
|
||||
351. sm waterfall (horizonatal)
|
||||
352. sm waterfall (vertical)
|
||||
353. drk waterfall (horizonatal)
|
||||
354. drk waterfall (vertical)
|
||||
355. drk sm waterfall (horizonatal)
|
||||
356. drk sm waterfall (vertical)
|
||||
358. niflheim ghost
|
||||
359. niflheim bat slow
|
||||
360. niflheim bat fast
|
||||
361. shoots purple wave out
|
||||
362. nothing?
|
||||
363. valentine's day heart (wings)
|
||||
364. valentine's day heart
|
||||
365. falling cross
|
||||
368. make you red (berserk?)
|
||||
369. 2h quicken?
|
||||
371. lvup
|
||||
372. death
|
||||
373. smoke
|
||||
375. white outline around sprite
|
||||
376. makes red and shoots out stuff
|
||||
377. shoots out yellow shit
|
||||
380. shakes screen turns you all different colors
|
||||
387. spins you around shakes screen flashes white
|
||||
394. big red ball around you
|
||||
|
||||
403 = mind breaker
|
||||
404 = spider web
|
||||
405 = nothing
|
||||
406 = explosion effect on the head
|
||||
407 = effect that starts big and fades in to your characters head
|
||||
|
||||
408. Orange Bubble Grows Around
|
||||
409. Weird Poision Like Effect
|
||||
410. Rainbow
|
||||
411. (Usable, Just add in folder effect file called peong1.tga).errors/detoxify like.
|
||||
413. nothing?
|
||||
417. flash
|
||||
418. red critical explosion?
|
||||
419. Pulsating grey aura
|
||||
420. gradual shrink char (possible minimize effect?)
|
||||
421. instant minimize
|
||||
422. grow back, but not all the way (baby height)
|
||||
423. mega size
|
||||
424. makes sprite bright
|
||||
425. 4 brownish replicas of sprite fly off?
|
||||
426. shakes sprites (works on player sprites!)
|
||||
427. nothing? (maybe for npc/mobs)
|
||||
428. yellow sparks
|
||||
429. blue sparks
|
||||
430. blue sparks in different direction
|
||||
431. another blue spark variant
|
||||
432. can't find effect\elec1.tga
|
||||
433. nothing? (npc/mob?)
|
||||
434. white sparks
|
||||
435. can't find effect\storm2.tga (sometimes works and shows little tornado thing!
|
||||
436. white shield (for one of the defense skills?)
|
||||
437. blue aura (kinda like a comet!)
|
||||
438. another defense aura? blue ripples. blue pulsating shield
|
||||
439. can't fine effect\line3.tga
|
||||
440. high priest skill angel? Angelus type effect but with a cross
|
||||
441. another cast aura
|
||||
442. nothing? (npc/mob?)
|
||||
443. nothing? (npc/mob?)
|
||||
444. white lines that fire out
|
||||
445. your sprite flies up and disappears sometime sprite errors
|
||||
446. your sprite falls down
|
||||
447. nothing? (npc/mob?)
|
||||
448. nothing? (npc/mob?)
|
||||
449. turns you bright blue real quick
|
||||
450. darkcross effect (black grand cross)
|
||||
451. red soul strike?! (high wiz skill?)
|
||||
452. A jupital thunder type of effect, electricity pulsates around your char
|
||||
453. Smoke (electricity type) surrounds char, can move and effect is still their.
|
||||
454. black cast aura
|
||||
455. red electric that covers body
|
||||
456. looks like wind rushes up (reminds me of agi up but slower, bigger, and grey)
|
||||
457. forces attack animation. makes a dash like stance
|
||||
458. causes sprite to jiggle. char pulsates and distorts (like 426)
|
||||
459. effect\storm2.tga error, causes player sprite to spin around and you see a faint tornado aura
|
||||
460. same as 459.
|
||||
461. faint tornado aura
|
||||
462. same as 459.
|
||||
463. same as 459.
|
||||
464. same as 459.
|
||||
465. same as 459.
|
||||
466. nothing (npc/mob?)
|
||||
467. sprite error (effect\hanmoon1.tga?)
|
||||
468. sprite error (effect\hanmoon2.tga?)
|
||||
469. sprite error (effect\hanmoon3.tga?)
|
||||
470. sprite error (effect\hanmoon4.tga?)
|
||||
471. sprite error (effect\hanmoon5.tga?)
|
||||
472. sprite error (effect\hanmoon6.tga?)
|
||||
473. sprite error (effect\hanmoon7.tga?)
|
||||
474. nothing (npc/mob?)
|
||||
|
||||
475-484 = slow fade to blind, each one continues to make it smaller and smaller
|
||||
485 = white critical explosion thing
|
||||
486 = blue critical explosion thing
|
||||
487 = black portal ground effect
|
||||
488 = orange spikey aura that stretches up to fire type points
|
||||
489 = yellow/gold of 488
|
||||
489 = blue version
|
||||
491 = a small expoision above the head
|
||||
492 = creates 1 small venom poison type of point on the ground
|
||||
493+ = invalid effects
|
||||
|
1102
doc/miscnotes.txt
1102
doc/miscnotes.txt
File diff suppressed because it is too large
Load Diff
@ -1,65 +1,65 @@
|
||||
//===== eAthena Script =======================================
|
||||
//= Lou Yang City NPC's
|
||||
//===== By: ==================================================
|
||||
//= Vidar (1.0)
|
||||
//= Mass Zero (1.1)
|
||||
//===== Current Version: =====================================
|
||||
//= 1.0
|
||||
//===== Compatible With: =====================================
|
||||
//= Any eAthena Version
|
||||
//===== Description: =========================================
|
||||
//= Unofficial NPC's for Lou Yang city.
|
||||
//===== Additional Comments: =================================
|
||||
//= Originally made for Vidar
|
||||
//============================================================
|
||||
|
||||
louyang.gat,260,96,2 script Chun Hua 770,{
|
||||
mes "[^000080Chun Hua^000000]";
|
||||
mes "Welcome traveler, you must be hungry and thirsty.";
|
||||
mes "Please come inside, there is much to eat.";
|
||||
next;
|
||||
mes "[^000080Chun Hua^000000]";
|
||||
mes "Do not be afraid about how much you ask for, there is much to go around.";
|
||||
close;
|
||||
}
|
||||
|
||||
lou_fild01.gat,188,102,1 script Extraordinary Sailor 100,{
|
||||
mes "[Extraordinary Sailor]";
|
||||
mes "We run a line to Alberta, we could take you there if you like.";
|
||||
next;
|
||||
menu "Let me travel to Alberta",L_Menu1,"No, thanks",L_Menu2;
|
||||
close;
|
||||
L_Menu1:
|
||||
warp "alberta.gat",247,44;
|
||||
L_Menu2:
|
||||
mes "[Extraordinary Sailor]";
|
||||
mes "Suit yourself.";
|
||||
close;
|
||||
}
|
||||
|
||||
alberta.gat,247,42,4 script Expert Sailor 100,{
|
||||
mes "[Expert Sailor]";
|
||||
mes "Have you ever been over seas?";
|
||||
next;
|
||||
menu "Yes",YES,"No",NO;
|
||||
YES:
|
||||
mes "Same here! I'm about to head back out that way again.";
|
||||
mes "Would you like to come with me?";
|
||||
next;
|
||||
menu "Sure",L_Menu1,"No, thanks",L_Menu3;
|
||||
close;
|
||||
L_Menu1:
|
||||
warp "lou_fild01.gat",192,105;
|
||||
NO:
|
||||
mes "What a shame, it is truley a sight to behold. I'm about to head back out that way again.";
|
||||
mes "Would you like to come with me?";
|
||||
next;
|
||||
menu "Sure",L_Menu2,"No, thanks",L_Menu3;
|
||||
close;
|
||||
L_Menu2:
|
||||
warp "lou_fild01.gat",192,105;
|
||||
L_Menu3:
|
||||
mes "[Expert Sailor]";
|
||||
mes "Suit yourself.";
|
||||
close;
|
||||
//===== eAthena Script =======================================
|
||||
//= Lou Yang City NPC's
|
||||
//===== By: ==================================================
|
||||
//= Vidar (1.0)
|
||||
//= Mass Zero (1.1)
|
||||
//===== Current Version: =====================================
|
||||
//= 1.0
|
||||
//===== Compatible With: =====================================
|
||||
//= Any eAthena Version
|
||||
//===== Description: =========================================
|
||||
//= Unofficial NPC's for Lou Yang city.
|
||||
//===== Additional Comments: =================================
|
||||
//= Originally made for Vidar
|
||||
//============================================================
|
||||
|
||||
louyang.gat,260,96,2 script Chun Hua 770,{
|
||||
mes "[^000080Chun Hua^000000]";
|
||||
mes "Welcome traveler, you must be hungry and thirsty.";
|
||||
mes "Please come inside, there is much to eat.";
|
||||
next;
|
||||
mes "[^000080Chun Hua^000000]";
|
||||
mes "Do not be afraid about how much you ask for, there is much to go around.";
|
||||
close;
|
||||
}
|
||||
|
||||
lou_fild01.gat,188,102,1 script Extraordinary Sailor 100,{
|
||||
mes "[Extraordinary Sailor]";
|
||||
mes "We run a line to Alberta, we could take you there if you like.";
|
||||
next;
|
||||
menu "Let me travel to Alberta",L_Menu1,"No, thanks",L_Menu2;
|
||||
close;
|
||||
L_Menu1:
|
||||
warp "alberta.gat",247,44;
|
||||
L_Menu2:
|
||||
mes "[Extraordinary Sailor]";
|
||||
mes "Suit yourself.";
|
||||
close;
|
||||
}
|
||||
|
||||
alberta.gat,247,42,4 script Expert Sailor 100,{
|
||||
mes "[Expert Sailor]";
|
||||
mes "Have you ever been over seas?";
|
||||
next;
|
||||
menu "Yes",YES,"No",NO;
|
||||
YES:
|
||||
mes "Same here! I'm about to head back out that way again.";
|
||||
mes "Would you like to come with me?";
|
||||
next;
|
||||
menu "Sure",L_Menu1,"No, thanks",L_Menu3;
|
||||
close;
|
||||
L_Menu1:
|
||||
warp "lou_fild01.gat",192,105;
|
||||
NO:
|
||||
mes "What a shame, it is truley a sight to behold. I'm about to head back out that way again.";
|
||||
mes "Would you like to come with me?";
|
||||
next;
|
||||
menu "Sure",L_Menu2,"No, thanks",L_Menu3;
|
||||
close;
|
||||
L_Menu2:
|
||||
warp "lou_fild01.gat",192,105;
|
||||
L_Menu3:
|
||||
mes "[Expert Sailor]";
|
||||
mes "Suit yourself.";
|
||||
close;
|
||||
}
|
@ -1,491 +1,491 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <signal.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "login.h"
|
||||
|
||||
//--------------------------------
|
||||
// Send to char
|
||||
//--------------------------------
|
||||
int charif_sendallwos(int sfd, unsigned char *buf, unsigned int len) {
|
||||
int i, c;
|
||||
int fd;
|
||||
|
||||
c = 0;
|
||||
for(i = 0; i < MAX_SERVERS && i < servers_connected; i++) {
|
||||
if ((fd = server_fd[i]) > 0 && fd != sfd) {
|
||||
memcpy(WFIFOP(fd,0), buf, len);
|
||||
WFIFOSET(fd,len);
|
||||
c++;
|
||||
}
|
||||
}
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
//--------------------------------
|
||||
// Char-server anti-freeze system
|
||||
//--------------------------------
|
||||
int char_anti_freeze_system(int tid, unsigned int tick, int id, int data) {
|
||||
int i;
|
||||
|
||||
for(i = 0; i < MAX_SERVERS && i < servers_connected; i++) {
|
||||
if (server_fd[i] >= 0) {// if char-server is online
|
||||
// printf("char_anti_freeze_system: server #%d '%s', flag: %d.\n", i, server[i].name, server_freezeflag[i]);
|
||||
if (server_freezeflag[i]-- < 1) {// Char-server anti-freeze system. Counter. 5 ok, 4...0 freezed
|
||||
session[server_fd[i]]->eof = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//-------------------------------------------
|
||||
// Request for account reg from char-server [Edit: Wizputer]
|
||||
//-------------------------------------------
|
||||
void send_account_reg(int fd) {
|
||||
int account_id = RFIFOL(fd,2);
|
||||
int i;
|
||||
|
||||
for(i=0;i<AUTH_FIFO_SIZE;i++){
|
||||
if (auth_fifo[i].account_id == account_id &&
|
||||
auth_fifo[i].login_id1 == RFIFOL(fd,6) &&
|
||||
#if CMP_AUTHFIFO_LOGIN2 != 0
|
||||
auth_fifo[i].login_id2 == RFIFOL(fd,10) && // relate to the versions higher than 18
|
||||
#endif
|
||||
auth_fifo[i].sex == RFIFOB(fd,14) &&
|
||||
#if CMP_AUTHFIFO_IP != 0
|
||||
auth_fifo[i].ip == RFIFOL(fd,15) &&
|
||||
#endif
|
||||
!auth_fifo[i].delflag) {
|
||||
auth_fifo[i].delflag = 1;
|
||||
#ifdef DEBUG
|
||||
printf("Client: [%d] Auth Number: [%d]\n",fd, i);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i != AUTH_FIFO_SIZE) { // send account_reg
|
||||
int p;
|
||||
time_t connect_until_time = 0;
|
||||
char email[40] = "";
|
||||
|
||||
sprintf(tmpsql, "SELECT `email`,`connect_until` FROM `%s` WHERE `%s`='%d'", login_db, login_db_account_id, account_id);
|
||||
sql_query(tmpsql,"send_account_reg");
|
||||
|
||||
|
||||
if ((sql_res = mysql_store_result(&mysql_handle))) {
|
||||
if((sql_row = mysql_fetch_row(sql_res))) {
|
||||
connect_until_time = atol(sql_row[1]);
|
||||
strcpy(email, sql_row[0]);
|
||||
}
|
||||
}
|
||||
mysql_free_result(sql_res);
|
||||
|
||||
if (account_id > 0) {
|
||||
sprintf(tmpsql, "SELECT `str`,`value` FROM `global_reg_value` WHERE `type`='1' AND `account_id`='%d'",account_id);
|
||||
sql_query(tmpsql,"send_account_reg");
|
||||
|
||||
if ((sql_res = mysql_store_result(&mysql_handle))) {
|
||||
WFIFOW(fd,0) = 0x2729;
|
||||
WFIFOL(fd,4) = account_id;
|
||||
for(p = 8; (sql_row = mysql_fetch_row(sql_res));p+=36){
|
||||
memcpy(WFIFOP(fd,p), sql_row[0], 32);
|
||||
WFIFOL(fd,p+32) = atoi(sql_row[1]);
|
||||
}
|
||||
WFIFOW(fd,2) = p;
|
||||
WFIFOSET(fd,p);
|
||||
#ifdef DEBUG
|
||||
printf("account_reg2 send : login->char (auth fifo)\n");
|
||||
#endif
|
||||
WFIFOW(fd,0) = 0x2713;
|
||||
WFIFOL(fd,2) = account_id;
|
||||
WFIFOB(fd,6) = 0;
|
||||
memcpy(WFIFOP(fd, 7), email, 40);
|
||||
WFIFOL(fd,47) = (unsigned long) connect_until_time;
|
||||
WFIFOSET(fd,51);
|
||||
}
|
||||
mysql_free_result(sql_res);
|
||||
}
|
||||
} else {
|
||||
WFIFOW(fd,0) = 0x2713;
|
||||
WFIFOL(fd,2) = account_id;
|
||||
WFIFOB(fd,6) = 1;
|
||||
WFIFOSET(fd,51);
|
||||
}
|
||||
RFIFOSKIP(fd,19);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------
|
||||
// Number of users in the world (connected char-server(s)) [Edit: Wizputer]
|
||||
//----------------------------------------------------------
|
||||
void number_world_users(int fd, int id) {
|
||||
#ifdef DEBUG
|
||||
if (server[id].users != RFIFOL(fd,2))
|
||||
printf("set number users %s : %d\n", server[id].name, RFIFOL(fd,2));
|
||||
#endif
|
||||
|
||||
server[id].users = RFIFOL(fd,2);
|
||||
if(anti_freeze_enable)
|
||||
server_freezeflag[id] = 5; // Char anti-freeze system. Counter. 5 ok, 4...0 freezed
|
||||
|
||||
sprintf(tmpsql,"UPDATE `sstatus` SET `user` = '%d' WHERE `index` = '%d'", server[id].users, id);
|
||||
sql_query(tmpsql,"number_world_users");
|
||||
|
||||
RFIFOSKIP(fd,6);
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Email and Time request from char-server [Edit: Wizputer]
|
||||
//-----------------------------------------
|
||||
void email_time_request(int fd, int id) {
|
||||
int account_id=RFIFOL(fd,2);
|
||||
time_t connect_until_time = 0;
|
||||
char email[40] = "";
|
||||
|
||||
sprintf(tmpsql,"SELECT `email`,`connect_until` FROM `%s` WHERE `%s`='%d'",login_db, login_db_account_id, account_id);
|
||||
sql_query(tmpsql,"email_time_request");
|
||||
|
||||
if ((sql_res = mysql_store_result(&mysql_handle))) {
|
||||
if((sql_row = mysql_fetch_row(sql_res))) {
|
||||
connect_until_time = atol(sql_row[1]);
|
||||
strcpy(email, sql_row[0]);
|
||||
}
|
||||
}
|
||||
mysql_free_result(sql_res);
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("parse_fromchar: E-mail/limited time request from '%s' server (concerned account: %d)\n", server[id].name, account_id);
|
||||
#endif
|
||||
|
||||
WFIFOW(fd,0) = 0x2717;
|
||||
WFIFOL(fd,2) = account_id;
|
||||
memcpy(WFIFOP(fd, 6), email, 40);
|
||||
WFIFOL(fd,46) = (unsigned long) connect_until_time;
|
||||
WFIFOSET(fd,50);
|
||||
|
||||
RFIFOSKIP(fd,6);
|
||||
}
|
||||
|
||||
//--------------------------------
|
||||
// Request to change email [Edit: Wizputer]
|
||||
//--------------------------------
|
||||
void change_account_email(int fd, int id, char ip[16]) {
|
||||
int acc = RFIFOL(fd,2);
|
||||
char actual_email[40], new_email[40];
|
||||
|
||||
memcpy(actual_email, RFIFOP(fd,6), 40);
|
||||
memcpy(new_email, RFIFOP(fd,46), 40);
|
||||
|
||||
if (e_mail_check(actual_email) == 0) {
|
||||
#ifdef DEBUG
|
||||
printf("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but actual email is invalid (account: %d, ip: %s)" RETCODE,
|
||||
server[id].name, acc, ip);
|
||||
#endif
|
||||
} else if (e_mail_check(new_email) == 0) {
|
||||
#ifdef DEBUG
|
||||
printf("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command) with a invalid new e-mail (account: %d, ip: %s)" RETCODE,
|
||||
server[id].name, acc, ip);
|
||||
#endif
|
||||
} else if (strcmpi(new_email, "athena@athena.com") == 0) {
|
||||
#ifdef DEBUG
|
||||
printf("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command) with a default e-mail (account: %d, ip: %s)" RETCODE,
|
||||
server[id].name, acc, ip);
|
||||
#endif
|
||||
} else {
|
||||
sprintf(tmpsql, "SELECT `%s`,`email` FROM `%s` WHERE `%s` = '%d'", login_db_userid, login_db, login_db_account_id, acc);
|
||||
sql_query(tmpsql,"change_account_email");
|
||||
|
||||
if ((sql_res = mysql_store_result(&mysql_handle))) {
|
||||
if((sql_row = mysql_fetch_row(sql_res))) { //row fetching
|
||||
if (strcmpi(sql_row[1], actual_email) == 0) {
|
||||
sprintf(tmpsql, "UPDATE `%s` SET `email` = '%s' WHERE `%s` = '%d'", login_db, new_email, login_db_account_id, acc);
|
||||
sql_query(tmpsql,"change_account_email");
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("Char-server '%s': Modify an e-mail on an account (@email GM command) (account: %d (%s), new e-mail: %s, ip: %s)." RETCODE,
|
||||
server[id].name, acc, sql_row[0], actual_email, ip);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
RFIFOSKIP(fd, 86);
|
||||
}
|
||||
|
||||
//-----------------------------------------------
|
||||
// State change request from map server (By Yor) [Edit: Wizputer]
|
||||
//-----------------------------------------------
|
||||
void status_change_request(int fd) {
|
||||
int acc = RFIFOL(fd,2), status = RFIFOL(fd,6);
|
||||
|
||||
sprintf(tmpsql, "SELECT `state` FROM `%s` WHERE `%s` = '%d'", login_db, login_db_account_id, acc);
|
||||
sql_query(tmpsql,"status_change_request");
|
||||
|
||||
if ((sql_res = mysql_store_result(&mysql_handle))) {
|
||||
if((sql_row = mysql_fetch_row(sql_res))) { // row fetching
|
||||
if (atoi(sql_row[0]) != status && status != 0) {
|
||||
unsigned char buf[16];
|
||||
WBUFW(buf,0) = 0x2731;
|
||||
WBUFL(buf,2) = acc;
|
||||
WBUFB(buf,6) = 0; // 0: change of statut, 1: ban
|
||||
WBUFL(buf,7) = status; // status or final date of a banishment
|
||||
charif_sendallwos(-1, buf, 11);
|
||||
}
|
||||
}
|
||||
|
||||
sprintf(tmpsql,"UPDATE `%s` SET `state` = '%d' WHERE `%s` = '%d'", login_db, status,login_db_account_id,acc);
|
||||
sql_query(tmpsql,"status_change_request");
|
||||
}
|
||||
|
||||
RFIFOSKIP(fd,10);
|
||||
}
|
||||
//--------------------------------------
|
||||
// Ban request from map-server (By Yor) [Edit: Wizputer]
|
||||
//--------------------------------------
|
||||
void ban_request(int fd) {
|
||||
int acc=RFIFOL(fd,2);
|
||||
struct tm *tmtime;
|
||||
time_t timestamp, tmptime;
|
||||
|
||||
sprintf(tmpsql, "SELECT `ban_until` FROM `%s` WHERE `%s` = '%d'",login_db,login_db_account_id,acc);
|
||||
sql_query(tmpsql,"ban_request");
|
||||
|
||||
if ((sql_res = mysql_store_result(&mysql_handle)) && (sql_row = mysql_fetch_row(sql_res))) {
|
||||
tmptime = atol(sql_row[0]);
|
||||
|
||||
if (tmptime == 0 || tmptime < time(NULL))
|
||||
timestamp = time(NULL);
|
||||
else
|
||||
timestamp = tmptime;
|
||||
|
||||
tmtime = localtime(×tamp);
|
||||
tmtime->tm_year = tmtime->tm_year + (short)RFIFOW(fd,6);
|
||||
tmtime->tm_mon = tmtime->tm_mon + (short)RFIFOW(fd,8);
|
||||
tmtime->tm_mday = tmtime->tm_mday + (short)RFIFOW(fd,10);
|
||||
tmtime->tm_hour = tmtime->tm_hour + (short)RFIFOW(fd,12);
|
||||
tmtime->tm_min = tmtime->tm_min + (short)RFIFOW(fd,14);
|
||||
tmtime->tm_sec = tmtime->tm_sec + (short)RFIFOW(fd,16);
|
||||
|
||||
timestamp = mktime(tmtime);
|
||||
|
||||
if (timestamp != -1) {
|
||||
if (timestamp <= time(NULL))
|
||||
timestamp = 0;
|
||||
if (tmptime != timestamp) {
|
||||
if (timestamp != 0) {
|
||||
unsigned char buf[16];
|
||||
WBUFW(buf,0) = 0x2731;
|
||||
WBUFL(buf,2) = acc;
|
||||
WBUFB(buf,6) = 1; // 0: change of statut, 1: ban
|
||||
WBUFL(buf,7) = timestamp; // status or final date of a banishment
|
||||
charif_sendallwos(-1, buf, 11);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
printf("Account: [%d] Banned until: [%ld]\n", acc, timestamp);
|
||||
#endif
|
||||
|
||||
sprintf(tmpsql, "UPDATE `%s` SET `ban_until` = '%ld', `state`='7' WHERE `%s` = '%d'", login_db, timestamp, login_db_account_id, acc);
|
||||
sql_query(tmpsql,"ban_request");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RFIFOSKIP(fd,18);
|
||||
}
|
||||
|
||||
//-----------------------------
|
||||
// Change sex [Edit: Wizputer]
|
||||
//-----------------------------
|
||||
void change_sex(int fd) {
|
||||
int sex,acc=RFIFOL(fd,4);
|
||||
unsigned char buf[16];
|
||||
|
||||
sprintf(tmpsql,"SELECT `sex` FROM `%s` WHERE `%s` = '%d'",login_db,login_db_account_id,acc);
|
||||
sql_query(tmpsql,"change_sex");
|
||||
|
||||
if ((sql_res = mysql_store_result(&mysql_handle)) && (sql_row = mysql_fetch_row(sql_res))) {
|
||||
if (strcmpi(sql_row[0], "M") == 0)
|
||||
sex = 1;
|
||||
else
|
||||
sex = 0;
|
||||
|
||||
sprintf(tmpsql,"UPDATE `%s` SET `sex` = '%c' WHERE `%s` = '%d'", login_db, (sex==0?'M':'F'), login_db_account_id, acc);
|
||||
sql_query(tmpsql,"change_sex");
|
||||
|
||||
WBUFW(buf,0) = 0x2723;
|
||||
WBUFL(buf,2) = acc;
|
||||
WBUFB(buf,6) = sex;
|
||||
charif_sendallwos(-1, buf, 7);
|
||||
}
|
||||
|
||||
RFIFOSKIP(fd,6);
|
||||
}
|
||||
|
||||
//-------------------------------
|
||||
// Save Account Reg [Edit: Wizputer]
|
||||
//-------------------------------
|
||||
void save_account_reg(int fd){
|
||||
int p,j,value,acc=RFIFOL(fd,4);
|
||||
char str[32];
|
||||
char temp_str[32];
|
||||
|
||||
if (acc>0){
|
||||
unsigned char buf[RFIFOW(fd,2)+1];
|
||||
for(p=8,j=0;p<RFIFOW(fd,2) && j<ACCOUNT_REG2_NUM;p+=36,j++){
|
||||
memcpy(str,RFIFOP(fd,p),32);
|
||||
value=RFIFOL(fd,p+32);
|
||||
|
||||
sprintf(tmpsql,"REPLACE INTO `global_reg_value` (`type`, `account_id`, `str`, `value`) VALUES ( 1 , '%d' , '%s' , '%d');", acc, jstrescapecpy(temp_str,str), value);
|
||||
sql_query(tmpsql,"save_account_reg");
|
||||
}
|
||||
|
||||
// Send to char
|
||||
memcpy(WBUFP(buf,0),RFIFOP(fd,0),RFIFOW(fd,2));
|
||||
WBUFW(buf,0)=0x2729;
|
||||
charif_sendallwos(fd,buf,WBUFW(buf,2));
|
||||
}
|
||||
|
||||
RFIFOSKIP(fd,RFIFOW(fd,2));
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("login: save account_reg (from char)\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
//------------------------------------------------
|
||||
// Recieve unban request from map-server (by Yor) [Edit: Wizputer]
|
||||
//------------------------------------------------
|
||||
void unban_request(int fd) {
|
||||
int acc = RFIFOL(fd,2);
|
||||
|
||||
sprintf(tmpsql,"UPDATE `%s` SET `ban_until` = '0', `state`='0' WHERE `%s` = '%d' AND `state`='6'", login_db,login_db_account_id,acc);
|
||||
sql_query(tmpsql,"unban_request");
|
||||
|
||||
RFIFOSKIP(fd,6);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
// char-server packet parse [Edit: Wizputer]
|
||||
//-----------------------------------------------------
|
||||
int parse_fromchar(int fd){
|
||||
int id;
|
||||
|
||||
unsigned char *p = (unsigned char *) &session[fd]->client_addr.sin_addr;
|
||||
char ip[16];
|
||||
|
||||
sprintf(ip, "%d.%d.%d.%d", p[0], p[1], p[2], p[3]);
|
||||
|
||||
for(id = 0; id < MAX_SERVERS && id < servers_connected; id++)
|
||||
if (server_fd[id] == fd)
|
||||
break;
|
||||
|
||||
if (id == MAX_SERVERS)
|
||||
session[fd]->eof = 1;
|
||||
|
||||
if(session[fd]->eof) {
|
||||
if (id < MAX_SERVERS) {
|
||||
printf("Char-server '%s' has disconnected.\n", server[id].name);
|
||||
server_fd[id] = -1;
|
||||
memset(&server[id], 0, sizeof(struct mmo_char_server));
|
||||
servers_connected--;
|
||||
// server delete
|
||||
sprintf(tmpsql, "DELETE FROM `sstatus` WHERE `index`='%d'", id);
|
||||
sql_query(tmpsql,"parse_fromchar");
|
||||
}
|
||||
close(fd);
|
||||
delete_session(fd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
while(RFIFOREST(fd) >= 2) {
|
||||
#ifdef DEBUG_PACKETS
|
||||
printf("char_parse: %d %d packet case=%x\n", fd, RFIFOREST(fd), RFIFOW(fd, 0));
|
||||
#endif
|
||||
|
||||
switch (RFIFOW(fd,0)) {
|
||||
case 0x2712:
|
||||
if (RFIFOREST(fd) < 19)
|
||||
return 0;
|
||||
send_account_reg(fd);
|
||||
break;
|
||||
|
||||
case 0x2714:
|
||||
if (RFIFOREST(fd) < 6)
|
||||
return 0;
|
||||
number_world_users(fd,id);
|
||||
break;
|
||||
|
||||
case 0x2716:
|
||||
if (RFIFOREST(fd) < 6)
|
||||
return 0;
|
||||
email_time_request(fd, id);
|
||||
break;
|
||||
|
||||
case 0x2722:
|
||||
if (RFIFOREST(fd) < 86)
|
||||
return 0;
|
||||
change_account_email(fd, id, ip);
|
||||
break;
|
||||
|
||||
case 0x2724:
|
||||
if (RFIFOREST(fd) < 10)
|
||||
return 0;
|
||||
status_change_request(fd);
|
||||
break;
|
||||
|
||||
case 0x2725:
|
||||
if (RFIFOREST(fd) < 18)
|
||||
return 0;
|
||||
ban_request(fd);
|
||||
break;
|
||||
|
||||
case 0x2727:
|
||||
if (RFIFOREST(fd) < 6)
|
||||
return 0;
|
||||
change_sex(fd);
|
||||
break;
|
||||
|
||||
case 0x2728:
|
||||
if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2))
|
||||
return 0;
|
||||
save_account_reg(fd);
|
||||
break;
|
||||
|
||||
case 0x272a:
|
||||
if (RFIFOREST(fd) < 6)
|
||||
return 0;
|
||||
unban_request(fd);
|
||||
return 0;
|
||||
|
||||
case 0x272b: // Set account_id to online [Wizputer]
|
||||
if (RFIFOREST(fd) < 6)
|
||||
return 0;
|
||||
add_online_user(RFIFOL(fd,2));
|
||||
RFIFOSKIP(fd,6);
|
||||
break;
|
||||
|
||||
case 0x272c: // Set account_id to offline [Wizputer]
|
||||
if (RFIFOREST(fd) < 6)
|
||||
return 0;
|
||||
remove_online_user(RFIFOL(fd,2));
|
||||
RFIFOSKIP(fd,6);
|
||||
break;
|
||||
|
||||
default:
|
||||
#ifdef DEBUG
|
||||
printf("login: unknown packet %x! (from char).\n", RFIFOW(fd,0));
|
||||
#endif
|
||||
session[fd]->eof = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <signal.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "login.h"
|
||||
|
||||
//--------------------------------
|
||||
// Send to char
|
||||
//--------------------------------
|
||||
int charif_sendallwos(int sfd, unsigned char *buf, unsigned int len) {
|
||||
int i, c;
|
||||
int fd;
|
||||
|
||||
c = 0;
|
||||
for(i = 0; i < MAX_SERVERS && i < servers_connected; i++) {
|
||||
if ((fd = server_fd[i]) > 0 && fd != sfd) {
|
||||
memcpy(WFIFOP(fd,0), buf, len);
|
||||
WFIFOSET(fd,len);
|
||||
c++;
|
||||
}
|
||||
}
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
//--------------------------------
|
||||
// Char-server anti-freeze system
|
||||
//--------------------------------
|
||||
int char_anti_freeze_system(int tid, unsigned int tick, int id, int data) {
|
||||
int i;
|
||||
|
||||
for(i = 0; i < MAX_SERVERS && i < servers_connected; i++) {
|
||||
if (server_fd[i] >= 0) {// if char-server is online
|
||||
// printf("char_anti_freeze_system: server #%d '%s', flag: %d.\n", i, server[i].name, server_freezeflag[i]);
|
||||
if (server_freezeflag[i]-- < 1) {// Char-server anti-freeze system. Counter. 5 ok, 4...0 freezed
|
||||
session[server_fd[i]]->eof = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//-------------------------------------------
|
||||
// Request for account reg from char-server [Edit: Wizputer]
|
||||
//-------------------------------------------
|
||||
void send_account_reg(int fd) {
|
||||
int account_id = RFIFOL(fd,2);
|
||||
int i;
|
||||
|
||||
for(i=0;i<AUTH_FIFO_SIZE;i++){
|
||||
if (auth_fifo[i].account_id == account_id &&
|
||||
auth_fifo[i].login_id1 == RFIFOL(fd,6) &&
|
||||
#if CMP_AUTHFIFO_LOGIN2 != 0
|
||||
auth_fifo[i].login_id2 == RFIFOL(fd,10) && // relate to the versions higher than 18
|
||||
#endif
|
||||
auth_fifo[i].sex == RFIFOB(fd,14) &&
|
||||
#if CMP_AUTHFIFO_IP != 0
|
||||
auth_fifo[i].ip == RFIFOL(fd,15) &&
|
||||
#endif
|
||||
!auth_fifo[i].delflag) {
|
||||
auth_fifo[i].delflag = 1;
|
||||
#ifdef DEBUG
|
||||
printf("Client: [%d] Auth Number: [%d]\n",fd, i);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i != AUTH_FIFO_SIZE) { // send account_reg
|
||||
int p;
|
||||
time_t connect_until_time = 0;
|
||||
char email[40] = "";
|
||||
|
||||
sprintf(tmpsql, "SELECT `email`,`connect_until` FROM `%s` WHERE `%s`='%d'", login_db, login_db_account_id, account_id);
|
||||
sql_query(tmpsql,"send_account_reg");
|
||||
|
||||
|
||||
if ((sql_res = mysql_store_result(&mysql_handle))) {
|
||||
if((sql_row = mysql_fetch_row(sql_res))) {
|
||||
connect_until_time = atol(sql_row[1]);
|
||||
strcpy(email, sql_row[0]);
|
||||
}
|
||||
}
|
||||
mysql_free_result(sql_res);
|
||||
|
||||
if (account_id > 0) {
|
||||
sprintf(tmpsql, "SELECT `str`,`value` FROM `global_reg_value` WHERE `type`='1' AND `account_id`='%d'",account_id);
|
||||
sql_query(tmpsql,"send_account_reg");
|
||||
|
||||
if ((sql_res = mysql_store_result(&mysql_handle))) {
|
||||
WFIFOW(fd,0) = 0x2729;
|
||||
WFIFOL(fd,4) = account_id;
|
||||
for(p = 8; (sql_row = mysql_fetch_row(sql_res));p+=36){
|
||||
memcpy(WFIFOP(fd,p), sql_row[0], 32);
|
||||
WFIFOL(fd,p+32) = atoi(sql_row[1]);
|
||||
}
|
||||
WFIFOW(fd,2) = p;
|
||||
WFIFOSET(fd,p);
|
||||
#ifdef DEBUG
|
||||
printf("account_reg2 send : login->char (auth fifo)\n");
|
||||
#endif
|
||||
WFIFOW(fd,0) = 0x2713;
|
||||
WFIFOL(fd,2) = account_id;
|
||||
WFIFOB(fd,6) = 0;
|
||||
memcpy(WFIFOP(fd, 7), email, 40);
|
||||
WFIFOL(fd,47) = (unsigned long) connect_until_time;
|
||||
WFIFOSET(fd,51);
|
||||
}
|
||||
mysql_free_result(sql_res);
|
||||
}
|
||||
} else {
|
||||
WFIFOW(fd,0) = 0x2713;
|
||||
WFIFOL(fd,2) = account_id;
|
||||
WFIFOB(fd,6) = 1;
|
||||
WFIFOSET(fd,51);
|
||||
}
|
||||
RFIFOSKIP(fd,19);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------
|
||||
// Number of users in the world (connected char-server(s)) [Edit: Wizputer]
|
||||
//----------------------------------------------------------
|
||||
void number_world_users(int fd, int id) {
|
||||
#ifdef DEBUG
|
||||
if (server[id].users != RFIFOL(fd,2))
|
||||
printf("set number users %s : %d\n", server[id].name, RFIFOL(fd,2));
|
||||
#endif
|
||||
|
||||
server[id].users = RFIFOL(fd,2);
|
||||
if(anti_freeze_enable)
|
||||
server_freezeflag[id] = 5; // Char anti-freeze system. Counter. 5 ok, 4...0 freezed
|
||||
|
||||
sprintf(tmpsql,"UPDATE `sstatus` SET `user` = '%d' WHERE `index` = '%d'", server[id].users, id);
|
||||
sql_query(tmpsql,"number_world_users");
|
||||
|
||||
RFIFOSKIP(fd,6);
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Email and Time request from char-server [Edit: Wizputer]
|
||||
//-----------------------------------------
|
||||
void email_time_request(int fd, int id) {
|
||||
int account_id=RFIFOL(fd,2);
|
||||
time_t connect_until_time = 0;
|
||||
char email[40] = "";
|
||||
|
||||
sprintf(tmpsql,"SELECT `email`,`connect_until` FROM `%s` WHERE `%s`='%d'",login_db, login_db_account_id, account_id);
|
||||
sql_query(tmpsql,"email_time_request");
|
||||
|
||||
if ((sql_res = mysql_store_result(&mysql_handle))) {
|
||||
if((sql_row = mysql_fetch_row(sql_res))) {
|
||||
connect_until_time = atol(sql_row[1]);
|
||||
strcpy(email, sql_row[0]);
|
||||
}
|
||||
}
|
||||
mysql_free_result(sql_res);
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("parse_fromchar: E-mail/limited time request from '%s' server (concerned account: %d)\n", server[id].name, account_id);
|
||||
#endif
|
||||
|
||||
WFIFOW(fd,0) = 0x2717;
|
||||
WFIFOL(fd,2) = account_id;
|
||||
memcpy(WFIFOP(fd, 6), email, 40);
|
||||
WFIFOL(fd,46) = (unsigned long) connect_until_time;
|
||||
WFIFOSET(fd,50);
|
||||
|
||||
RFIFOSKIP(fd,6);
|
||||
}
|
||||
|
||||
//--------------------------------
|
||||
// Request to change email [Edit: Wizputer]
|
||||
//--------------------------------
|
||||
void change_account_email(int fd, int id, char ip[16]) {
|
||||
int acc = RFIFOL(fd,2);
|
||||
char actual_email[40], new_email[40];
|
||||
|
||||
memcpy(actual_email, RFIFOP(fd,6), 40);
|
||||
memcpy(new_email, RFIFOP(fd,46), 40);
|
||||
|
||||
if (e_mail_check(actual_email) == 0) {
|
||||
#ifdef DEBUG
|
||||
printf("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but actual email is invalid (account: %d, ip: %s)" RETCODE,
|
||||
server[id].name, acc, ip);
|
||||
#endif
|
||||
} else if (e_mail_check(new_email) == 0) {
|
||||
#ifdef DEBUG
|
||||
printf("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command) with a invalid new e-mail (account: %d, ip: %s)" RETCODE,
|
||||
server[id].name, acc, ip);
|
||||
#endif
|
||||
} else if (strcmpi(new_email, "athena@athena.com") == 0) {
|
||||
#ifdef DEBUG
|
||||
printf("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command) with a default e-mail (account: %d, ip: %s)" RETCODE,
|
||||
server[id].name, acc, ip);
|
||||
#endif
|
||||
} else {
|
||||
sprintf(tmpsql, "SELECT `%s`,`email` FROM `%s` WHERE `%s` = '%d'", login_db_userid, login_db, login_db_account_id, acc);
|
||||
sql_query(tmpsql,"change_account_email");
|
||||
|
||||
if ((sql_res = mysql_store_result(&mysql_handle))) {
|
||||
if((sql_row = mysql_fetch_row(sql_res))) { //row fetching
|
||||
if (strcmpi(sql_row[1], actual_email) == 0) {
|
||||
sprintf(tmpsql, "UPDATE `%s` SET `email` = '%s' WHERE `%s` = '%d'", login_db, new_email, login_db_account_id, acc);
|
||||
sql_query(tmpsql,"change_account_email");
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("Char-server '%s': Modify an e-mail on an account (@email GM command) (account: %d (%s), new e-mail: %s, ip: %s)." RETCODE,
|
||||
server[id].name, acc, sql_row[0], actual_email, ip);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
RFIFOSKIP(fd, 86);
|
||||
}
|
||||
|
||||
//-----------------------------------------------
|
||||
// State change request from map server (By Yor) [Edit: Wizputer]
|
||||
//-----------------------------------------------
|
||||
void status_change_request(int fd) {
|
||||
int acc = RFIFOL(fd,2), status = RFIFOL(fd,6);
|
||||
|
||||
sprintf(tmpsql, "SELECT `state` FROM `%s` WHERE `%s` = '%d'", login_db, login_db_account_id, acc);
|
||||
sql_query(tmpsql,"status_change_request");
|
||||
|
||||
if ((sql_res = mysql_store_result(&mysql_handle))) {
|
||||
if((sql_row = mysql_fetch_row(sql_res))) { // row fetching
|
||||
if (atoi(sql_row[0]) != status && status != 0) {
|
||||
unsigned char buf[16];
|
||||
WBUFW(buf,0) = 0x2731;
|
||||
WBUFL(buf,2) = acc;
|
||||
WBUFB(buf,6) = 0; // 0: change of statut, 1: ban
|
||||
WBUFL(buf,7) = status; // status or final date of a banishment
|
||||
charif_sendallwos(-1, buf, 11);
|
||||
}
|
||||
}
|
||||
|
||||
sprintf(tmpsql,"UPDATE `%s` SET `state` = '%d' WHERE `%s` = '%d'", login_db, status,login_db_account_id,acc);
|
||||
sql_query(tmpsql,"status_change_request");
|
||||
}
|
||||
|
||||
RFIFOSKIP(fd,10);
|
||||
}
|
||||
//--------------------------------------
|
||||
// Ban request from map-server (By Yor) [Edit: Wizputer]
|
||||
//--------------------------------------
|
||||
void ban_request(int fd) {
|
||||
int acc=RFIFOL(fd,2);
|
||||
struct tm *tmtime;
|
||||
time_t timestamp, tmptime;
|
||||
|
||||
sprintf(tmpsql, "SELECT `ban_until` FROM `%s` WHERE `%s` = '%d'",login_db,login_db_account_id,acc);
|
||||
sql_query(tmpsql,"ban_request");
|
||||
|
||||
if ((sql_res = mysql_store_result(&mysql_handle)) && (sql_row = mysql_fetch_row(sql_res))) {
|
||||
tmptime = atol(sql_row[0]);
|
||||
|
||||
if (tmptime == 0 || tmptime < time(NULL))
|
||||
timestamp = time(NULL);
|
||||
else
|
||||
timestamp = tmptime;
|
||||
|
||||
tmtime = localtime(×tamp);
|
||||
tmtime->tm_year = tmtime->tm_year + (short)RFIFOW(fd,6);
|
||||
tmtime->tm_mon = tmtime->tm_mon + (short)RFIFOW(fd,8);
|
||||
tmtime->tm_mday = tmtime->tm_mday + (short)RFIFOW(fd,10);
|
||||
tmtime->tm_hour = tmtime->tm_hour + (short)RFIFOW(fd,12);
|
||||
tmtime->tm_min = tmtime->tm_min + (short)RFIFOW(fd,14);
|
||||
tmtime->tm_sec = tmtime->tm_sec + (short)RFIFOW(fd,16);
|
||||
|
||||
timestamp = mktime(tmtime);
|
||||
|
||||
if (timestamp != -1) {
|
||||
if (timestamp <= time(NULL))
|
||||
timestamp = 0;
|
||||
if (tmptime != timestamp) {
|
||||
if (timestamp != 0) {
|
||||
unsigned char buf[16];
|
||||
WBUFW(buf,0) = 0x2731;
|
||||
WBUFL(buf,2) = acc;
|
||||
WBUFB(buf,6) = 1; // 0: change of statut, 1: ban
|
||||
WBUFL(buf,7) = timestamp; // status or final date of a banishment
|
||||
charif_sendallwos(-1, buf, 11);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
printf("Account: [%d] Banned until: [%ld]\n", acc, timestamp);
|
||||
#endif
|
||||
|
||||
sprintf(tmpsql, "UPDATE `%s` SET `ban_until` = '%ld', `state`='7' WHERE `%s` = '%d'", login_db, timestamp, login_db_account_id, acc);
|
||||
sql_query(tmpsql,"ban_request");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RFIFOSKIP(fd,18);
|
||||
}
|
||||
|
||||
//-----------------------------
|
||||
// Change sex [Edit: Wizputer]
|
||||
//-----------------------------
|
||||
void change_sex(int fd) {
|
||||
int sex,acc=RFIFOL(fd,4);
|
||||
unsigned char buf[16];
|
||||
|
||||
sprintf(tmpsql,"SELECT `sex` FROM `%s` WHERE `%s` = '%d'",login_db,login_db_account_id,acc);
|
||||
sql_query(tmpsql,"change_sex");
|
||||
|
||||
if ((sql_res = mysql_store_result(&mysql_handle)) && (sql_row = mysql_fetch_row(sql_res))) {
|
||||
if (strcmpi(sql_row[0], "M") == 0)
|
||||
sex = 1;
|
||||
else
|
||||
sex = 0;
|
||||
|
||||
sprintf(tmpsql,"UPDATE `%s` SET `sex` = '%c' WHERE `%s` = '%d'", login_db, (sex==0?'M':'F'), login_db_account_id, acc);
|
||||
sql_query(tmpsql,"change_sex");
|
||||
|
||||
WBUFW(buf,0) = 0x2723;
|
||||
WBUFL(buf,2) = acc;
|
||||
WBUFB(buf,6) = sex;
|
||||
charif_sendallwos(-1, buf, 7);
|
||||
}
|
||||
|
||||
RFIFOSKIP(fd,6);
|
||||
}
|
||||
|
||||
//-------------------------------
|
||||
// Save Account Reg [Edit: Wizputer]
|
||||
//-------------------------------
|
||||
void save_account_reg(int fd){
|
||||
int p,j,value,acc=RFIFOL(fd,4);
|
||||
char str[32];
|
||||
char temp_str[32];
|
||||
|
||||
if (acc>0){
|
||||
unsigned char buf[RFIFOW(fd,2)+1];
|
||||
for(p=8,j=0;p<RFIFOW(fd,2) && j<ACCOUNT_REG2_NUM;p+=36,j++){
|
||||
memcpy(str,RFIFOP(fd,p),32);
|
||||
value=RFIFOL(fd,p+32);
|
||||
|
||||
sprintf(tmpsql,"REPLACE INTO `global_reg_value` (`type`, `account_id`, `str`, `value`) VALUES ( 1 , '%d' , '%s' , '%d');", acc, jstrescapecpy(temp_str,str), value);
|
||||
sql_query(tmpsql,"save_account_reg");
|
||||
}
|
||||
|
||||
// Send to char
|
||||
memcpy(WBUFP(buf,0),RFIFOP(fd,0),RFIFOW(fd,2));
|
||||
WBUFW(buf,0)=0x2729;
|
||||
charif_sendallwos(fd,buf,WBUFW(buf,2));
|
||||
}
|
||||
|
||||
RFIFOSKIP(fd,RFIFOW(fd,2));
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("login: save account_reg (from char)\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
//------------------------------------------------
|
||||
// Recieve unban request from map-server (by Yor) [Edit: Wizputer]
|
||||
//------------------------------------------------
|
||||
void unban_request(int fd) {
|
||||
int acc = RFIFOL(fd,2);
|
||||
|
||||
sprintf(tmpsql,"UPDATE `%s` SET `ban_until` = '0', `state`='0' WHERE `%s` = '%d' AND `state`='6'", login_db,login_db_account_id,acc);
|
||||
sql_query(tmpsql,"unban_request");
|
||||
|
||||
RFIFOSKIP(fd,6);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
// char-server packet parse [Edit: Wizputer]
|
||||
//-----------------------------------------------------
|
||||
int parse_fromchar(int fd){
|
||||
int id;
|
||||
|
||||
unsigned char *p = (unsigned char *) &session[fd]->client_addr.sin_addr;
|
||||
char ip[16];
|
||||
|
||||
sprintf(ip, "%d.%d.%d.%d", p[0], p[1], p[2], p[3]);
|
||||
|
||||
for(id = 0; id < MAX_SERVERS && id < servers_connected; id++)
|
||||
if (server_fd[id] == fd)
|
||||
break;
|
||||
|
||||
if (id == MAX_SERVERS)
|
||||
session[fd]->eof = 1;
|
||||
|
||||
if(session[fd]->eof) {
|
||||
if (id < MAX_SERVERS) {
|
||||
printf("Char-server '%s' has disconnected.\n", server[id].name);
|
||||
server_fd[id] = -1;
|
||||
memset(&server[id], 0, sizeof(struct mmo_char_server));
|
||||
servers_connected--;
|
||||
// server delete
|
||||
sprintf(tmpsql, "DELETE FROM `sstatus` WHERE `index`='%d'", id);
|
||||
sql_query(tmpsql,"parse_fromchar");
|
||||
}
|
||||
close(fd);
|
||||
delete_session(fd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
while(RFIFOREST(fd) >= 2) {
|
||||
#ifdef DEBUG_PACKETS
|
||||
printf("char_parse: %d %d packet case=%x\n", fd, RFIFOREST(fd), RFIFOW(fd, 0));
|
||||
#endif
|
||||
|
||||
switch (RFIFOW(fd,0)) {
|
||||
case 0x2712:
|
||||
if (RFIFOREST(fd) < 19)
|
||||
return 0;
|
||||
send_account_reg(fd);
|
||||
break;
|
||||
|
||||
case 0x2714:
|
||||
if (RFIFOREST(fd) < 6)
|
||||
return 0;
|
||||
number_world_users(fd,id);
|
||||
break;
|
||||
|
||||
case 0x2716:
|
||||
if (RFIFOREST(fd) < 6)
|
||||
return 0;
|
||||
email_time_request(fd, id);
|
||||
break;
|
||||
|
||||
case 0x2722:
|
||||
if (RFIFOREST(fd) < 86)
|
||||
return 0;
|
||||
change_account_email(fd, id, ip);
|
||||
break;
|
||||
|
||||
case 0x2724:
|
||||
if (RFIFOREST(fd) < 10)
|
||||
return 0;
|
||||
status_change_request(fd);
|
||||
break;
|
||||
|
||||
case 0x2725:
|
||||
if (RFIFOREST(fd) < 18)
|
||||
return 0;
|
||||
ban_request(fd);
|
||||
break;
|
||||
|
||||
case 0x2727:
|
||||
if (RFIFOREST(fd) < 6)
|
||||
return 0;
|
||||
change_sex(fd);
|
||||
break;
|
||||
|
||||
case 0x2728:
|
||||
if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2))
|
||||
return 0;
|
||||
save_account_reg(fd);
|
||||
break;
|
||||
|
||||
case 0x272a:
|
||||
if (RFIFOREST(fd) < 6)
|
||||
return 0;
|
||||
unban_request(fd);
|
||||
return 0;
|
||||
|
||||
case 0x272b: // Set account_id to online [Wizputer]
|
||||
if (RFIFOREST(fd) < 6)
|
||||
return 0;
|
||||
add_online_user(RFIFOL(fd,2));
|
||||
RFIFOSKIP(fd,6);
|
||||
break;
|
||||
|
||||
case 0x272c: // Set account_id to offline [Wizputer]
|
||||
if (RFIFOREST(fd) < 6)
|
||||
return 0;
|
||||
remove_online_user(RFIFOL(fd,2));
|
||||
RFIFOSKIP(fd,6);
|
||||
break;
|
||||
|
||||
default:
|
||||
#ifdef DEBUG
|
||||
printf("login: unknown packet %x! (from char).\n", RFIFOW(fd,0));
|
||||
#endif
|
||||
session[fd]->eof = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,2 +1,2 @@
|
||||
int char_anti_freeze_system(int, unsigned int, int, int);
|
||||
int parse_fromchar(int);
|
||||
int char_anti_freeze_system(int, unsigned int, int, int);
|
||||
int parse_fromchar(int);
|
||||
|
@ -1,370 +1,370 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <signal.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "login.h"
|
||||
#include "char_int.h"
|
||||
|
||||
//----------------------
|
||||
// Client requesting login [Edit: Wizputer]
|
||||
//----------------------
|
||||
void client_request_login(int fd,unsigned char *p ) {
|
||||
struct mmo_account account;
|
||||
char t_uid[32];
|
||||
int server_num = 0,result,i;
|
||||
|
||||
if( !servers_connected) {
|
||||
WFIFOW(fd,0) = 0x81;
|
||||
WFIFOL(fd,2) = 1; // 01 = Server closed
|
||||
WFIFOSET(fd,3);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("client connection request %s from %d.%d.%d.%d\n", RFIFOP(fd, 6), p[0], p[1], p[2], p[3]);
|
||||
#endif
|
||||
|
||||
account.userid = RFIFOP(fd, 6);
|
||||
account.passwd = RFIFOP(fd, 30);
|
||||
#ifdef PASSWORDENC
|
||||
account.passwdenc= (RFIFOW(fd,0)==0x64)?0:PASSWORDENC;
|
||||
#else
|
||||
account.passwdenc=0;
|
||||
#endif
|
||||
result=mmo_auth(&account, fd);
|
||||
|
||||
jstrescapecpy(t_uid,RFIFOP(fd, 6));
|
||||
if(result==-1){
|
||||
unsigned char gm_level = isGM(account.account_id);
|
||||
if (min_level_to_connect > gm_level || !servers_connected) {
|
||||
WFIFOW(fd,0) = 0x81;
|
||||
WFIFOL(fd,2) = 1; // 01 = Server closed
|
||||
WFIFOSET(fd,3);
|
||||
} else {
|
||||
if (p[0] != 127) {
|
||||
sprintf(tmpsql,"INSERT DELAYED INTO `%s`(`time`,`ip`,`user`,`rcode`,`log`) VALUES (NOW(), '%d.%d.%d.%d', '%s','100', 'login ok')", loginlog_db, p[0], p[1], p[2], p[3], t_uid);
|
||||
sql_query(tmpsql,"client_request_login");
|
||||
}
|
||||
|
||||
if (gm_level) {
|
||||
#ifdef DEBUG
|
||||
printf("Connection of the GM (level:%d) account '%s' accepted.\n", gm_level, account.userid);
|
||||
#endif
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
printf("Connection of the account '%s' accepted.\n", account.userid);
|
||||
#endif
|
||||
}
|
||||
|
||||
for(i = 0; i < MAX_SERVERS || server_num < servers_connected ; i++)
|
||||
if (server_fd[i] >= 0) {
|
||||
//Lan check added by Kashy
|
||||
if (lan_ip_check(p))
|
||||
WFIFOL(fd,47+server_num*32) = inet_addr(lan_char_ip);
|
||||
else
|
||||
WFIFOL(fd,47+server_num*32) = server[i].ip;
|
||||
|
||||
WFIFOW(fd,47+server_num*32+4) = server[i].port;
|
||||
memcpy(WFIFOP(fd,47+server_num*32+6), server[i].name, 20);
|
||||
WFIFOW(fd,47+server_num*32+26) = server[i].users;
|
||||
WFIFOW(fd,47+server_num*32+28) = server[i].maintenance;
|
||||
WFIFOW(fd,47+server_num*32+30) = server[i].new;
|
||||
server_num++;
|
||||
}
|
||||
|
||||
WFIFOW(fd,0)=0x69;
|
||||
WFIFOW(fd,2)=47+32*server_num;
|
||||
WFIFOL(fd,4)=account.login_id1;
|
||||
WFIFOL(fd,8)=account.account_id;
|
||||
WFIFOL(fd,12)=account.login_id2;
|
||||
WFIFOL(fd,16)=0;
|
||||
memcpy(WFIFOP(fd,20),account.lastlogin,24);
|
||||
WFIFOB(fd,46)=account.sex;
|
||||
WFIFOSET(fd,47+32*server_num);
|
||||
|
||||
if(auth_fifo_pos>=AUTH_FIFO_SIZE)
|
||||
auth_fifo_pos=0;
|
||||
|
||||
auth_fifo[auth_fifo_pos].account_id=account.account_id;
|
||||
auth_fifo[auth_fifo_pos].login_id1=account.login_id1;
|
||||
auth_fifo[auth_fifo_pos].login_id2=account.login_id2;
|
||||
auth_fifo[auth_fifo_pos].sex=account.sex;
|
||||
auth_fifo[auth_fifo_pos].delflag=0;
|
||||
auth_fifo[auth_fifo_pos].ip = session[fd]->client_addr.sin_addr.s_addr;
|
||||
auth_fifo_pos++;
|
||||
}
|
||||
} else {
|
||||
char error[32];
|
||||
|
||||
sprintf(tmpsql,"SELECT `error` FROM `errors` WHERE `result`='%d'",result);
|
||||
sql_query(tmpsql,"client_request_login");
|
||||
|
||||
if ((sql_res = mysql_store_result(&mysql_handle))) {
|
||||
if ((sql_row = mysql_fetch_row(sql_res))) {
|
||||
sprintf(error,sql_row[0]);
|
||||
} else {
|
||||
sprintf(error,"No Error!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sprintf(tmpsql,"INSERT DELAYED INTO `%s`(`time`,`ip`,`user`,`rcode`,`log`) VALUES (NOW(), '%d.%d.%d.%d', '%s', '%d','login failed : %s')", loginlog_db, p[0], p[1], p[2], p[3], t_uid, result, error);
|
||||
|
||||
|
||||
sql_query(tmpsql,"client_request_login");
|
||||
|
||||
if ((result == 1) && (dynamic_pass_failure_ban != 0)){ // failed password
|
||||
sprintf(tmpsql,"SELECT count(*) FROM `%s` WHERE `ip` = '%d.%d.%d.%d' AND `rcode` = '1' AND `time` > NOW() - INTERVAL %d MINUTE",
|
||||
loginlog_db, p[0], p[1], p[2], p[3], dynamic_pass_failure_ban_time); //how many times filed account? in one ip.
|
||||
sql_query(tmpsql,"client_request_login");
|
||||
|
||||
if ((sql_res = mysql_store_result(&mysql_handle))) {
|
||||
if ((sql_row = mysql_fetch_row(sql_res))) {
|
||||
if (atoi(sql_row[0]) >= dynamic_pass_failure_ban_how_many ) {
|
||||
sprintf(tmpsql,"INSERT INTO `ipbanlist`(`list`,`btime`,`rtime`,`reason`) VALUES ('%d.%d.%d.*', NOW() , NOW() + INTERVAL %d MINUTE ,'Password error ban: %s')", p[0], p[1], p[2], dynamic_pass_failure_ban_how_long, t_uid);
|
||||
sql_query(tmpsql,"client_request_login");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
mysql_free_result(sql_res);
|
||||
|
||||
}
|
||||
|
||||
//cannot connect login failed
|
||||
memset(WFIFOP(fd,0),'\0',23);
|
||||
WFIFOW(fd,0)=0x6a;
|
||||
WFIFOB(fd,2)=result-1;
|
||||
if (result == 6) { // 6 = Your are Prohibited to log in until %s
|
||||
char tmpstr[256];
|
||||
strftime(tmpstr, 20, date_format, localtime(&account.ban_until_time));
|
||||
tmpstr[19] = '\0';
|
||||
memcpy(WFIFOP(fd,3), tmpstr, 20);
|
||||
} else { // we send error message
|
||||
memcpy(WFIFOP(fd,3), error, 20);
|
||||
}
|
||||
}
|
||||
|
||||
WFIFOSET(fd,23);
|
||||
|
||||
RFIFOSKIP(fd,(RFIFOW(fd,0)==0x64)?55:47);
|
||||
}
|
||||
|
||||
//------------------------------------------------------
|
||||
// MD5 Key requested for encypted login [Edit: Wizputer
|
||||
//------------------------------------------------------
|
||||
void md5_key_request(int fd) {
|
||||
#ifdef DEBUG
|
||||
printf("Request Password key -%s\n",md5key);
|
||||
#endif
|
||||
|
||||
RFIFOSKIP(fd,2);
|
||||
WFIFOW(fd,0)=0x01dc;
|
||||
WFIFOW(fd,2)=4+md5keylen;
|
||||
memcpy(WFIFOP(fd,4),md5key,md5keylen);
|
||||
WFIFOSET(fd,WFIFOW(fd,2));
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
// Char-server requesting connection [Edit: Wizputer]
|
||||
//-----------------------------------------------------
|
||||
void char_request_login(int fd, unsigned char *p) {
|
||||
struct mmo_account account;
|
||||
unsigned char* server_name;
|
||||
char t_uid[32];
|
||||
int result;
|
||||
|
||||
sprintf(tmpsql,"INSERT DELAYED INTO `%s`(`time`,`ip`,`user`,`rcode`,`log`) VALUES (NOW(), '%d.%d.%d.%d', '%s@%s','100', 'charserver - %s@%d.%d.%d.%d:%d')", loginlog_db, p[0], p[1], p[2], p[3], RFIFOP(fd, 2),RFIFOP(fd, 60),RFIFOP(fd, 60), RFIFOB(fd, 54), RFIFOB(fd, 55), RFIFOB(fd, 56), RFIFOB(fd, 57), RFIFOW(fd, 58));
|
||||
sql_query(tmpsql,"char_request_login");
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("server connection request %s @ %d.%d.%d.%d:%d (%d.%d.%d.%d)\n",
|
||||
RFIFOP(fd, 60), RFIFOB(fd, 54), RFIFOB(fd, 55), RFIFOB(fd, 56), RFIFOB(fd, 57), RFIFOW(fd, 58),
|
||||
p[0], p[1], p[2], p[3]);
|
||||
#endif
|
||||
|
||||
account.userid = RFIFOP(fd, 2);
|
||||
account.passwd = RFIFOP(fd, 26);
|
||||
account.passwdenc = 0;
|
||||
server_name = RFIFOP(fd,60);
|
||||
result = mmo_auth(&account, fd);
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("Result: %d - Sex: %d - Account ID: %d\n",result,account.sex,(int) account.account_id);
|
||||
#endif
|
||||
|
||||
if(result == -1 && account.sex==2 && account.account_id<MAX_SERVERS && server_fd[account.account_id]==-1){
|
||||
printf("Connection of the char-server '%s' accepted.\n", server_name);
|
||||
|
||||
memset(&server[account.account_id], 0, sizeof(struct mmo_char_server));
|
||||
|
||||
server[account.account_id].ip=RFIFOL(fd,54);
|
||||
server[account.account_id].port=RFIFOW(fd,58);
|
||||
memcpy(server[account.account_id].name,RFIFOP(fd,60),20);
|
||||
server[account.account_id].users=0;
|
||||
server[account.account_id].maintenance=RFIFOW(fd,82);
|
||||
server[account.account_id].new=RFIFOW(fd,84);
|
||||
server_fd[account.account_id]=fd;
|
||||
|
||||
if(anti_freeze_enable)
|
||||
server_freezeflag[account.account_id] = 5; // Char-server anti-freeze system. Counter. 5 ok, 4...0 freezed
|
||||
|
||||
jstrescapecpy(t_uid,server[account.account_id].name);
|
||||
|
||||
sprintf(tmpsql,"REPLACE DELAYED INTO `sstatus`(`index`,`name`,`user`) VALUES ( '%ld', '%s', '%d')",
|
||||
account.account_id, server[account.account_id].name,0);
|
||||
sql_query(tmpsql,"char_request_login");
|
||||
|
||||
WFIFOW(fd,0)=0x2711;
|
||||
WFIFOB(fd,2)=0;
|
||||
WFIFOSET(fd,3);
|
||||
session[fd]->func_parse=parse_fromchar;
|
||||
realloc_fifo(fd,FIFOSIZE_SERVERLINK,FIFOSIZE_SERVERLINK);
|
||||
|
||||
servers_connected++;
|
||||
} else {
|
||||
WFIFOW(fd, 0) =0x2711;
|
||||
WFIFOB(fd, 2)=3;
|
||||
WFIFOSET(fd, 3);
|
||||
}
|
||||
|
||||
RFIFOSKIP(fd, 86);
|
||||
}
|
||||
|
||||
//---------------------------------------------
|
||||
// Athena Version Info Request [Edit: Wizputer]
|
||||
//---------------------------------------------
|
||||
void request_athena_info(int fd) {
|
||||
#ifdef DEBUG
|
||||
printf ("Athena version check...\n");
|
||||
#endif
|
||||
|
||||
WFIFOW(fd,0)=0x7531;
|
||||
WFIFOB(fd,2)=ATHENA_MAJOR_VERSION;
|
||||
WFIFOB(fd,3)=ATHENA_MINOR_VERSION;
|
||||
WFIFOB(fd,4)=ATHENA_REVISION;
|
||||
WFIFOB(fd,5)=ATHENA_RELEASE_FLAG;
|
||||
WFIFOB(fd,6)=ATHENA_OFFICIAL_FLAG;
|
||||
WFIFOB(fd,7)=ATHENA_SERVER_LOGIN;
|
||||
WFIFOW(fd,8)=ATHENA_MOD_VERSION;
|
||||
WFIFOSET(fd,10);
|
||||
RFIFOSKIP(fd,2);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
// Default packet parsing (normal players or administation/char-server connection requests)
|
||||
//----------------------------------------------------------------------------------------
|
||||
int parse_login(int fd) {
|
||||
char ip[16];
|
||||
|
||||
unsigned char *p = (unsigned char *) &session[fd]->client_addr.sin_addr;
|
||||
sprintf(ip, "%d.%d.%d.%d", p[0], p[1], p[2], p[3]);
|
||||
|
||||
if (ipban > 0) {
|
||||
//ip ban
|
||||
//p[0], p[1], p[2], p[3]
|
||||
//request DB connection
|
||||
//check
|
||||
sprintf(tmpsql, "SELECT count(*) FROM `ipbanlist` WHERE `list` = '%d.*.*.*' OR `list` = '%d.%d.*.*' OR `list` = '%d.%d.%d.*' OR `list` = '%d.%d.%d.%d'",
|
||||
p[0], p[0], p[1], p[0], p[1], p[2], p[0], p[1], p[2], p[3]);
|
||||
sql_query(tmpsql,"parse_login");
|
||||
|
||||
if((sql_res = mysql_store_result(&mysql_handle))) {
|
||||
if((sql_row = mysql_fetch_row(sql_res))) {//row fetching
|
||||
if (atoi(sql_row[0]) >0) {
|
||||
// ip ban ok.
|
||||
printf ("packet from banned ip : %d.%d.%d.%d" RETCODE, p[0], p[1], p[2], p[3]);
|
||||
|
||||
sprintf(tmpsql,"INSERT DELAYED INTO `%s`(`time`,`ip`,`user`,`rcode`,`log`) VALUES (NOW(), '%d.%d.%d.%d', 'unknown','-3', 'ip banned')", loginlog_db, p[0], p[1], p[2], p[3]);
|
||||
sql_query(tmpsql,"parse_login");
|
||||
|
||||
#ifdef DEBUG
|
||||
printf ("close session connection...\n");
|
||||
#endif
|
||||
|
||||
// close connection
|
||||
session[fd]->eof = 1;
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
printf ("packet from ip (ban check ok) : %d.%d.%d.%d" RETCODE, p[0], p[1], p[2], p[3]);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mysql_free_result(sql_res);
|
||||
}
|
||||
|
||||
if (session[fd]->eof) {
|
||||
int i;
|
||||
for(i = 0; i < MAX_SERVERS && i < servers_connected; i++)
|
||||
if (server_fd[i] == fd) {
|
||||
server_fd[i] = -1;
|
||||
servers_connected--;
|
||||
}
|
||||
close(fd);
|
||||
delete_session(fd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
while(RFIFOREST(fd)>=2){
|
||||
#ifdef DEBUG_PACKETS
|
||||
printf("parse_login : %d %d packet case=%x\n", fd, RFIFOREST(fd), RFIFOW(fd,0));
|
||||
#endif
|
||||
|
||||
switch(RFIFOW(fd,0)){
|
||||
case 0x200: // New alive packet: structure: 0x200 <account.userid>.24B. used to verify if client is always alive.
|
||||
if (RFIFOREST(fd) < 26)
|
||||
return 0;
|
||||
RFIFOSKIP(fd,26);
|
||||
break;
|
||||
|
||||
case 0x204: // New alive packet: structure: 0x204 <encrypted.account.userid>.16B. (new ragexe from 22 june 2004)
|
||||
if (RFIFOREST(fd) < 18)
|
||||
return 0;
|
||||
RFIFOSKIP(fd,18);
|
||||
break;
|
||||
|
||||
case 0x64:
|
||||
case 0x01dd:
|
||||
if(RFIFOREST(fd)< ((RFIFOW(fd, 0) ==0x64)?55:47))
|
||||
return 0;
|
||||
client_request_login(fd, p);
|
||||
break;
|
||||
case 0x01db:
|
||||
if (session[fd]->session_data) {
|
||||
#ifdef DEBUG
|
||||
printf("login: abnormal request of MD5 key (already opened session).\n");
|
||||
#endif
|
||||
session[fd]->eof = 1;
|
||||
return 0;
|
||||
}
|
||||
md5_key_request(fd);
|
||||
break;
|
||||
|
||||
case 0x2710:
|
||||
if(RFIFOREST(fd)<86)
|
||||
return 0;
|
||||
char_request_login(fd,p);
|
||||
break;
|
||||
|
||||
case 0x7530:
|
||||
request_athena_info(fd);
|
||||
break;
|
||||
|
||||
case 0x7532:
|
||||
default:
|
||||
#ifdef DEBUG
|
||||
printf ("End of connection (ip: %s)" RETCODE, ip);
|
||||
#endif
|
||||
session[fd]->eof = 1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <signal.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "login.h"
|
||||
#include "char_int.h"
|
||||
|
||||
//----------------------
|
||||
// Client requesting login [Edit: Wizputer]
|
||||
//----------------------
|
||||
void client_request_login(int fd,unsigned char *p ) {
|
||||
struct mmo_account account;
|
||||
char t_uid[32];
|
||||
int server_num = 0,result,i;
|
||||
|
||||
if( !servers_connected) {
|
||||
WFIFOW(fd,0) = 0x81;
|
||||
WFIFOL(fd,2) = 1; // 01 = Server closed
|
||||
WFIFOSET(fd,3);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("client connection request %s from %d.%d.%d.%d\n", RFIFOP(fd, 6), p[0], p[1], p[2], p[3]);
|
||||
#endif
|
||||
|
||||
account.userid = RFIFOP(fd, 6);
|
||||
account.passwd = RFIFOP(fd, 30);
|
||||
#ifdef PASSWORDENC
|
||||
account.passwdenc= (RFIFOW(fd,0)==0x64)?0:PASSWORDENC;
|
||||
#else
|
||||
account.passwdenc=0;
|
||||
#endif
|
||||
result=mmo_auth(&account, fd);
|
||||
|
||||
jstrescapecpy(t_uid,RFIFOP(fd, 6));
|
||||
if(result==-1){
|
||||
unsigned char gm_level = isGM(account.account_id);
|
||||
if (min_level_to_connect > gm_level || !servers_connected) {
|
||||
WFIFOW(fd,0) = 0x81;
|
||||
WFIFOL(fd,2) = 1; // 01 = Server closed
|
||||
WFIFOSET(fd,3);
|
||||
} else {
|
||||
if (p[0] != 127) {
|
||||
sprintf(tmpsql,"INSERT DELAYED INTO `%s`(`time`,`ip`,`user`,`rcode`,`log`) VALUES (NOW(), '%d.%d.%d.%d', '%s','100', 'login ok')", loginlog_db, p[0], p[1], p[2], p[3], t_uid);
|
||||
sql_query(tmpsql,"client_request_login");
|
||||
}
|
||||
|
||||
if (gm_level) {
|
||||
#ifdef DEBUG
|
||||
printf("Connection of the GM (level:%d) account '%s' accepted.\n", gm_level, account.userid);
|
||||
#endif
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
printf("Connection of the account '%s' accepted.\n", account.userid);
|
||||
#endif
|
||||
}
|
||||
|
||||
for(i = 0; i < MAX_SERVERS || server_num < servers_connected ; i++)
|
||||
if (server_fd[i] >= 0) {
|
||||
//Lan check added by Kashy
|
||||
if (lan_ip_check(p))
|
||||
WFIFOL(fd,47+server_num*32) = inet_addr(lan_char_ip);
|
||||
else
|
||||
WFIFOL(fd,47+server_num*32) = server[i].ip;
|
||||
|
||||
WFIFOW(fd,47+server_num*32+4) = server[i].port;
|
||||
memcpy(WFIFOP(fd,47+server_num*32+6), server[i].name, 20);
|
||||
WFIFOW(fd,47+server_num*32+26) = server[i].users;
|
||||
WFIFOW(fd,47+server_num*32+28) = server[i].maintenance;
|
||||
WFIFOW(fd,47+server_num*32+30) = server[i].new;
|
||||
server_num++;
|
||||
}
|
||||
|
||||
WFIFOW(fd,0)=0x69;
|
||||
WFIFOW(fd,2)=47+32*server_num;
|
||||
WFIFOL(fd,4)=account.login_id1;
|
||||
WFIFOL(fd,8)=account.account_id;
|
||||
WFIFOL(fd,12)=account.login_id2;
|
||||
WFIFOL(fd,16)=0;
|
||||
memcpy(WFIFOP(fd,20),account.lastlogin,24);
|
||||
WFIFOB(fd,46)=account.sex;
|
||||
WFIFOSET(fd,47+32*server_num);
|
||||
|
||||
if(auth_fifo_pos>=AUTH_FIFO_SIZE)
|
||||
auth_fifo_pos=0;
|
||||
|
||||
auth_fifo[auth_fifo_pos].account_id=account.account_id;
|
||||
auth_fifo[auth_fifo_pos].login_id1=account.login_id1;
|
||||
auth_fifo[auth_fifo_pos].login_id2=account.login_id2;
|
||||
auth_fifo[auth_fifo_pos].sex=account.sex;
|
||||
auth_fifo[auth_fifo_pos].delflag=0;
|
||||
auth_fifo[auth_fifo_pos].ip = session[fd]->client_addr.sin_addr.s_addr;
|
||||
auth_fifo_pos++;
|
||||
}
|
||||
} else {
|
||||
char error[32];
|
||||
|
||||
sprintf(tmpsql,"SELECT `error` FROM `errors` WHERE `result`='%d'",result);
|
||||
sql_query(tmpsql,"client_request_login");
|
||||
|
||||
if ((sql_res = mysql_store_result(&mysql_handle))) {
|
||||
if ((sql_row = mysql_fetch_row(sql_res))) {
|
||||
sprintf(error,sql_row[0]);
|
||||
} else {
|
||||
sprintf(error,"No Error!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sprintf(tmpsql,"INSERT DELAYED INTO `%s`(`time`,`ip`,`user`,`rcode`,`log`) VALUES (NOW(), '%d.%d.%d.%d', '%s', '%d','login failed : %s')", loginlog_db, p[0], p[1], p[2], p[3], t_uid, result, error);
|
||||
|
||||
|
||||
sql_query(tmpsql,"client_request_login");
|
||||
|
||||
if ((result == 1) && (dynamic_pass_failure_ban != 0)){ // failed password
|
||||
sprintf(tmpsql,"SELECT count(*) FROM `%s` WHERE `ip` = '%d.%d.%d.%d' AND `rcode` = '1' AND `time` > NOW() - INTERVAL %d MINUTE",
|
||||
loginlog_db, p[0], p[1], p[2], p[3], dynamic_pass_failure_ban_time); //how many times filed account? in one ip.
|
||||
sql_query(tmpsql,"client_request_login");
|
||||
|
||||
if ((sql_res = mysql_store_result(&mysql_handle))) {
|
||||
if ((sql_row = mysql_fetch_row(sql_res))) {
|
||||
if (atoi(sql_row[0]) >= dynamic_pass_failure_ban_how_many ) {
|
||||
sprintf(tmpsql,"INSERT INTO `ipbanlist`(`list`,`btime`,`rtime`,`reason`) VALUES ('%d.%d.%d.*', NOW() , NOW() + INTERVAL %d MINUTE ,'Password error ban: %s')", p[0], p[1], p[2], dynamic_pass_failure_ban_how_long, t_uid);
|
||||
sql_query(tmpsql,"client_request_login");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
mysql_free_result(sql_res);
|
||||
|
||||
}
|
||||
|
||||
//cannot connect login failed
|
||||
memset(WFIFOP(fd,0),'\0',23);
|
||||
WFIFOW(fd,0)=0x6a;
|
||||
WFIFOB(fd,2)=result-1;
|
||||
if (result == 6) { // 6 = Your are Prohibited to log in until %s
|
||||
char tmpstr[256];
|
||||
strftime(tmpstr, 20, date_format, localtime(&account.ban_until_time));
|
||||
tmpstr[19] = '\0';
|
||||
memcpy(WFIFOP(fd,3), tmpstr, 20);
|
||||
} else { // we send error message
|
||||
memcpy(WFIFOP(fd,3), error, 20);
|
||||
}
|
||||
}
|
||||
|
||||
WFIFOSET(fd,23);
|
||||
|
||||
RFIFOSKIP(fd,(RFIFOW(fd,0)==0x64)?55:47);
|
||||
}
|
||||
|
||||
//------------------------------------------------------
|
||||
// MD5 Key requested for encypted login [Edit: Wizputer
|
||||
//------------------------------------------------------
|
||||
void md5_key_request(int fd) {
|
||||
#ifdef DEBUG
|
||||
printf("Request Password key -%s\n",md5key);
|
||||
#endif
|
||||
|
||||
RFIFOSKIP(fd,2);
|
||||
WFIFOW(fd,0)=0x01dc;
|
||||
WFIFOW(fd,2)=4+md5keylen;
|
||||
memcpy(WFIFOP(fd,4),md5key,md5keylen);
|
||||
WFIFOSET(fd,WFIFOW(fd,2));
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
// Char-server requesting connection [Edit: Wizputer]
|
||||
//-----------------------------------------------------
|
||||
void char_request_login(int fd, unsigned char *p) {
|
||||
struct mmo_account account;
|
||||
unsigned char* server_name;
|
||||
char t_uid[32];
|
||||
int result;
|
||||
|
||||
sprintf(tmpsql,"INSERT DELAYED INTO `%s`(`time`,`ip`,`user`,`rcode`,`log`) VALUES (NOW(), '%d.%d.%d.%d', '%s@%s','100', 'charserver - %s@%d.%d.%d.%d:%d')", loginlog_db, p[0], p[1], p[2], p[3], RFIFOP(fd, 2),RFIFOP(fd, 60),RFIFOP(fd, 60), RFIFOB(fd, 54), RFIFOB(fd, 55), RFIFOB(fd, 56), RFIFOB(fd, 57), RFIFOW(fd, 58));
|
||||
sql_query(tmpsql,"char_request_login");
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("server connection request %s @ %d.%d.%d.%d:%d (%d.%d.%d.%d)\n",
|
||||
RFIFOP(fd, 60), RFIFOB(fd, 54), RFIFOB(fd, 55), RFIFOB(fd, 56), RFIFOB(fd, 57), RFIFOW(fd, 58),
|
||||
p[0], p[1], p[2], p[3]);
|
||||
#endif
|
||||
|
||||
account.userid = RFIFOP(fd, 2);
|
||||
account.passwd = RFIFOP(fd, 26);
|
||||
account.passwdenc = 0;
|
||||
server_name = RFIFOP(fd,60);
|
||||
result = mmo_auth(&account, fd);
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("Result: %d - Sex: %d - Account ID: %d\n",result,account.sex,(int) account.account_id);
|
||||
#endif
|
||||
|
||||
if(result == -1 && account.sex==2 && account.account_id<MAX_SERVERS && server_fd[account.account_id]==-1){
|
||||
printf("Connection of the char-server '%s' accepted.\n", server_name);
|
||||
|
||||
memset(&server[account.account_id], 0, sizeof(struct mmo_char_server));
|
||||
|
||||
server[account.account_id].ip=RFIFOL(fd,54);
|
||||
server[account.account_id].port=RFIFOW(fd,58);
|
||||
memcpy(server[account.account_id].name,RFIFOP(fd,60),20);
|
||||
server[account.account_id].users=0;
|
||||
server[account.account_id].maintenance=RFIFOW(fd,82);
|
||||
server[account.account_id].new=RFIFOW(fd,84);
|
||||
server_fd[account.account_id]=fd;
|
||||
|
||||
if(anti_freeze_enable)
|
||||
server_freezeflag[account.account_id] = 5; // Char-server anti-freeze system. Counter. 5 ok, 4...0 freezed
|
||||
|
||||
jstrescapecpy(t_uid,server[account.account_id].name);
|
||||
|
||||
sprintf(tmpsql,"REPLACE DELAYED INTO `sstatus`(`index`,`name`,`user`) VALUES ( '%ld', '%s', '%d')",
|
||||
account.account_id, server[account.account_id].name,0);
|
||||
sql_query(tmpsql,"char_request_login");
|
||||
|
||||
WFIFOW(fd,0)=0x2711;
|
||||
WFIFOB(fd,2)=0;
|
||||
WFIFOSET(fd,3);
|
||||
session[fd]->func_parse=parse_fromchar;
|
||||
realloc_fifo(fd,FIFOSIZE_SERVERLINK,FIFOSIZE_SERVERLINK);
|
||||
|
||||
servers_connected++;
|
||||
} else {
|
||||
WFIFOW(fd, 0) =0x2711;
|
||||
WFIFOB(fd, 2)=3;
|
||||
WFIFOSET(fd, 3);
|
||||
}
|
||||
|
||||
RFIFOSKIP(fd, 86);
|
||||
}
|
||||
|
||||
//---------------------------------------------
|
||||
// Athena Version Info Request [Edit: Wizputer]
|
||||
//---------------------------------------------
|
||||
void request_athena_info(int fd) {
|
||||
#ifdef DEBUG
|
||||
printf ("Athena version check...\n");
|
||||
#endif
|
||||
|
||||
WFIFOW(fd,0)=0x7531;
|
||||
WFIFOB(fd,2)=ATHENA_MAJOR_VERSION;
|
||||
WFIFOB(fd,3)=ATHENA_MINOR_VERSION;
|
||||
WFIFOB(fd,4)=ATHENA_REVISION;
|
||||
WFIFOB(fd,5)=ATHENA_RELEASE_FLAG;
|
||||
WFIFOB(fd,6)=ATHENA_OFFICIAL_FLAG;
|
||||
WFIFOB(fd,7)=ATHENA_SERVER_LOGIN;
|
||||
WFIFOW(fd,8)=ATHENA_MOD_VERSION;
|
||||
WFIFOSET(fd,10);
|
||||
RFIFOSKIP(fd,2);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
// Default packet parsing (normal players or administation/char-server connection requests)
|
||||
//----------------------------------------------------------------------------------------
|
||||
int parse_login(int fd) {
|
||||
char ip[16];
|
||||
|
||||
unsigned char *p = (unsigned char *) &session[fd]->client_addr.sin_addr;
|
||||
sprintf(ip, "%d.%d.%d.%d", p[0], p[1], p[2], p[3]);
|
||||
|
||||
if (ipban > 0) {
|
||||
//ip ban
|
||||
//p[0], p[1], p[2], p[3]
|
||||
//request DB connection
|
||||
//check
|
||||
sprintf(tmpsql, "SELECT count(*) FROM `ipbanlist` WHERE `list` = '%d.*.*.*' OR `list` = '%d.%d.*.*' OR `list` = '%d.%d.%d.*' OR `list` = '%d.%d.%d.%d'",
|
||||
p[0], p[0], p[1], p[0], p[1], p[2], p[0], p[1], p[2], p[3]);
|
||||
sql_query(tmpsql,"parse_login");
|
||||
|
||||
if((sql_res = mysql_store_result(&mysql_handle))) {
|
||||
if((sql_row = mysql_fetch_row(sql_res))) {//row fetching
|
||||
if (atoi(sql_row[0]) >0) {
|
||||
// ip ban ok.
|
||||
printf ("packet from banned ip : %d.%d.%d.%d" RETCODE, p[0], p[1], p[2], p[3]);
|
||||
|
||||
sprintf(tmpsql,"INSERT DELAYED INTO `%s`(`time`,`ip`,`user`,`rcode`,`log`) VALUES (NOW(), '%d.%d.%d.%d', 'unknown','-3', 'ip banned')", loginlog_db, p[0], p[1], p[2], p[3]);
|
||||
sql_query(tmpsql,"parse_login");
|
||||
|
||||
#ifdef DEBUG
|
||||
printf ("close session connection...\n");
|
||||
#endif
|
||||
|
||||
// close connection
|
||||
session[fd]->eof = 1;
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
printf ("packet from ip (ban check ok) : %d.%d.%d.%d" RETCODE, p[0], p[1], p[2], p[3]);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mysql_free_result(sql_res);
|
||||
}
|
||||
|
||||
if (session[fd]->eof) {
|
||||
int i;
|
||||
for(i = 0; i < MAX_SERVERS && i < servers_connected; i++)
|
||||
if (server_fd[i] == fd) {
|
||||
server_fd[i] = -1;
|
||||
servers_connected--;
|
||||
}
|
||||
close(fd);
|
||||
delete_session(fd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
while(RFIFOREST(fd)>=2){
|
||||
#ifdef DEBUG_PACKETS
|
||||
printf("parse_login : %d %d packet case=%x\n", fd, RFIFOREST(fd), RFIFOW(fd,0));
|
||||
#endif
|
||||
|
||||
switch(RFIFOW(fd,0)){
|
||||
case 0x200: // New alive packet: structure: 0x200 <account.userid>.24B. used to verify if client is always alive.
|
||||
if (RFIFOREST(fd) < 26)
|
||||
return 0;
|
||||
RFIFOSKIP(fd,26);
|
||||
break;
|
||||
|
||||
case 0x204: // New alive packet: structure: 0x204 <encrypted.account.userid>.16B. (new ragexe from 22 june 2004)
|
||||
if (RFIFOREST(fd) < 18)
|
||||
return 0;
|
||||
RFIFOSKIP(fd,18);
|
||||
break;
|
||||
|
||||
case 0x64:
|
||||
case 0x01dd:
|
||||
if(RFIFOREST(fd)< ((RFIFOW(fd, 0) ==0x64)?55:47))
|
||||
return 0;
|
||||
client_request_login(fd, p);
|
||||
break;
|
||||
case 0x01db:
|
||||
if (session[fd]->session_data) {
|
||||
#ifdef DEBUG
|
||||
printf("login: abnormal request of MD5 key (already opened session).\n");
|
||||
#endif
|
||||
session[fd]->eof = 1;
|
||||
return 0;
|
||||
}
|
||||
md5_key_request(fd);
|
||||
break;
|
||||
|
||||
case 0x2710:
|
||||
if(RFIFOREST(fd)<86)
|
||||
return 0;
|
||||
char_request_login(fd,p);
|
||||
break;
|
||||
|
||||
case 0x7530:
|
||||
request_athena_info(fd);
|
||||
break;
|
||||
|
||||
case 0x7532:
|
||||
default:
|
||||
#ifdef DEBUG
|
||||
printf ("End of connection (ip: %s)" RETCODE, ip);
|
||||
#endif
|
||||
session[fd]->eof = 1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1 +1 @@
|
||||
int parse_login(int);
|
||||
int parse_login(int);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,50 +1,50 @@
|
||||
#ifndef _CHARCOMMAND_H_
|
||||
#define _CHARCOMMAND_H_
|
||||
|
||||
enum CharCommandType {
|
||||
CharCommand_None = -1,
|
||||
CharCommandJobChange,
|
||||
CharCommandPetRename,
|
||||
CharCommandPetFriendly,
|
||||
CharCommandReset,
|
||||
CharCommandStats,
|
||||
CharCommandOption,
|
||||
CharCommandSave,
|
||||
CharCommandStatsAll,
|
||||
|
||||
#ifdef TXT_ONLY
|
||||
/* TXT_ONLY */
|
||||
|
||||
/* TXT_ONLY */
|
||||
#else
|
||||
/* SQL-only */
|
||||
|
||||
/* SQL Only */
|
||||
#endif
|
||||
|
||||
// End. No more commans after this line.
|
||||
CharCommand_Unknown,
|
||||
CharCommand_MAX
|
||||
};
|
||||
|
||||
typedef enum CharCommandType CharCommandType;
|
||||
|
||||
typedef struct CharCommandInfo {
|
||||
CharCommandType type;
|
||||
const char* command;
|
||||
int level;
|
||||
int (*proc)(const int, struct map_session_data*,
|
||||
const char* command, const char* message);
|
||||
} CharCommandInfo;
|
||||
|
||||
CharCommandType
|
||||
is_charcommand(const int fd, struct map_session_data* sd, const char* message, int gmlvl);
|
||||
|
||||
CharCommandType charcommand(
|
||||
const int level, const char* message, CharCommandInfo* info);
|
||||
int get_charcommand_level(const CharCommandType type);
|
||||
|
||||
int charcommand_config_read(const char *cfgName);
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef _CHARCOMMAND_H_
|
||||
#define _CHARCOMMAND_H_
|
||||
|
||||
enum CharCommandType {
|
||||
CharCommand_None = -1,
|
||||
CharCommandJobChange,
|
||||
CharCommandPetRename,
|
||||
CharCommandPetFriendly,
|
||||
CharCommandReset,
|
||||
CharCommandStats,
|
||||
CharCommandOption,
|
||||
CharCommandSave,
|
||||
CharCommandStatsAll,
|
||||
|
||||
#ifdef TXT_ONLY
|
||||
/* TXT_ONLY */
|
||||
|
||||
/* TXT_ONLY */
|
||||
#else
|
||||
/* SQL-only */
|
||||
|
||||
/* SQL Only */
|
||||
#endif
|
||||
|
||||
// End. No more commans after this line.
|
||||
CharCommand_Unknown,
|
||||
CharCommand_MAX
|
||||
};
|
||||
|
||||
typedef enum CharCommandType CharCommandType;
|
||||
|
||||
typedef struct CharCommandInfo {
|
||||
CharCommandType type;
|
||||
const char* command;
|
||||
int level;
|
||||
int (*proc)(const int, struct map_session_data*,
|
||||
const char* command, const char* message);
|
||||
} CharCommandInfo;
|
||||
|
||||
CharCommandType
|
||||
is_charcommand(const int fd, struct map_session_data* sd, const char* message, int gmlvl);
|
||||
|
||||
CharCommandType charcommand(
|
||||
const int level, const char* message, CharCommandInfo* info);
|
||||
int get_charcommand_level(const CharCommandType type);
|
||||
|
||||
int charcommand_config_read(const char *cfgName);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
Date Added
|
||||
12/3
|
||||
Date Added
|
||||
12/3
|
||||
* Creation of eAthena Web Server v2 [MC Cameri]
|
@ -1,32 +1,32 @@
|
||||
CC = gcc -pipe
|
||||
MAKE = make
|
||||
OPT = -g -O2 -ffast-math
|
||||
|
||||
ifeq ($(findstring CYGWIN,$(PLATFORM)), CYGWIN)
|
||||
CFLAGS = $(OPT) -Wall -I../common
|
||||
else
|
||||
CFLAGS = $(OPT) -Wall -I../common
|
||||
endif
|
||||
|
||||
OBJ = main.o webserver.o ../common/showmsg.o
|
||||
LINKOBJ = main.o webserver.o ../common/showmsg.o
|
||||
|
||||
all: clean webserver run
|
||||
|
||||
clean:
|
||||
rm -f *.o webserver.exe ../common/showmsg.o
|
||||
|
||||
webserver: main.o webserver.o ../common/showmsg.o
|
||||
$(CC) $(OPT) -o "Webserver.exe" $(OBJ)
|
||||
|
||||
main.o: main.c
|
||||
$(CC) $(OPT) -c main.c -o main.o $(CFLAGS)
|
||||
|
||||
webserver.o: webserver.c
|
||||
$(CC) $(OPT) -c webserver.c -o webserver.o $(CFLAGS)
|
||||
|
||||
../common/showmsg.o: ../common/showmsg.c
|
||||
$(CC) $(OPT) -c ../common/showmsg.c -o ../common/showmsg.o $(CFLAGS)
|
||||
|
||||
run:
|
||||
./webserver
|
||||
CC = gcc -pipe
|
||||
MAKE = make
|
||||
OPT = -g -O2 -ffast-math
|
||||
|
||||
ifeq ($(findstring CYGWIN,$(PLATFORM)), CYGWIN)
|
||||
CFLAGS = $(OPT) -Wall -I../common
|
||||
else
|
||||
CFLAGS = $(OPT) -Wall -I../common
|
||||
endif
|
||||
|
||||
OBJ = main.o webserver.o ../common/showmsg.o
|
||||
LINKOBJ = main.o webserver.o ../common/showmsg.o
|
||||
|
||||
all: clean webserver run
|
||||
|
||||
clean:
|
||||
rm -f *.o webserver.exe ../common/showmsg.o
|
||||
|
||||
webserver: main.o webserver.o ../common/showmsg.o
|
||||
$(CC) $(OPT) -o "Webserver.exe" $(OBJ)
|
||||
|
||||
main.o: main.c
|
||||
$(CC) $(OPT) -c main.c -o main.o $(CFLAGS)
|
||||
|
||||
webserver.o: webserver.c
|
||||
$(CC) $(OPT) -c webserver.c -o webserver.o $(CFLAGS)
|
||||
|
||||
../common/showmsg.o: ../common/showmsg.c
|
||||
$(CC) $(OPT) -c ../common/showmsg.c -o ../common/showmsg.o $(CFLAGS)
|
||||
|
||||
run:
|
||||
./webserver
|
||||
|
@ -1,35 +1,35 @@
|
||||
# Project: Webserver
|
||||
# Makefile created by Dev-C++ 4.9.8.0
|
||||
|
||||
CPP = g++.exe -D__DEBUG__
|
||||
CC = gcc.exe -D__DEBUG__
|
||||
WINDRES = windres.exe
|
||||
RES =
|
||||
OBJ = main.o webserver.o ../common/showmsg.o $(RES)
|
||||
LINKOBJ = main.o webserver.o ../common/showmsg.o $(RES)
|
||||
LIBS = -L"C:/Program Files/Dev-Cpp/lib" -L"C:/cygwin/lib"
|
||||
INCS = -I"C:/Program Files/Dev-Cpp/include" -I"C:/cygwin/usr/include" -I"C:/cygwin/usr/include/mingw"
|
||||
CXXINCS = -I"C:/Program Files/Dev-Cpp/include/c++" -I"C:/Program Files/Dev-Cpp/include/c++/mingw32" -I"C:/Program Files/Dev-Cpp/include/c++/backward" -I"C:/Program Files/Dev-Cpp/include" -I"C:/cygwin/usr/include/c++/3.3.1"
|
||||
BIN = webserver.exe
|
||||
CXXFLAGS = $(CXXINCS) -pg -g3
|
||||
CFLAGS = $(INCS) -pg -g3
|
||||
|
||||
.PHONY: all all-before all-after clean clean-custom
|
||||
|
||||
all: all-before webserver.exe all-after
|
||||
|
||||
|
||||
clean: clean-custom
|
||||
rm -f $(OBJ) $(BIN)
|
||||
|
||||
$(BIN): $(LINKOBJ)
|
||||
$(CC) $(LINKOBJ) -o "webserver.exe" $(LIBS)
|
||||
|
||||
main.o: main.c
|
||||
$(CC) -c main.c -o main.o $(CFLAGS)
|
||||
|
||||
webserver.o: webserver.c
|
||||
$(CC) -c webserver.c -o webserver.o $(CFLAGS)
|
||||
|
||||
../common/showmsg.o: ../common/showmsg.c
|
||||
$(CC) -c ../common/showmsg.c -o ../common/showmsg.o $(CFLAGS)
|
||||
# Project: Webserver
|
||||
# Makefile created by Dev-C++ 4.9.8.0
|
||||
|
||||
CPP = g++.exe -D__DEBUG__
|
||||
CC = gcc.exe -D__DEBUG__
|
||||
WINDRES = windres.exe
|
||||
RES =
|
||||
OBJ = main.o webserver.o ../common/showmsg.o $(RES)
|
||||
LINKOBJ = main.o webserver.o ../common/showmsg.o $(RES)
|
||||
LIBS = -L"C:/Program Files/Dev-Cpp/lib" -L"C:/cygwin/lib"
|
||||
INCS = -I"C:/Program Files/Dev-Cpp/include" -I"C:/cygwin/usr/include" -I"C:/cygwin/usr/include/mingw"
|
||||
CXXINCS = -I"C:/Program Files/Dev-Cpp/include/c++" -I"C:/Program Files/Dev-Cpp/include/c++/mingw32" -I"C:/Program Files/Dev-Cpp/include/c++/backward" -I"C:/Program Files/Dev-Cpp/include" -I"C:/cygwin/usr/include/c++/3.3.1"
|
||||
BIN = webserver.exe
|
||||
CXXFLAGS = $(CXXINCS) -pg -g3
|
||||
CFLAGS = $(INCS) -pg -g3
|
||||
|
||||
.PHONY: all all-before all-after clean clean-custom
|
||||
|
||||
all: all-before webserver.exe all-after
|
||||
|
||||
|
||||
clean: clean-custom
|
||||
rm -f $(OBJ) $(BIN)
|
||||
|
||||
$(BIN): $(LINKOBJ)
|
||||
$(CC) $(LINKOBJ) -o "webserver.exe" $(LIBS)
|
||||
|
||||
main.o: main.c
|
||||
$(CC) -c main.c -o main.o $(CFLAGS)
|
||||
|
||||
webserver.o: webserver.c
|
||||
$(CC) -c webserver.c -o webserver.o $(CFLAGS)
|
||||
|
||||
../common/showmsg.o: ../common/showmsg.c
|
||||
$(CC) -c ../common/showmsg.c -o ../common/showmsg.o $(CFLAGS)
|
||||
|
@ -1,24 +1,24 @@
|
||||
[Editors]
|
||||
Focused=-1
|
||||
Order=-1,0
|
||||
[Editor_0]
|
||||
Open=1
|
||||
Top=0
|
||||
CursorCol=5
|
||||
CursorRow=30
|
||||
TopLine=1
|
||||
LeftChar=1
|
||||
[Editor_1]
|
||||
Open=1
|
||||
Top=0
|
||||
CursorCol=1
|
||||
CursorRow=35
|
||||
TopLine=16
|
||||
LeftChar=1
|
||||
[Editor_2]
|
||||
Open=1
|
||||
Top=1
|
||||
CursorCol=14
|
||||
CursorRow=4
|
||||
TopLine=1
|
||||
LeftChar=1
|
||||
[Editors]
|
||||
Focused=-1
|
||||
Order=-1,0
|
||||
[Editor_0]
|
||||
Open=1
|
||||
Top=0
|
||||
CursorCol=5
|
||||
CursorRow=30
|
||||
TopLine=1
|
||||
LeftChar=1
|
||||
[Editor_1]
|
||||
Open=1
|
||||
Top=0
|
||||
CursorCol=1
|
||||
CursorRow=35
|
||||
TopLine=16
|
||||
LeftChar=1
|
||||
[Editor_2]
|
||||
Open=1
|
||||
Top=1
|
||||
CursorCol=14
|
||||
CursorRow=4
|
||||
TopLine=1
|
||||
LeftChar=1
|
||||
|
@ -1,97 +1,97 @@
|
||||
[Project]
|
||||
FileName=Webserver.dev
|
||||
Name=Webserver
|
||||
UnitCount=5
|
||||
Type=1
|
||||
Ver=1
|
||||
ObjFiles=
|
||||
Includes=
|
||||
Libs=
|
||||
PrivateResource=
|
||||
ResourceIncludes=
|
||||
MakeIncludes=
|
||||
Compiler=
|
||||
CppCompiler=
|
||||
Linker=
|
||||
IsCpp=0
|
||||
Icon=
|
||||
ExeOutput=
|
||||
ObjectOutput=
|
||||
OverrideOutput=1
|
||||
OverrideOutputName=webserver.exe
|
||||
HostApplication=
|
||||
Folders=common
|
||||
CommandLine=
|
||||
IncludeVersionInfo=0
|
||||
SupportXPThemes=0
|
||||
CompilerSet=1
|
||||
CompilerSettings=000000000000000000
|
||||
|
||||
[Unit1]
|
||||
FileName=main.c
|
||||
CompileCpp=0
|
||||
Folder=
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=$(CC) -c main.c -o main.o webserver.o $(CFLAGS)
|
||||
|
||||
[VersionInfo]
|
||||
Major=0
|
||||
Minor=1
|
||||
Release=1
|
||||
Build=1
|
||||
LanguageID=1033
|
||||
CharsetID=1252
|
||||
CompanyName=
|
||||
FileVersion=
|
||||
FileDescription=Developed using the Dev-C++ IDE
|
||||
InternalName=
|
||||
LegalCopyright=
|
||||
LegalTrademarks=
|
||||
OriginalFilename=
|
||||
ProductName=
|
||||
ProductVersion=
|
||||
AutoIncBuildNr=0
|
||||
|
||||
[Unit2]
|
||||
FileName=webserver.c
|
||||
CompileCpp=0
|
||||
Folder=
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=1
|
||||
BuildCmd=$(CC) -c webserver.c -o webserver.o $(CFLAGS)
|
||||
|
||||
[Unit3]
|
||||
FileName=webserver.h
|
||||
CompileCpp=0
|
||||
Folder=
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit4]
|
||||
FileName=..\common\showmsg.c
|
||||
CompileCpp=0
|
||||
Folder=common
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit5]
|
||||
FileName=..\common\showmsg.h
|
||||
CompileCpp=0
|
||||
Folder=common
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Project]
|
||||
FileName=Webserver.dev
|
||||
Name=Webserver
|
||||
UnitCount=5
|
||||
Type=1
|
||||
Ver=1
|
||||
ObjFiles=
|
||||
Includes=
|
||||
Libs=
|
||||
PrivateResource=
|
||||
ResourceIncludes=
|
||||
MakeIncludes=
|
||||
Compiler=
|
||||
CppCompiler=
|
||||
Linker=
|
||||
IsCpp=0
|
||||
Icon=
|
||||
ExeOutput=
|
||||
ObjectOutput=
|
||||
OverrideOutput=1
|
||||
OverrideOutputName=webserver.exe
|
||||
HostApplication=
|
||||
Folders=common
|
||||
CommandLine=
|
||||
IncludeVersionInfo=0
|
||||
SupportXPThemes=0
|
||||
CompilerSet=1
|
||||
CompilerSettings=000000000000000000
|
||||
|
||||
[Unit1]
|
||||
FileName=main.c
|
||||
CompileCpp=0
|
||||
Folder=
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=$(CC) -c main.c -o main.o webserver.o $(CFLAGS)
|
||||
|
||||
[VersionInfo]
|
||||
Major=0
|
||||
Minor=1
|
||||
Release=1
|
||||
Build=1
|
||||
LanguageID=1033
|
||||
CharsetID=1252
|
||||
CompanyName=
|
||||
FileVersion=
|
||||
FileDescription=Developed using the Dev-C++ IDE
|
||||
InternalName=
|
||||
LegalCopyright=
|
||||
LegalTrademarks=
|
||||
OriginalFilename=
|
||||
ProductName=
|
||||
ProductVersion=
|
||||
AutoIncBuildNr=0
|
||||
|
||||
[Unit2]
|
||||
FileName=webserver.c
|
||||
CompileCpp=0
|
||||
Folder=
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=1
|
||||
BuildCmd=$(CC) -c webserver.c -o webserver.o $(CFLAGS)
|
||||
|
||||
[Unit3]
|
||||
FileName=webserver.h
|
||||
CompileCpp=0
|
||||
Folder=
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit4]
|
||||
FileName=..\common\showmsg.c
|
||||
CompileCpp=0
|
||||
Folder=common
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit5]
|
||||
FileName=..\common\showmsg.h
|
||||
CompileCpp=0
|
||||
Folder=common
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
|
@ -1,38 +1,38 @@
|
||||
[Editors]
|
||||
Focused=0
|
||||
Order=0,2,1,-1
|
||||
[Editor_0]
|
||||
Open=1
|
||||
Top=1
|
||||
CursorCol=55
|
||||
CursorRow=128
|
||||
TopLine=95
|
||||
LeftChar=1
|
||||
[Editor_1]
|
||||
Open=1
|
||||
Top=0
|
||||
CursorCol=25
|
||||
CursorRow=113
|
||||
TopLine=92
|
||||
LeftChar=1
|
||||
[Editor_2]
|
||||
Open=1
|
||||
Top=0
|
||||
CursorCol=1
|
||||
CursorRow=21
|
||||
TopLine=1
|
||||
LeftChar=1
|
||||
[Editor_3]
|
||||
Open=0
|
||||
Top=0
|
||||
CursorCol=20
|
||||
CursorRow=2
|
||||
TopLine=1
|
||||
LeftChar=1
|
||||
[Editor_4]
|
||||
Open=0
|
||||
Top=0
|
||||
CursorCol=20
|
||||
CursorRow=1
|
||||
TopLine=1
|
||||
LeftChar=1
|
||||
[Editors]
|
||||
Focused=0
|
||||
Order=0,2,1,-1
|
||||
[Editor_0]
|
||||
Open=1
|
||||
Top=1
|
||||
CursorCol=55
|
||||
CursorRow=128
|
||||
TopLine=95
|
||||
LeftChar=1
|
||||
[Editor_1]
|
||||
Open=1
|
||||
Top=0
|
||||
CursorCol=25
|
||||
CursorRow=113
|
||||
TopLine=92
|
||||
LeftChar=1
|
||||
[Editor_2]
|
||||
Open=1
|
||||
Top=0
|
||||
CursorCol=1
|
||||
CursorRow=21
|
||||
TopLine=1
|
||||
LeftChar=1
|
||||
[Editor_3]
|
||||
Open=0
|
||||
Top=0
|
||||
CursorCol=20
|
||||
CursorRow=2
|
||||
TopLine=1
|
||||
LeftChar=1
|
||||
[Editor_4]
|
||||
Open=0
|
||||
Top=0
|
||||
CursorCol=20
|
||||
CursorRow=1
|
||||
TopLine=1
|
||||
LeftChar=1
|
||||
|
@ -1,36 +1,36 @@
|
||||
#############################################################
|
||||
# ______ __ __ #
|
||||
# /\ _ \/\ \__/\ \ #
|
||||
# __\ \ \L\ \ \ ,_\ \ \___ __ ___ __ #
|
||||
# /'__`\ \ __ \ \ \/\ \ _ `\ /'__`\/' _ `\ /'__`\ #
|
||||
# /\ __/\ \ \/\ \ \ \_\ \ \ \ \/\ __//\ \/\ \/\ \L\.\_ #
|
||||
# \ \____\\ \_\ \_\ \__\\ \_\ \_\ \____\ \_\ \_\ \__/.\_\ #
|
||||
# \/____/ \/_/\/_/\/__/ \/_/\/_/\/____/\/_/\/_/\/__/\/_/ #
|
||||
# eAthena Web Server (Second Edition) #
|
||||
# by MC Cameri #
|
||||
# ------------------------------------------------------- #
|
||||
# -Website/Forum- #
|
||||
# http://eathena.deltaanime.net/ #
|
||||
# -Download URL- #
|
||||
# http://eathena.systeminplace.net/ #
|
||||
# -IRC Channel- #
|
||||
# irc://irc.deltaanime.net/#athena #
|
||||
#############################################################
|
||||
|
||||
// Display the eAthena Logo at startup?
|
||||
show_title: 1
|
||||
|
||||
//Web Server Port
|
||||
port: 81
|
||||
|
||||
//Web Server Password
|
||||
password: juan16
|
||||
|
||||
//Page Header
|
||||
header: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
|
||||
//Document index
|
||||
document_index: index.xhtml
|
||||
|
||||
//Send favorite icon if provided?
|
||||
favicon: yes
|
||||
#############################################################
|
||||
# ______ __ __ #
|
||||
# /\ _ \/\ \__/\ \ #
|
||||
# __\ \ \L\ \ \ ,_\ \ \___ __ ___ __ #
|
||||
# /'__`\ \ __ \ \ \/\ \ _ `\ /'__`\/' _ `\ /'__`\ #
|
||||
# /\ __/\ \ \/\ \ \ \_\ \ \ \ \/\ __//\ \/\ \/\ \L\.\_ #
|
||||
# \ \____\\ \_\ \_\ \__\\ \_\ \_\ \____\ \_\ \_\ \__/.\_\ #
|
||||
# \/____/ \/_/\/_/\/__/ \/_/\/_/\/____/\/_/\/_/\/__/\/_/ #
|
||||
# eAthena Web Server (Second Edition) #
|
||||
# by MC Cameri #
|
||||
# ------------------------------------------------------- #
|
||||
# -Website/Forum- #
|
||||
# http://eathena.deltaanime.net/ #
|
||||
# -Download URL- #
|
||||
# http://eathena.systeminplace.net/ #
|
||||
# -IRC Channel- #
|
||||
# irc://irc.deltaanime.net/#athena #
|
||||
#############################################################
|
||||
|
||||
// Display the eAthena Logo at startup?
|
||||
show_title: 1
|
||||
|
||||
//Web Server Port
|
||||
port: 81
|
||||
|
||||
//Web Server Password
|
||||
password: juan16
|
||||
|
||||
//Page Header
|
||||
header: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
|
||||
//Document index
|
||||
document_index: index.xhtml
|
||||
|
||||
//Send favorite icon if provided?
|
||||
favicon: yes
|
||||
|
@ -1,144 +1,144 @@
|
||||
/******************************************************************************
|
||||
# ______ __ __ #
|
||||
# /\ _ \/\ \__/\ \ #
|
||||
# __\ \ \L\ \ \ ,_\ \ \___ __ ___ __ #
|
||||
# /'__`\ \ __ \ \ \/\ \ _ `\ /'__`\/' _ `\ /'__`\ #
|
||||
# /\ __/\ \ \/\ \ \ \_\ \ \ \ \/\ __//\ \/\ \/\ \L\.\_ #
|
||||
# \ \____\\ \_\ \_\ \__\\ \_\ \_\ \____\ \_\ \_\ \__/.\_\ #
|
||||
# \/____/ \/_/\/_/\/__/ \/_/\/_/\/____/\/_/\/_/\/__/\/_/ #
|
||||
# eAthena Web Server (Second Edition) #
|
||||
# by MC Cameri #
|
||||
# ------------------------------------------------------- #
|
||||
# -Website/Forum- #
|
||||
# http://eathena.deltaanime.net/ #
|
||||
# -Download URL- #
|
||||
# http://eathena.systeminplace.net/ #
|
||||
# -IRC Channel- #
|
||||
# irc://irc.deltaanime.net/#athena #
|
||||
******************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <strings.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/wait.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "../common/showmsg.h"
|
||||
#include "webserver.h"
|
||||
|
||||
char ws_password[17];
|
||||
char ws_header[128];
|
||||
|
||||
#define WEB_CONF "conf/webserver-athena.conf"
|
||||
#define MAX_CONNECTIONS 10
|
||||
#define HOME "home/"
|
||||
|
||||
struct config config;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int server_fd, client_fd;
|
||||
int sin_size;
|
||||
struct sockaddr_in server_addr;
|
||||
struct sockaddr_in client_addr;
|
||||
struct sigaction sa;
|
||||
char recvin[1024];
|
||||
char path[1024];
|
||||
char line[1024];
|
||||
int optval = 1;
|
||||
if (ws_config_read(WEB_CONF)) exit(0);
|
||||
if (config.show_title)
|
||||
ws_display_title();
|
||||
else
|
||||
printf("eAthena Web Server (Second Edition)\n");
|
||||
if (strcmpEx(ws_password,"webpass")==0)
|
||||
ShowWarning("You are using the default password (webpass), we highly "
|
||||
"recommend\n that you change it.\n");
|
||||
else if (strstr(ws_password,"webpass"))
|
||||
ShowWarning("Your password should not contain \"webpass\" in it, it is"
|
||||
" highly\n recommended that you change it.\n");
|
||||
printf("Web Server Password: %s\n",ws_password);
|
||||
printf("Web Server Port: %d\n",config.port);
|
||||
|
||||
if ((server_fd = socket(AF_INET, SOCK_STREAM,0)) == -1) {
|
||||
ShowError("In main() -> Could not open socket.\n");
|
||||
return 1;
|
||||
}
|
||||
if (setsockopt(server_fd, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(int)) == -1) {
|
||||
ShowError("In main() -> Could not set socket options.\n");
|
||||
return 1;
|
||||
}
|
||||
server_addr.sin_family = AF_INET;
|
||||
server_addr.sin_port = htons(config.port);
|
||||
server_addr.sin_addr.s_addr = INADDR_ANY;
|
||||
memset(&(server_addr.sin_zero), '\0', 8);
|
||||
|
||||
if (bind(server_fd, (struct sockaddr *)&server_addr, sizeof(struct sockaddr)) < 0) {
|
||||
snprintf(tmp_output,sizeof(tmp_output),"In main() -> Could not bind to port number: %d\n",config.port);
|
||||
ShowError(tmp_output);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (listen(server_fd, MAX_CONNECTIONS) < 0) {
|
||||
snprintf(tmp_output,sizeof(tmp_output),"In main() -> Could not listen on port number: %d\n",config.port);
|
||||
ShowError(tmp_output);
|
||||
return 1;
|
||||
}
|
||||
|
||||
sa.sa_handler = ws_sigchld_handler;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sa.sa_flags = SA_RESTART;
|
||||
|
||||
if (sigaction(SIGCHLD, &sa, NULL) < 0) {
|
||||
ShowError("In main() -> Invalid sigaction.\n");
|
||||
return 1;
|
||||
}
|
||||
ShowInfo("eAthena Web Server is now listening for incoming connections.\n");
|
||||
|
||||
while(1)
|
||||
{
|
||||
sin_size = sizeof(struct sockaddr_in);
|
||||
client_fd = accept(server_fd, (struct sockaddr *)&client_addr, &sin_size);
|
||||
|
||||
if (!fork())
|
||||
{
|
||||
close(server_fd);
|
||||
memset(recvin, 0x0, 500);
|
||||
recv(client_fd, recvin, 500, 0);
|
||||
char *html_output;
|
||||
int count = 0;
|
||||
if (sscanf(recvin,"GET %[a-zA-Z_-.+\%#@~] %*[^\n]",path)==1) {
|
||||
FILE *fp;
|
||||
strcpy(tmp_output,HOME);
|
||||
strcat(tmp_output,path);
|
||||
fp = fopen(tmp_output,"r+");
|
||||
if (fp==NULL) {
|
||||
send(client_fd,"File not found",strlen("File not found"), 0);
|
||||
close(client_fd);
|
||||
}
|
||||
memset(tmp_output,0x0,strlen(tmp_output));
|
||||
html_output = (char*)malloc(sizeof(char)*2);
|
||||
while (fgets(line,1023,fp)) {
|
||||
html_output = (char*)realloc(sizeof(html_output)+(sizeof(char)*count));
|
||||
strcat(html_output,line);
|
||||
printf(line);
|
||||
}
|
||||
send(client_fd,tmp_output,sizeof(tmp_output),0);
|
||||
fclose(fp);
|
||||
}
|
||||
// send(client_fd, ws_header, strlen(ws_header), 0);
|
||||
// generate_page(password, client_fd, get_query(recvin), inet_ntoa(client_addr.sin_addr));
|
||||
// log_visit(get_query(recvin), inet_ntoa(client_addr.sin_addr));
|
||||
close(client_fd);
|
||||
exit(0);
|
||||
}
|
||||
close(client_fd);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/******************************************************************************
|
||||
# ______ __ __ #
|
||||
# /\ _ \/\ \__/\ \ #
|
||||
# __\ \ \L\ \ \ ,_\ \ \___ __ ___ __ #
|
||||
# /'__`\ \ __ \ \ \/\ \ _ `\ /'__`\/' _ `\ /'__`\ #
|
||||
# /\ __/\ \ \/\ \ \ \_\ \ \ \ \/\ __//\ \/\ \/\ \L\.\_ #
|
||||
# \ \____\\ \_\ \_\ \__\\ \_\ \_\ \____\ \_\ \_\ \__/.\_\ #
|
||||
# \/____/ \/_/\/_/\/__/ \/_/\/_/\/____/\/_/\/_/\/__/\/_/ #
|
||||
# eAthena Web Server (Second Edition) #
|
||||
# by MC Cameri #
|
||||
# ------------------------------------------------------- #
|
||||
# -Website/Forum- #
|
||||
# http://eathena.deltaanime.net/ #
|
||||
# -Download URL- #
|
||||
# http://eathena.systeminplace.net/ #
|
||||
# -IRC Channel- #
|
||||
# irc://irc.deltaanime.net/#athena #
|
||||
******************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <strings.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/wait.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "../common/showmsg.h"
|
||||
#include "webserver.h"
|
||||
|
||||
char ws_password[17];
|
||||
char ws_header[128];
|
||||
|
||||
#define WEB_CONF "conf/webserver-athena.conf"
|
||||
#define MAX_CONNECTIONS 10
|
||||
#define HOME "home/"
|
||||
|
||||
struct config config;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int server_fd, client_fd;
|
||||
int sin_size;
|
||||
struct sockaddr_in server_addr;
|
||||
struct sockaddr_in client_addr;
|
||||
struct sigaction sa;
|
||||
char recvin[1024];
|
||||
char path[1024];
|
||||
char line[1024];
|
||||
int optval = 1;
|
||||
if (ws_config_read(WEB_CONF)) exit(0);
|
||||
if (config.show_title)
|
||||
ws_display_title();
|
||||
else
|
||||
printf("eAthena Web Server (Second Edition)\n");
|
||||
if (strcmpEx(ws_password,"webpass")==0)
|
||||
ShowWarning("You are using the default password (webpass), we highly "
|
||||
"recommend\n that you change it.\n");
|
||||
else if (strstr(ws_password,"webpass"))
|
||||
ShowWarning("Your password should not contain \"webpass\" in it, it is"
|
||||
" highly\n recommended that you change it.\n");
|
||||
printf("Web Server Password: %s\n",ws_password);
|
||||
printf("Web Server Port: %d\n",config.port);
|
||||
|
||||
if ((server_fd = socket(AF_INET, SOCK_STREAM,0)) == -1) {
|
||||
ShowError("In main() -> Could not open socket.\n");
|
||||
return 1;
|
||||
}
|
||||
if (setsockopt(server_fd, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(int)) == -1) {
|
||||
ShowError("In main() -> Could not set socket options.\n");
|
||||
return 1;
|
||||
}
|
||||
server_addr.sin_family = AF_INET;
|
||||
server_addr.sin_port = htons(config.port);
|
||||
server_addr.sin_addr.s_addr = INADDR_ANY;
|
||||
memset(&(server_addr.sin_zero), '\0', 8);
|
||||
|
||||
if (bind(server_fd, (struct sockaddr *)&server_addr, sizeof(struct sockaddr)) < 0) {
|
||||
snprintf(tmp_output,sizeof(tmp_output),"In main() -> Could not bind to port number: %d\n",config.port);
|
||||
ShowError(tmp_output);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (listen(server_fd, MAX_CONNECTIONS) < 0) {
|
||||
snprintf(tmp_output,sizeof(tmp_output),"In main() -> Could not listen on port number: %d\n",config.port);
|
||||
ShowError(tmp_output);
|
||||
return 1;
|
||||
}
|
||||
|
||||
sa.sa_handler = ws_sigchld_handler;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sa.sa_flags = SA_RESTART;
|
||||
|
||||
if (sigaction(SIGCHLD, &sa, NULL) < 0) {
|
||||
ShowError("In main() -> Invalid sigaction.\n");
|
||||
return 1;
|
||||
}
|
||||
ShowInfo("eAthena Web Server is now listening for incoming connections.\n");
|
||||
|
||||
while(1)
|
||||
{
|
||||
sin_size = sizeof(struct sockaddr_in);
|
||||
client_fd = accept(server_fd, (struct sockaddr *)&client_addr, &sin_size);
|
||||
|
||||
if (!fork())
|
||||
{
|
||||
close(server_fd);
|
||||
memset(recvin, 0x0, 500);
|
||||
recv(client_fd, recvin, 500, 0);
|
||||
char *html_output;
|
||||
int count = 0;
|
||||
if (sscanf(recvin,"GET %[a-zA-Z_-.+\%#@~] %*[^\n]",path)==1) {
|
||||
FILE *fp;
|
||||
strcpy(tmp_output,HOME);
|
||||
strcat(tmp_output,path);
|
||||
fp = fopen(tmp_output,"r+");
|
||||
if (fp==NULL) {
|
||||
send(client_fd,"File not found",strlen("File not found"), 0);
|
||||
close(client_fd);
|
||||
}
|
||||
memset(tmp_output,0x0,strlen(tmp_output));
|
||||
html_output = (char*)malloc(sizeof(char)*2);
|
||||
while (fgets(line,1023,fp)) {
|
||||
html_output = (char*)realloc(sizeof(html_output)+(sizeof(char)*count));
|
||||
strcat(html_output,line);
|
||||
printf(line);
|
||||
}
|
||||
send(client_fd,tmp_output,sizeof(tmp_output),0);
|
||||
fclose(fp);
|
||||
}
|
||||
// send(client_fd, ws_header, strlen(ws_header), 0);
|
||||
// generate_page(password, client_fd, get_query(recvin), inet_ntoa(client_addr.sin_addr));
|
||||
// log_visit(get_query(recvin), inet_ntoa(client_addr.sin_addr));
|
||||
close(client_fd);
|
||||
exit(0);
|
||||
}
|
||||
close(client_fd);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,136 +1,136 @@
|
||||
/******************************************************************************
|
||||
# ______ __ __ #
|
||||
# /\ _ \/\ \__/\ \ #
|
||||
# __\ \ \L\ \ \ ,_\ \ \___ __ ___ __ #
|
||||
# /'__`\ \ __ \ \ \/\ \ _ `\ /'__`\/' _ `\ /'__`\ #
|
||||
# /\ __/\ \ \/\ \ \ \_\ \ \ \ \/\ __//\ \/\ \/\ \L\.\_ #
|
||||
# \ \____\\ \_\ \_\ \__\\ \_\ \_\ \____\ \_\ \_\ \__/.\_\ #
|
||||
# \/____/ \/_/\/_/\/__/ \/_/\/_/\/____/\/_/\/_/\/__/\/_/ #
|
||||
# eAthena Web Server (Second Edition) #
|
||||
# by MC Cameri #
|
||||
# ------------------------------------------------------- #
|
||||
# -Website/Forum- #
|
||||
# http://eathena.deltaanime.net/ #
|
||||
# -Download URL- #
|
||||
# http://eathena.systeminplace.net/ #
|
||||
# -IRC Channel- #
|
||||
# irc://irc.deltaanime.net/#athena #
|
||||
******************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <strings.h>
|
||||
#include "../common/showmsg.h"
|
||||
#include "webserver.h"
|
||||
|
||||
char ws_password[17] = "pass";
|
||||
char ws_header[128] = {'\0'};
|
||||
|
||||
/* Displays the eAthena Logo */
|
||||
void ws_display_title(void)
|
||||
{
|
||||
printf("\033[2J");
|
||||
printf("\033[37;44m (=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=)\033[K\033[0m\n");
|
||||
printf("\033[0;44m (\033[1;33m (c)2004 eAthena Development Team presents \033[0;44m)\033[K\033[0m\n");
|
||||
printf("\033[0;44m (\033[1m ______ __ __ \033[0;44m)\033[K\033[0m\n");
|
||||
printf("\033[0;44m (\033[1m /\\ _ \\/\\ \\__/\\ \\ \033[0;44m)\033[K\033[0m\n");
|
||||
printf("\033[0;44m (\033[1m __\\ \\ \\_\\ \\ \\ ,_\\ \\ \\___ __ ___ __ \033[0;44m)\033[K\033[0m\n");
|
||||
printf("\033[0;44m (\033[1m /'__`\\ \\ __ \\ \\ \\/\\ \\ _ `\\ /'__`\\/' _ `\\ /'__`\\ \033[0;44m)\033[K\033[0m\n");
|
||||
printf("\033[0;44m (\033[1m /\\ __/\\ \\ \\/\\ \\ \\ \\_\\ \\ \\ \\ \\/\\ __//\\ \\/\\ \\/\\ \\_\\.\\_ \033[0;44m)\033[K\033[0m\n");
|
||||
printf("\033[0;44m (\033[1m \\ \\____\\\\ \\_\\ \\_\\ \\__\\\\ \\_\\ \\_\\ \\____\\ \\_\\ \\_\\ \\__/.\\_\\ \033[0;44m)\033[K\033[0m\n");
|
||||
printf("\033[0;44m (\033[1m \\/____/ \\/_/\\/_/\\/__/ \\/_/\\/_/\\/____/\\/_/\\/_/\\/__/\\/_/ \033[0;44m)\033[K\033[0m\n");
|
||||
printf("\033[0;44m (\033[1m _ _ _ _ _ _ _ _ _ _ _ _ _ \033[0;44m)\033[K\033[0m\n"); // 1: bold char, 0: normal char
|
||||
printf("\033[0;44m (\033[1m / \\ / \\ / \\ / \\ / \\ / \\ / \\ / \\ / \\ / \\ / \\ / \\ / \\ \033[0;44m)\033[K\033[0m\n"); // 1: bold char, 0: normal char
|
||||
printf("\033[0;44m (\033[1m ( e | n | g | l | i | s | h ) ( A | t | h | e | n | a ) \033[0;44m)\033[K\033[0m\n"); // 1: bold char, 0: normal char
|
||||
printf("\033[0;44m (\033[1m \\_/ \\_/ \\_/ \\_/ \\_/ \\_/ \\_/ \\_/ \\_/ \\_/ \\_/ \\_/ \\_/ \033[0;44m)\033[K\033[0m\n"); // 1: bold char, 0: normal char
|
||||
printf("\033[0;44m (\033[1m \033[0;44m)\033[K\033[0m\n"); // yellow writing (33)
|
||||
printf("\033[0;44m (\033[1;33m Advanced Fusion Maps (c) 2003-2004 The Fusion Project \033[0;44m)\033[K\033[0m\n"); // yellow writing (33)
|
||||
printf("\033[37;44m (=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=)\033[K\033[0m\n\n"); // reset color
|
||||
}
|
||||
/* Returns a boolean value given character string */
|
||||
int ws_config_switch(const char *str) {
|
||||
if (strcmpEx(str, "on") == 0 || strcmpEx(str, "yes") == 0 ||
|
||||
strcmpEx(str, "oui") == 0 || strcmpEx(str, "ja") == 0 ||
|
||||
strcmpEx(str, "si") == 0 || strcmpEx(str,"true") == 0)
|
||||
return 1;
|
||||
if (strcmpEx(str, "off") == 0 || strcmpEx(str, "no") == 0 ||
|
||||
strcmpEx(str, "non") == 0 || strcmpEx(str, "nein") == 0 ||
|
||||
strcmpEx(str, "false") == 0)
|
||||
return 0;
|
||||
return atoi(str);
|
||||
}
|
||||
|
||||
/* Reads the eAthena Web Server's configuration file */
|
||||
int ws_config_read(const char *cfgName)
|
||||
{
|
||||
int i;
|
||||
char line[1024],w1[1024],w2[1024],temp[1024];
|
||||
FILE *fp;
|
||||
|
||||
/* Default values */
|
||||
config.show_title=0;
|
||||
config.port=80;
|
||||
|
||||
|
||||
fp=fopen(cfgName,"r");
|
||||
if(fp==NULL){
|
||||
snprintf(temp,sizeof(temp),"Could not open \033[1;29m%s\033[0;0m, file not found.\n",cfgName);
|
||||
ShowMessage(temp,MSG_ERROR);
|
||||
return 1;
|
||||
}
|
||||
while(fgets(line,1020,fp)){
|
||||
const struct {
|
||||
char str[128];
|
||||
int *val;
|
||||
} data[] ={
|
||||
//List of variables
|
||||
{ "show_title", &config.show_title },
|
||||
{ "port", &config.port },
|
||||
};
|
||||
|
||||
if((line[0] == '/' && line[1] == '/') || (line[0]=='#') ||
|
||||
(sscanf(line,"%1023[^:]:%1023[^\n]",w1,w2) !=2))
|
||||
continue;
|
||||
for(i=0;i<sizeof(data)/(sizeof(data[0]));i++) {
|
||||
if(strcmpEx(w1,data[i].str)==0){
|
||||
*data[i].val=ws_config_switch(w2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(strcmpEx(w1,"import")==0) {
|
||||
ws_config_read(w2);
|
||||
continue;
|
||||
}
|
||||
if(strcmpEx(w1,"password")==0) {
|
||||
if (strlen(w2)>16) {
|
||||
ShowError("The Web Server password is too long, maximum passwor"
|
||||
"d length is 16 characters.\n");
|
||||
return 1;
|
||||
}
|
||||
strcpy(ws_password,w2);
|
||||
continue;
|
||||
}
|
||||
if(strcmpEx(w1,"header")==0) {
|
||||
if (strlen(w2)>127) {
|
||||
ShowError("The Web Server header is too long, maximum header"
|
||||
"d length is 127 characters.\n");
|
||||
return 1;
|
||||
}
|
||||
strcpy(ws_header,w2);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
|
||||
//Correct values
|
||||
if(config.show_title < 0)
|
||||
config.show_title = 0;
|
||||
if(config.port < 1 || config.port > 65534)
|
||||
config.port=80;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ws_sigchld_handler(int s)
|
||||
{
|
||||
while(wait(NULL) > 0);
|
||||
}
|
||||
/******************************************************************************
|
||||
# ______ __ __ #
|
||||
# /\ _ \/\ \__/\ \ #
|
||||
# __\ \ \L\ \ \ ,_\ \ \___ __ ___ __ #
|
||||
# /'__`\ \ __ \ \ \/\ \ _ `\ /'__`\/' _ `\ /'__`\ #
|
||||
# /\ __/\ \ \/\ \ \ \_\ \ \ \ \/\ __//\ \/\ \/\ \L\.\_ #
|
||||
# \ \____\\ \_\ \_\ \__\\ \_\ \_\ \____\ \_\ \_\ \__/.\_\ #
|
||||
# \/____/ \/_/\/_/\/__/ \/_/\/_/\/____/\/_/\/_/\/__/\/_/ #
|
||||
# eAthena Web Server (Second Edition) #
|
||||
# by MC Cameri #
|
||||
# ------------------------------------------------------- #
|
||||
# -Website/Forum- #
|
||||
# http://eathena.deltaanime.net/ #
|
||||
# -Download URL- #
|
||||
# http://eathena.systeminplace.net/ #
|
||||
# -IRC Channel- #
|
||||
# irc://irc.deltaanime.net/#athena #
|
||||
******************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <strings.h>
|
||||
#include "../common/showmsg.h"
|
||||
#include "webserver.h"
|
||||
|
||||
char ws_password[17] = "pass";
|
||||
char ws_header[128] = {'\0'};
|
||||
|
||||
/* Displays the eAthena Logo */
|
||||
void ws_display_title(void)
|
||||
{
|
||||
printf("\033[2J");
|
||||
printf("\033[37;44m (=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=)\033[K\033[0m\n");
|
||||
printf("\033[0;44m (\033[1;33m (c)2004 eAthena Development Team presents \033[0;44m)\033[K\033[0m\n");
|
||||
printf("\033[0;44m (\033[1m ______ __ __ \033[0;44m)\033[K\033[0m\n");
|
||||
printf("\033[0;44m (\033[1m /\\ _ \\/\\ \\__/\\ \\ \033[0;44m)\033[K\033[0m\n");
|
||||
printf("\033[0;44m (\033[1m __\\ \\ \\_\\ \\ \\ ,_\\ \\ \\___ __ ___ __ \033[0;44m)\033[K\033[0m\n");
|
||||
printf("\033[0;44m (\033[1m /'__`\\ \\ __ \\ \\ \\/\\ \\ _ `\\ /'__`\\/' _ `\\ /'__`\\ \033[0;44m)\033[K\033[0m\n");
|
||||
printf("\033[0;44m (\033[1m /\\ __/\\ \\ \\/\\ \\ \\ \\_\\ \\ \\ \\ \\/\\ __//\\ \\/\\ \\/\\ \\_\\.\\_ \033[0;44m)\033[K\033[0m\n");
|
||||
printf("\033[0;44m (\033[1m \\ \\____\\\\ \\_\\ \\_\\ \\__\\\\ \\_\\ \\_\\ \\____\\ \\_\\ \\_\\ \\__/.\\_\\ \033[0;44m)\033[K\033[0m\n");
|
||||
printf("\033[0;44m (\033[1m \\/____/ \\/_/\\/_/\\/__/ \\/_/\\/_/\\/____/\\/_/\\/_/\\/__/\\/_/ \033[0;44m)\033[K\033[0m\n");
|
||||
printf("\033[0;44m (\033[1m _ _ _ _ _ _ _ _ _ _ _ _ _ \033[0;44m)\033[K\033[0m\n"); // 1: bold char, 0: normal char
|
||||
printf("\033[0;44m (\033[1m / \\ / \\ / \\ / \\ / \\ / \\ / \\ / \\ / \\ / \\ / \\ / \\ / \\ \033[0;44m)\033[K\033[0m\n"); // 1: bold char, 0: normal char
|
||||
printf("\033[0;44m (\033[1m ( e | n | g | l | i | s | h ) ( A | t | h | e | n | a ) \033[0;44m)\033[K\033[0m\n"); // 1: bold char, 0: normal char
|
||||
printf("\033[0;44m (\033[1m \\_/ \\_/ \\_/ \\_/ \\_/ \\_/ \\_/ \\_/ \\_/ \\_/ \\_/ \\_/ \\_/ \033[0;44m)\033[K\033[0m\n"); // 1: bold char, 0: normal char
|
||||
printf("\033[0;44m (\033[1m \033[0;44m)\033[K\033[0m\n"); // yellow writing (33)
|
||||
printf("\033[0;44m (\033[1;33m Advanced Fusion Maps (c) 2003-2004 The Fusion Project \033[0;44m)\033[K\033[0m\n"); // yellow writing (33)
|
||||
printf("\033[37;44m (=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=)\033[K\033[0m\n\n"); // reset color
|
||||
}
|
||||
/* Returns a boolean value given character string */
|
||||
int ws_config_switch(const char *str) {
|
||||
if (strcmpEx(str, "on") == 0 || strcmpEx(str, "yes") == 0 ||
|
||||
strcmpEx(str, "oui") == 0 || strcmpEx(str, "ja") == 0 ||
|
||||
strcmpEx(str, "si") == 0 || strcmpEx(str,"true") == 0)
|
||||
return 1;
|
||||
if (strcmpEx(str, "off") == 0 || strcmpEx(str, "no") == 0 ||
|
||||
strcmpEx(str, "non") == 0 || strcmpEx(str, "nein") == 0 ||
|
||||
strcmpEx(str, "false") == 0)
|
||||
return 0;
|
||||
return atoi(str);
|
||||
}
|
||||
|
||||
/* Reads the eAthena Web Server's configuration file */
|
||||
int ws_config_read(const char *cfgName)
|
||||
{
|
||||
int i;
|
||||
char line[1024],w1[1024],w2[1024],temp[1024];
|
||||
FILE *fp;
|
||||
|
||||
/* Default values */
|
||||
config.show_title=0;
|
||||
config.port=80;
|
||||
|
||||
|
||||
fp=fopen(cfgName,"r");
|
||||
if(fp==NULL){
|
||||
snprintf(temp,sizeof(temp),"Could not open \033[1;29m%s\033[0;0m, file not found.\n",cfgName);
|
||||
ShowMessage(temp,MSG_ERROR);
|
||||
return 1;
|
||||
}
|
||||
while(fgets(line,1020,fp)){
|
||||
const struct {
|
||||
char str[128];
|
||||
int *val;
|
||||
} data[] ={
|
||||
//List of variables
|
||||
{ "show_title", &config.show_title },
|
||||
{ "port", &config.port },
|
||||
};
|
||||
|
||||
if((line[0] == '/' && line[1] == '/') || (line[0]=='#') ||
|
||||
(sscanf(line,"%1023[^:]:%1023[^\n]",w1,w2) !=2))
|
||||
continue;
|
||||
for(i=0;i<sizeof(data)/(sizeof(data[0]));i++) {
|
||||
if(strcmpEx(w1,data[i].str)==0){
|
||||
*data[i].val=ws_config_switch(w2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(strcmpEx(w1,"import")==0) {
|
||||
ws_config_read(w2);
|
||||
continue;
|
||||
}
|
||||
if(strcmpEx(w1,"password")==0) {
|
||||
if (strlen(w2)>16) {
|
||||
ShowError("The Web Server password is too long, maximum passwor"
|
||||
"d length is 16 characters.\n");
|
||||
return 1;
|
||||
}
|
||||
strcpy(ws_password,w2);
|
||||
continue;
|
||||
}
|
||||
if(strcmpEx(w1,"header")==0) {
|
||||
if (strlen(w2)>127) {
|
||||
ShowError("The Web Server header is too long, maximum header"
|
||||
"d length is 127 characters.\n");
|
||||
return 1;
|
||||
}
|
||||
strcpy(ws_header,w2);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
|
||||
//Correct values
|
||||
if(config.show_title < 0)
|
||||
config.show_title = 0;
|
||||
if(config.port < 1 || config.port > 65534)
|
||||
config.port=80;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ws_sigchld_handler(int s)
|
||||
{
|
||||
while(wait(NULL) > 0);
|
||||
}
|
||||
|
@ -1,21 +1,21 @@
|
||||
#ifndef WEBSERV_H_
|
||||
#define WEBSERV_H_
|
||||
|
||||
#define strcmpEx(x,y) (strcasecmp(x,y))
|
||||
|
||||
extern void ws_display_title(void);
|
||||
|
||||
extern int ws_config_read(const char *cfgName);
|
||||
|
||||
extern struct config {
|
||||
int show_title;
|
||||
int port;
|
||||
} config;
|
||||
|
||||
extern char ws_password[17]; //16 chars + \0
|
||||
|
||||
extern char ws_header[128]; //!?
|
||||
|
||||
extern void ws_sigchld_handler(int s);
|
||||
|
||||
#endif
|
||||
#ifndef WEBSERV_H_
|
||||
#define WEBSERV_H_
|
||||
|
||||
#define strcmpEx(x,y) (strcasecmp(x,y))
|
||||
|
||||
extern void ws_display_title(void);
|
||||
|
||||
extern int ws_config_read(const char *cfgName);
|
||||
|
||||
extern struct config {
|
||||
int show_title;
|
||||
int port;
|
||||
} config;
|
||||
|
||||
extern char ws_password[17]; //16 chars + \0
|
||||
|
||||
extern char ws_header[128]; //!?
|
||||
|
||||
extern void ws_sigchld_handler(int s);
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user