From 40971af4b1518f5e148e3314293731e6eb988659 Mon Sep 17 00:00:00 2001 From: gumi Date: Sat, 19 Oct 2019 20:56:51 -0400 Subject: add IRC relay --- .gitignore | 2 + config.py.template | 8 + data_template/items.xml | 5898 +---------------------------------------------- ircbot.py | 70 + main.py | 60 +- net/protocol.py | 2 +- onlineusers.py | 9 +- player.py | 2 +- stats/update_sales.sh | 8 +- 9 files changed, 166 insertions(+), 5893 deletions(-) create mode 100644 ircbot.py diff --git a/.gitignore b/.gitignore index 7d7c1a9..99e1e8c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ data/ +items/ +online.txt config.py *.pyc diff --git a/config.py.template b/config.py.template index b7437bb..3a27391 100644 --- a/config.py.template +++ b/config.py.template @@ -8,3 +8,11 @@ admin = "" #nosell = [] # Items which can't be sold - just add the itemid to the list. sqlite3_dbfile = "data/mm.db" online_txt_url = 'http://server.themanaworld.org/online.txt' +online_txt_interval = 20 + +irc_server = 'chat.freenode.net' +irc_channel = '#themanaworld' +irc_port = 6667 +irc_user = 'mana' +irc_nick = 'mana' +irc_password = 'world' diff --git a/data_template/items.xml b/data_template/items.xml index 3a3354f..36bdd7d 100644 --- a/data_template/items.xml +++ b/data_template/items.xml @@ -1,5883 +1,19 @@ - - - + - - - - hairstyles/hairstyle01.xml - - - hairstyles/hairstyle02.xml - - - hairstyles/hairstyle03.xml - - - hairstyles/hairstyle04.xml - - - hairstyles/hairstyle05.xml - - - hairstyles/hairstyle06.xml - - - hairstyles/hairstyle07.xml - - - hairstyles/hairstyle08.xml - - - hairstyles/hairstyle09.xml - - - hairstyles/hairstyle10.xml - - - hairstyles/hairstyle11.xml - - - hairstyles/hairstyle12.xml - - - hairstyles/hairstyle13.xml - - - hairstyles/hairstyle14.xml - - - hairstyles/hairstyle15.xml - - - hairstyles/hairstyle16.xml - - - hairstyles/hairstyle17.xml - - - hairstyles/hairstyle18.xml - - - hairstyles/hairstyle19.xml - - - - - player_male_base.xml - player_female_base.xml - - - - - - - - - weapon-dagger.xml - weapons/swords/short-sword-miss1.ogg - weapons/swords/short-sword-hit1.ogg - - - weapon-bow.xml - - - - weapon-scythe.xml - - - weapon-dagger.xml - weapons/swords/short-sword-miss1.ogg - weapons/swords/short-sword-hit1.ogg - - - weapon-fist.xml - - - weapon-staff.xml - - - - - - - - - - - - - - - - equipment/head/santahat.xml - - - - - - - - - - - - weapon-dagger.xml - weapons/swords/short-sword-miss1.ogg - weapons/swords/short-sword-hit1.ogg - - - weapon-dagger.xml - weapons/knives/sharpknife-miss1.ogg - - - equipment/chest/leather-male.xml|#573a26,9e7654,d3b79e,ffffff;#b96b3d,fbf5f1 - equipment/chest/leather-female.xml|#412300,603100,8d4900;#ffff00 - - - equipment/head/fancyhat.xml - - - equipment/head/minershat.xml - - - - - equipment/feet/boots-male.xml|#623a34,f0c2b4 - equipment/feet/boots-female.xml|#623a34,f0c2b4 - - - - weapon-bow.xml - - - - equipment/hands/generic-male.xml|#202020,505050 - equipment/hands/generic-female.xml|#202020,505050 - - - equipment/hands/generic-male.xml|#4e2e18,c8752f - equipment/hands/generic-female.xml|#4e2e18,c8752f - - - - - - weapon-dagger.xml - - - - - - - - - equipment/head/standardheadband.xml|#563f25,99784c,d8bd86,ffffff - - - equipment/head/silkheadband.xml - - - weapon-bow.xml - - - - equipment/chest/leather-male.xml|#443c21,85794a,beb590,ffffff;#824035,d6a19a - equipment/chest/leather-female.xml|#251e06,443c21,71653b,a0945e;#b6574a - - - - - - weapon-axe-blacksmith.xml - - - - - - - - - - - - - - - equipment/hands/generic-male.xml|#202020,c0c0c0,ffffff,ffffff - equipment/hands/generic-female.xml|#202020,c0c0c0,ffffff,ffffff - - - equipment/chest/tnecksweater-male.xml|#a4b2b2,ffffff - equipment/chest/tnecksweater-female.xml|#a4b2b2,ffffff - - - - - - - - weapon-dagger.xml - - - weapon-dagger.xml - - - - - - - - - - weapon-dagger.xml - - - - - - - - - equipment/legs/shorts-male.xml|#a4b2b2,ffffff - equipment/legs/shorts-female.xml|#a4b2b2,ffffff - - - - - weapon-sword-sword.xml - - - - - - - - - - - - equipment/legs/shorts-male.xml|#255367,266c84,68b0c5,ffffff - equipment/legs/shorts-female.xml|#255367,266c84,68b0c5,ffffff - - - - - - - equipment/head/pumpkinhelmet.xml - - - equipment/head/axehat.xml - - - equipment/head/piratehat.xml - - - equipment/head/goggles.xml|#787878,f7f7f7 - - - equipment/head/goggles.xml|#783c00,ff973b - - - equipment/head/circlet.xml - - - equipment/head/eyepatch.xml - - - equipment/head/bandana.xml - - - weapon-scythe.xml - - - equipment/chest/vnecksweater-male.xml|#a4b2b2,ffffff - equipment/chest/vnecksweater-female.xml|#a4b2b2,ffffff - - - equipment/chest/chainmail-male.xml - equipment/chest/chainmail-female.xml - - - equipment/chest/lightplatemail-male.xml|#ddeeff - equipment/chest/lightplatemail-female.xml|#ddeeff - - - equipment/head/tophat.xml - - - equipment/head/funkywinter.xml - - - equipment/head/mushroom.xml - - - equipment/head/shroom.xml - - - - equipment/legs/skirt.xml|#a4b2b2,ffffff - - - equipment/head/xmaself.xml - - - equipment/head/mask.xml - - - - equipment/head/warlordhelm.xml - - - equipment/head/knighthelm.xml - - - equipment/head/infantryhelm.xml - - - equipment/head/crusadehelm.xml - - - - - equipment/legs/chaps-male.xml - equipment/legs/chaps-female.xml - - - equipment/head/cowboywhite.xml - - - equipment/head/cowboyblack.xml - - - equipment/chest/lightplatemail-male.xml|#573f10,9c8226,d3c04b,ffffff - equipment/chest/lightplatemail-female.xml|#573f10,9c8226,d3c04b,ffffff - - - equipment/head/crown.xml - - - equipment/head/devcap.xml|#9999ff - - - equipment/legs/pants-male.xml|#a4b2b2,ffffff - equipment/legs/pants-female.xml|#a4b2b2,ffffff - - - equipment/chest/sorcerer-robe-male.xml|#5e7480,f1ffff,ffffff;#2554c7 - equipment/chest/sorcerer-robe-female.xml|#5e7480,f1ffff,ffffff;#2554c7 - - - equipment/chest/sorcerer-robe-male.xml|#000000;#2554c7 - equipment/chest/sorcerer-robe-female.xml|#000000;#2554c7 - - - equipment/chest/robe-male.xml|#5e7480,f1ffff,ffffff - equipment/chest/robe-female.xml|#5e7480,f1ffff,ffffff - - - equipment/chest/robe-male.xml|#000000 - equipment/chest/robe-female.xml|#000000 - - - equipment/chest/robe-male.xml|#804000 - equipment/chest/robe-female.xml|#804000 - - - equipment/head/cap.xml|#d94800 - - - equipment/feet/furboots-male.xml - equipment/feet/furboots-female.xml - - - equipment/head/serf.xml - - - - equipment/chest/warlordplate-male.xml - equipment/chest/warlordplate-female.xml - - - equipment/chest/warlordplate-male.xml|#573f10,9c8226,d3c04b,ffffff - equipment/chest/warlordplate-female.xml|#573f10,9c8226,d3c04b,ffffff - - - - - - - - - - - - - - - - - - equipment/head/gradcap.xml - - - - - equipment/head/nohmask.xml - - - equipment/head/demonmask.xml - - - - - - - - - - - equipment/chest/tanktop-male.xml|#a4b2b2,ffffff - equipment/chest/tanktop-female.xml|#a4b2b2,ffffff - - - equipment/chest/shorttanktop-male.xml|#a4b2b2,ffffff - equipment/chest/shorttanktop-female.xml|#a4b2b2,ffffff - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - equipment/chest/robe-male.xml|#ffffff - equipment/chest/robe-female.xml|#ffffff - - - equipment/head/highpriest-crown.xml - - - equipment/head/monster-skull-helm.xml - - - equipment/head/deserthat.xml|#ffffff - - - equipment/head/standardheadband.xml|#a4b2b2,ffffff - - - equipment/head/gmcap.xml|#bf0e08 - - - equipment/chest/robe-male.xml|#e40a0a - equipment/chest/robe-female.xml|#e40a0a - - - - - - - equipment/legs/assassin-male.xml - equipment/legs/assassin-female.xml - - - - - equipment/feet/boots-male.xml|#212121 - equipment/feet/boots-female.xml|#212121 - - - equipment/feet/boots-male.xml|#a4b2b2,ffffff - equipment/feet/boots-female.xml|#a4b2b2,ffffff - - - - - - - - equipment/hands/generic-male.xml|#a4b2b2,ffffff - equipment/hands/generic-female.xml|#a4b2b2,ffffff - - - - - - - - - - - - equipment/head/pinkiehat.xml - - - equipment/head/fluffyhat.xml - - - - - equipment/chest/assassin-male.xml - equipment/chest/assassin-female.xml - - - equipment/hands/assassin-male.xml - equipment/hands/assassin-female.xml - - - equipment/feet/assassin-boots-male.xml - equipment/feet/assassin-boots-female.xml - - - weapon-staff.xml - - - equipment/head/paladinhelm.xml - - - equipment/head/overlordhelm.xml - - - equipment/head/desert-helmet.xml - - - - - equipment/head/sailor-hat.xml - - - equipment/head/captain-hat.xml - - - equipment/head/terranitehelm.xml - - - equipment/chest/terranite-male.xml - equipment/chest/terranite-female.xml - - - equipment/legs/terranite-male.xml - equipment/legs/terranite-female.xml - - - equipment/head/guyfawkes.xml - - - equipment/head/fairy_hat.xml - - - equipment/legs/miniskirt-male.xml|#a4b2b2,ffffff - equipment/legs/miniskirt-female.xml|#a4b2b2,ffffff - - - - - - - - - - - - equipment/head/witch-doctor-mask.xml - - - equipment/chest/forest-armor-male.xml - equipment/chest/forest-armor-female.xml - - - equipment/chest/valentine-dress.xml|#bf0e08 - equipment/chest/valentine-dress.xml|#bf0e08 - - - - - - - - - - equipment/chest/leather-male.xml|#573a26,c9866b,d3b79e,ffffff;#b96b3d,fbf5f1 - equipment/chest/leather-female.xml|#412300,c9866b,8d4900;#ffff00 - - - equipment/feet/bromenalboots-male.xml - equipment/feet/bromenalboots-female.xml - - - equipment/chest/bromenalchest-male.xml|#fbf5e9 - equipment/chest/bromenalchest-female.xml|#fbf5e9 - - - equipment/hands/bromenalgloves-male.xml - equipment/hands/bromenalgloves-female.xml - - - equipment/head/bromenalhelmet.xml - - - equipment/legs/bromenallegs-male.xml - equipment/legs/bromenallegs-female.xml - - - - equipment/chest/sorcerer-robe-male.xml|#ffffff - equipment/chest/sorcerer-robe-female.xml|#ffffff - - - - equipment/head/bowler-hat-brown.xml - - - equipment/head/pinkie-helmet.xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - equipment/head/earmuffs.xml - - - - - - - - equipment/head/elf-nightcap.xml - - - equipment/head/sunglasses.xml - - - equipment/head/knit-cap.xml - - - equipment/legs/pants-male.xml|#2a2117,2f2112,493219,61411e,724c22,a97e4f - equipment/legs/pants-female.xml|#2a2117,2f2112,493219,61411e,724c22,a97e4f - - - - - - - - - - - - - - - - weapon-bow.xml - - - - weapon-dagger.xml - - - equipment/chest/cotton-male.xml|#a4b2b2,ffffff - equipment/chest/cotton-female.xml|#a4b2b2,ffffff - - - equipment/head/rangerhat.xml - - - equipment/head/antlerhat.xml - - - equipment/head/christmastree.xml - - - equipment/head/santabeardhat.xml - - - - - - - - - - equipment/head/bunnyears.xml - - - weapon-dagger.xml - weapons/swords/short-sword-miss1.ogg - weapons/swords/sabre-hit1.ogg - - - equipment/head/mouboohead.xml - - - equipment/head/catears.xml|#774444;#777777 - - - equipment/head/paperbag.xml - - - equipment/head/moubootaurhead.xml - - - equipment/head/parsley-earplugs.xml - - - equipment/head/skullmask.xml - - - - - - - - - - - - - - - - - - - - - - - equipment/head/snowgoggles.xml - - - - - - equipment/override/skeleton.xml - graphics/particles/wisp.particle.xml - - - - - equipment/head/heart-glasses.xml - - - - - - - - - - equipment/head/rabbit-ears.xml|#ffffff - - - equipment/head/eggshell.xml - - - - - equipment/head/operamask.xml - - - equipment/head/jestermask.xml - - - equipment/head/witch-hat.xml - - - equipment/head/goblin-mask.xml - - - - - - - - - equipment/chest/cotton-male.xml|#580000,a40000,c02020,ff6060 - equipment/chest/cotton-female.xml|#580000,a40000,c02020,ff6060 - - - equipment/chest/cotton-male.xml|#115511,22aa22,99dd99 - equipment/chest/cotton-female.xml|#115511,22aa22,99dd99 - - - equipment/chest/cotton-male.xml|#222255,6666ff - equipment/chest/cotton-female.xml|#222255,6666ff - - - equipment/chest/cotton-male.xml|#846211,dab333,fffb93,ffffff - equipment/chest/cotton-female.xml|#846211,dab333,fffb93,ffffff - - - equipment/chest/cotton-male.xml|#16486e,498ec5,e4f2fc - equipment/chest/cotton-female.xml|#16486e,498ec5,e4f2fc - - - equipment/chest/cotton-male.xml|#56002f,930050,fe70bd,feb7de,ffffff - equipment/chest/cotton-female.xml|#56002f,930050,fe70bd,feb7de,ffffff - - - equipment/chest/cotton-male.xml|#111111,222222,333333,444444,555555,aaaaaa - equipment/chest/cotton-female.xml|#111111,222222,333333,444444,555555,aaaaaa - - - equipment/chest/cotton-male.xml|#80280f,b04810,ef681f,ffb830 - equipment/chest/cotton-female.xml|#80280f,b04810,ef681f,ffb830 - - - equipment/chest/cotton-male.xml|#4f0a76,8010c0,d699f7 - equipment/chest/cotton-female.xml|#4f0a76,8010c0,d699f7 - - - equipment/chest/cotton-male.xml|#104010,208020,30c030 - equipment/chest/cotton-female.xml|#104010,208020,30c030 - - - - equipment/chest/vnecksweater-male.xml|#580000,a40000,c02020,ff6060 - equipment/chest/vnecksweater-female.xml|#580000,a40000,c02020,ff6060 - - - equipment/chest/vnecksweater-male.xml|#115511,22aa22,99dd99 - equipment/chest/vnecksweater-female.xml|#115511,22aa22,99dd99 - - - equipment/chest/vnecksweater-male.xml|#222255,6666ff - equipment/chest/vnecksweater-female.xml|#222255,6666ff - - - equipment/chest/vnecksweater-male.xml|#846211,dab333,fffb93,ffffff - equipment/chest/vnecksweater-female.xml|#846211,dab333,fffb93,ffffff - - - equipment/chest/vnecksweater-male.xml|#16486e,498ec5,e4f2fc - equipment/chest/vnecksweater-female.xml|#16486e,498ec5,e4f2fc - - - equipment/chest/vnecksweater-male.xml|#56002f,930050,fe70bd,feb7de,ffffff - equipment/chest/vnecksweater-female.xml|#56002f,930050,fe70bd,feb7de,ffffff - - - equipment/chest/vnecksweater-male.xml|#111111,222222,333333,444444,555555,aaaaaa - equipment/chest/vnecksweater-female.xml|#111111,222222,333333,444444,555555,aaaaaa - - - equipment/chest/vnecksweater-male.xml|#80280f,b04810,ef681f,ffb830 - equipment/chest/vnecksweater-female.xml|#80280f,b04810,ef681f,ffb830 - - - equipment/chest/vnecksweater-male.xml|#4f0a76,8010c0,d699f7 - equipment/chest/vnecksweater-female.xml|#4f0a76,8010c0,d699f7 - - - equipment/chest/vnecksweater-male.xml|#104010,208020,30c030 - equipment/chest/vnecksweater-female.xml|#104010,208020,30c030 - - - - equipment/chest/tnecksweater-male.xml|#580000,a40000,c02020,ff6060 - equipment/chest/tnecksweater-female.xml|#580000,a40000,c02020,ff6060 - - - equipment/chest/tnecksweater-male.xml|#115511,22aa22,99dd99 - equipment/chest/tnecksweater-female.xml|#115511,22aa22,99dd99 - - - equipment/chest/tnecksweater-male.xml|#222255,6666ff - equipment/chest/tnecksweater-female.xml|#222255,6666ff - - - equipment/chest/tnecksweater-male.xml|#846211,dab333,fffb93,ffffff - equipment/chest/tnecksweater-female.xml|#846211,dab333,fffb93,ffffff - - - equipment/chest/tnecksweater-male.xml|#16486e,498ec5,e4f2fc - equipment/chest/tnecksweater-female.xml|#16486e,498ec5,e4f2fc - - - equipment/chest/tnecksweater-male.xml|#56002f,930050,fe70bd,feb7de,ffffff - equipment/chest/tnecksweater-female.xml|#56002f,930050,fe70bd,feb7de,ffffff - - - equipment/chest/tnecksweater-male.xml|#111111,222222,333333,444444,555555,aaaaaa - equipment/chest/tnecksweater-female.xml|#111111,222222,333333,444444,555555,aaaaaa - - - equipment/chest/tnecksweater-male.xml|#80280f,b04810,ef681f,ffb830 - equipment/chest/tnecksweater-female.xml|#80280f,b04810,ef681f,ffb830 - - - equipment/chest/tnecksweater-male.xml|#4f0a76,8010c0,d699f7 - equipment/chest/tnecksweater-female.xml|#4f0a76,8010c0,d699f7 - - - equipment/chest/tnecksweater-male.xml|#104010,208020,30c030 - equipment/chest/tnecksweater-female.xml|#104010,208020,30c030 - - - - equipment/chest/robe-male.xml|#580000,a40000,c02020,ff6060 - equipment/chest/robe-female.xml|#580000,a40000,c02020,ff6060 - - - equipment/chest/robe-male.xml|#115511,22aa22,99dd99 - equipment/chest/robe-female.xml|#115511,22aa22,99dd99 - - - equipment/chest/robe-male.xml|#222255,6666ff - equipment/chest/robe-female.xml|#222255,6666ff - - - equipment/chest/robe-male.xml|#846211,dab333,fffb93,ffffff - equipment/chest/robe-female.xml|#846211,dab333,fffb93,ffffff - - - equipment/chest/robe-male.xml|#16486e,498ec5,e4f2fc - equipment/chest/robe-female.xml|#16486e,498ec5,e4f2fc - - - equipment/chest/robe-male.xml|#56002f,930050,fe70bd,feb7de,ffffff - equipment/chest/robe-female.xml|#56002f,930050,fe70bd,feb7de,ffffff - - - equipment/chest/robe-male.xml|#111111,222222,333333,444444,555555,aaaaaa - equipment/chest/robe-female.xml|#111111,222222,333333,444444,555555,aaaaaa - - - equipment/chest/robe-male.xml|#80280f,b04810,ef681f,ffb830 - equipment/chest/robe-female.xml|#80280f,b04810,ef681f,ffb830 - - - equipment/chest/robe-male.xml|#4f0a76,8010c0,d699f7 - equipment/chest/robe-female.xml|#4f0a76,8010c0,d699f7 - - - equipment/chest/robe-male.xml|#104010,208020,30c030 - equipment/chest/robe-female.xml|#104010,208020,30c030 - - - - equipment/chest/tanktop-male.xml|#580000,a40000,c02020,ff6060 - equipment/chest/tanktop-female.xml|#580000,a40000,c02020,ff6060 - - - equipment/chest/tanktop-male.xml|#115511,22aa22,99dd99 - equipment/chest/tanktop-female.xml|#115511,22aa22,99dd99 - - - equipment/chest/tanktop-male.xml|#222255,6666ff - equipment/chest/tanktop-female.xml|#222255,6666ff - - - equipment/chest/tanktop-male.xml|#846211,dab333,fffb93,ffffff - equipment/chest/tanktop-female.xml|#846211,dab333,fffb93,ffffff - - - equipment/chest/tanktop-male.xml|#16486e,498ec5,e4f2fc - equipment/chest/tanktop-female.xml|#16486e,498ec5,e4f2fc - - - equipment/chest/tanktop-male.xml|#56002f,930050,fe70bd,feb7de,ffffff - equipment/chest/tanktop-female.xml|#56002f,930050,fe70bd,feb7de,ffffff - - - equipment/chest/tanktop-male.xml|#111111,222222,333333,444444,555555,aaaaaa - equipment/chest/tanktop-female.xml|#111111,222222,333333,444444,555555,aaaaaa - - - equipment/chest/tanktop-male.xml|#80280f,b04810,ef681f,ffb830 - equipment/chest/tanktop-female.xml|#80280f,b04810,ef681f,ffb830 - - - equipment/chest/tanktop-male.xml|#4f0a76,8010c0,d699f7 - equipment/chest/tanktop-female.xml|#4f0a76,8010c0,d699f7 - - - equipment/chest/tanktop-male.xml|#104010,208020,30c030 - equipment/chest/tanktop-female.xml|#104010,208020,30c030 - - - - equipment/legs/skirt.xml|#580000,a40000,c02020,ff6060 - - - equipment/legs/skirt.xml|#115511,22aa22,99dd99 - - - equipment/legs/skirt.xml|#222255,6666ff - - - equipment/legs/skirt.xml|#846211,dab333,fffb93,ffffff - - - equipment/legs/skirt.xml|#16486e,498ec5,e4f2fc - - - equipment/legs/skirt.xml|#56002f,930050,fe70bd,feb7de,ffffff - - - equipment/legs/skirt.xml|#111111,222222,333333,444444,555555,aaaaaa - - - equipment/legs/skirt.xml|#80280f,b04810,ef681f,ffb830 - - - equipment/legs/skirt.xml|#4f0a76,8010c0,d699f7 - - - equipment/legs/skirt.xml|#104010,208020,30c030 - - - - equipment/legs/shorts-male.xml|#580000,a40000,c02020,ff6060 - equipment/legs/shorts-female.xml|#580000,a40000,c02020,ff6060 - - - equipment/legs/shorts-male.xml|#115511,22aa22,99dd99 - equipment/legs/shorts-female.xml|#115511,22aa22,99dd99 - - - equipment/legs/shorts-male.xml|#222255,6666ff - equipment/legs/shorts-female.xml|#222255,6666ff - - - equipment/legs/shorts-male.xml|#846211,dab333,fffb93,ffffff - equipment/legs/shorts-female.xml|#846211,dab333,fffb93,ffffff - - - equipment/legs/shorts-male.xml|#16486e,498ec5,e4f2fc - equipment/legs/shorts-female.xml|#16486e,498ec5,e4f2fc - - - equipment/legs/shorts-male.xml|#56002f,930050,fe70bd,feb7de,ffffff - equipment/legs/shorts-female.xml|#56002f,930050,fe70bd,feb7de,ffffff - - - equipment/legs/shorts-male.xml|#111111,222222,333333,444444,555555,aaaaaa - equipment/legs/shorts-female.xml|#111111,222222,333333,444444,555555,aaaaaa - - - equipment/legs/shorts-male.xml|#80280f,b04810,ef681f,ffb830 - equipment/legs/shorts-female.xml|#80280f,b04810,ef681f,ffb830 - - - equipment/legs/shorts-male.xml|#520a7b,8c23c7,ca87ef - equipment/legs/shorts-female.xml|#520a7b,8c23c7,ca87ef - - - equipment/legs/shorts-male.xml|#104010,208020,30c030 - equipment/legs/shorts-female.xml|#104010,208020,30c030 - - - - equipment/chest/shorttanktop-male.xml|#580000,a40000,c02020,ff6060 - equipment/chest/shorttanktop-female.xml|#580000,a40000,c02020,ff6060 - - - equipment/chest/shorttanktop-male.xml|#115511,22aa22,99dd99 - equipment/chest/shorttanktop-female.xml|#115511,22aa22,99dd99 - - - equipment/chest/shorttanktop-male.xml|#222255,6666ff - equipment/chest/shorttanktop-female.xml|#222255,6666ff - - - equipment/chest/shorttanktop-male.xml|#846211,dab333,fffb93,ffffff - equipment/chest/shorttanktop-female.xml|#846211,dab333,fffb93,ffffff - - - equipment/chest/shorttanktop-male.xml|#16486e,498ec5,e4f2fc - equipment/chest/shorttanktop-female.xml|#16486e,498ec5,e4f2fc - - - equipment/chest/shorttanktop-male.xml|#56002f,930050,fe70bd,feb7de,ffffff - equipment/chest/shorttanktop-female.xml|#56002f,930050,fe70bd,feb7de,ffffff - - - equipment/chest/shorttanktop-male.xml|#111111,222222,333333,444444,555555,aaaaaa - equipment/chest/shorttanktop-female.xml|#111111,222222,333333,444444,555555,aaaaaa - - - equipment/chest/shorttanktop-male.xml|#80280f,b04810,ef681f,ffb830 - equipment/chest/shorttanktop-female.xml|#80280f,b04810,ef681f,ffb830 - - - equipment/chest/shorttanktop-male.xml|#4f0a76,8010c0,d699f7 - equipment/chest/shorttanktop-female.xml|#4f0a76,8010c0,d699f7 - - - equipment/chest/shorttanktop-male.xml|#104010,208020,30c030 - equipment/chest/shorttanktop-female.xml|#104010,208020,30c030 - - - - equipment/head/deserthat.xml|#580000,a40000,c02020,ff6060 - - - equipment/head/deserthat.xml|#115511,22aa22,99dd99 - - - equipment/head/deserthat.xml|#222255,6666ff - - - equipment/head/deserthat.xml|#846211,dab333,fffb93,ffffff - - - equipment/head/deserthat.xml|#16486e,498ec5,e4f2fc - - - equipment/head/deserthat.xml|#56002f,930050,fe70bd,feb7de,ffffff - - - equipment/head/deserthat.xml|#111111,222222,333333,444444,555555,aaaaaa - - - equipment/head/deserthat.xml|#80280f,b04810,ef681f,ffb830 - - - equipment/head/deserthat.xml|#4f0a76,8010c0,d699f7 - - - equipment/head/deserthat.xml|#104010,208020,30c030 - - - - equipment/head/standardheadband.xml|#580000,a40000,c02020,ff6060 - - - equipment/head/standardheadband.xml|#115511,22aa22,99dd99 - - - equipment/head/standardheadband.xml|#222255,6666ff - - - equipment/head/standardheadband.xml|#846211,dab333,fffb93,ffffff - - - equipment/head/standardheadband.xml|#16486e,498ec5,e4f2fc - - - equipment/head/standardheadband.xml|#56002f,930050,fe70bd,feb7de,ffffff - - - equipment/head/standardheadband.xml|#111111,222222,333333,444444,555555,aaaaaa - - - equipment/head/standardheadband.xml|#80280f,b04810,ef681f,ffb830 - - - equipment/head/standardheadband.xml|#4f0a76,8010c0,d699f7 - - - equipment/head/standardheadband.xml|#104010,208020,30c030 - - - - equipment/feet/boots-male.xml|#580000,a40000,c02020,ff6060 - equipment/feet/boots-female.xml|#580000,a40000,c02020,ff6060 - - - equipment/feet/boots-male.xml|#115511,22aa22,99dd99 - equipment/feet/boots-female.xml|#115511,22aa22,99dd99 - - - equipment/feet/boots-male.xml|#222255,6666ff - equipment/feet/boots-female.xml|#222255,6666ff - - - equipment/feet/boots-male.xml|#846211,dab333,fffb93,ffffff - equipment/feet/boots-female.xml|#846211,dab333,fffb93,ffffff - - - equipment/feet/boots-male.xml|#16486e,498ec5,e4f2fc - equipment/feet/boots-female.xml|#16486e,498ec5,e4f2fc - - - equipment/feet/boots-male.xml|#56002f,930050,fe70bd,feb7de,ffffff - equipment/feet/boots-female.xml|#56002f,930050,fe70bd,feb7de,ffffff - - - equipment/feet/boots-male.xml|#111111,222222,333333,444444,555555,aaaaaa - equipment/feet/boots-female.xml|#111111,222222,333333,444444,555555,aaaaaa - - - equipment/feet/boots-male.xml|#80280f,b04810,ef681f,ffb830 - equipment/feet/boots-female.xml|#80280f,b04810,ef681f,ffb830 - - - equipment/feet/boots-male.xml|#4f0a76,8010c0,d699f7 - equipment/feet/boots-female.xml|#4f0a76,8010c0,d699f7 - - - equipment/feet/boots-male.xml|#104010,208020,30c030 - equipment/feet/boots-female.xml|#104010,208020,30c030 - - - - equipment/hands/generic-male.xml|#580000,a40000,c02020,ff6060 - equipment/hands/generic-female.xml|#580000,a40000,c02020,ff6060 - - - equipment/hands/generic-male.xml|#115511,22aa22,99dd99 - equipment/hands/generic-female.xml|#115511,22aa22,99dd99 - - - equipment/hands/generic-male.xml|#222255,6666ff - equipment/hands/generic-female.xml|#222255,6666ff - - - equipment/hands/generic-male.xml|#846211,dab333,fffb93,ffffff - equipment/hands/generic-female.xml|#846211,dab333,fffb93,ffffff - - - equipment/hands/generic-male.xml|#16486e,498ec5,e4f2fc - equipment/hands/generic-female.xml|#16486e,498ec5,e4f2fc - - - equipment/hands/generic-male.xml|#56002f,930050,fe70bd,feb7de,ffffff - equipment/hands/generic-female.xml|#56002f,930050,fe70bd,feb7de,ffffff - - - equipment/hands/generic-male.xml|#111111,222222,333333,444444,555555,aaaaaa - equipment/hands/generic-female.xml|#111111,222222,333333,444444,555555,aaaaaa - - - equipment/hands/generic-male.xml|#80280f,b04810,ef681f,ffb830 - equipment/hands/generic-female.xml|#80280f,b04810,ef681f,ffb830 - - - equipment/hands/generic-male.xml|#4f0a76,8010c0,d699f7 - equipment/hands/generic-female.xml|#4f0a76,8010c0,d699f7 - - - equipment/hands/generic-male.xml|#104010,208020,30c030 - equipment/hands/generic-female.xml|#104010,208020,30c030 - - - - equipment/legs/miniskirt-male.xml|#580000,a40000,c02020,ff6060 - equipment/legs/miniskirt-female.xml|#580000,a40000,c02020,ff6060 - - - equipment/legs/miniskirt-male.xml|#115511,22aa22,99dd99 - equipment/legs/miniskirt-female.xml|#115511,22aa22,99dd99 - - - equipment/legs/miniskirt-male.xml|#222255,6666ff - equipment/legs/miniskirt-female.xml|#222255,6666ff - - - equipment/legs/miniskirt-male.xml|#846211,dab333,fffb93,ffffff - equipment/legs/miniskirt-female.xml|#846211,dab333,fffb93,ffffff - - - equipment/legs/miniskirt-male.xml|#16486e,498ec5,e4f2fc - equipment/legs/miniskirt-female.xml|#16486e,498ec5,e4f2fc - - - equipment/legs/miniskirt-male.xml|#56002f,930050,fe70bd,feb7de,ffffff - equipment/legs/miniskirt-female.xml|#56002f,930050,fe70bd,feb7de,ffffff - - - equipment/legs/miniskirt-male.xml|#111111,222222,333333,444444,555555,aaaaaa - equipment/legs/miniskirt-female.xml|#111111,222222,333333,444444,555555,aaaaaa - - - equipment/legs/miniskirt-male.xml|#80280f,b04810,ef681f,ffb830 - equipment/legs/miniskirt-female.xml|#80280f,b04810,ef681f,ffb830 - - - equipment/legs/miniskirt-male.xml|#4f0a76,8010c0,d699f7 - equipment/legs/miniskirt-female.xml|#4f0a76,8010c0,d699f7 - - - equipment/legs/miniskirt-male.xml|#104010,208020,30c030 - equipment/legs/miniskirt-female.xml|#104010,208020,30c030 - - - equipment/legs/pants-male.xml|#580000,a40000,c02020,ff6060 - equipment/legs/pants-female.xml|#580000,a40000,c02020,ff6060 - - - equipment/legs/pants-male.xml|#115511,22aa22,99dd99 - equipment/legs/pants-female.xml|#115511,22aa22,99dd99 - - - equipment/legs/pants-male.xml|#222255,6666ff - equipment/legs/pants-female.xml|#222255,6666ff - - - equipment/legs/pants-male.xml|#846211,dab333,fffb93,ffffff - equipment/legs/pants-female.xml|#846211,dab333,fffb93,ffffff - - - equipment/legs/pants-male.xml|#16486e,498ec5,e4f2fc - equipment/legs/pants-female.xml|#16486e,498ec5,e4f2fc - - - equipment/legs/pants-male.xml|#56002f,930050,fe70bd,feb7de,ffffff - equipment/legs/pants-female.xml|#56002f,930050,fe70bd,feb7de,ffffff - - - equipment/legs/pants-male.xml|#111111,222222,333333,444444,555555,aaaaaa - equipment/legs/pants-female.xml|#111111,222222,333333,444444,555555,aaaaaa - - - equipment/legs/pants-male.xml|#80280f,b04810,ef681f,ffb830 - equipment/legs/pants-female.xml|#80280f,b04810,ef681f,ffb830 - - - equipment/legs/pants-male.xml|#4f0a76,8010c0,d699f7 - equipment/legs/pants-female.xml|#4f0a76,8010c0,d699f7 - - - equipment/legs/pants-male.xml|#104010,208020,30c030 - equipment/legs/pants-female.xml|#104010,208020,30c030 - - - equipment/head/rabbit-ears.xml|#580000,a40000,c02020,ff6060 - - - equipment/head/rabbit-ears.xml|#115511,22aa22,99dd99 - - - equipment/head/rabbit-ears.xml|#222255,6666ff - - - equipment/head/rabbit-ears.xml|#846211,dab333,fffb93,ffffff - - - equipment/head/rabbit-ears.xml|#16486e,498ec5,e4f2fc - - - equipment/head/rabbit-ears.xml|#56002f,930050,fe70bd,feb7de,ffffff - - - equipment/head/rabbit-ears.xml|#111111,222222,333333,444444,555555,aaaaaa - - - equipment/head/rabbit-ears.xml|#80280f,b04810,ef681f,ffb830 - - - equipment/head/rabbit-ears.xml|#4f0a76,8010c0,d699f7 - - - equipment/head/rabbit-ears.xml|#104010,208020,30c030 - - - - equipment/head/wizard-hat.xml|#580000,a40000,c02020,ff6060 - - - equipment/head/wizard-hat.xml|#115511,22aa22,99dd99 - - - equipment/head/wizard-hat.xml|#222255,6666ff - - - equipment/head/wizard-hat.xml|#846211,dab333,fffb93,ffffff - - - equipment/head/wizard-hat.xml|#16486e,498ec5,e4f2fc - - - equipment/head/wizard-hat.xml|#56002f,930050,fe70bd,feb7de,ffffff - - - equipment/head/wizard-hat.xml|#111111,222222,333333,444444,555555,aaaaaa - - - equipment/head/wizard-hat.xml|#80280f,b04810,ef681f,ffb830 - - - equipment/head/wizard-hat.xml|#4f0a76,8010c0,d699f7 - - - equipment/head/wizard-hat.xml|#104010,208020,30c030 - - - - equipment/head/bowler-hat.xml|#580000,a40000,c02020,ff6060 - - - equipment/head/bowler-hat.xml|#115511,22aa22,99dd99 - - - equipment/head/bowler-hat.xml|#222255,6666ff - - - equipment/head/bowler-hat.xml|#846211,dab333,fffb93,ffffff - - - equipment/head/bowler-hat.xml|#16486e,498ec5,e4f2fc - - - equipment/head/bowler-hat.xml|#56002f,930050,fe70bd,feb7de,ffffff - - - equipment/head/bowler-hat.xml|#111111,222222,333333,444444,555555,aaaaaa - - - equipment/head/bowler-hat.xml|#80280f,b04810,ef681f,ffb830 - - - equipment/head/bowler-hat.xml|#4f0a76,8010c0,d699f7 - - - equipment/head/bowler-hat.xml|#104010,208020,30c030 - - - - equipment/chest/sorcerer-robe-male.xml|#580000,a40000,c02020,ff6060 - equipment/chest/sorcerer-robe-female.xml|#580000,a40000,c02020,ff6060 - - - equipment/chest/sorcerer-robe-male.xml|#115511,22aa22,99dd99 - equipment/chest/sorcerer-robe-female.xml|#115511,22aa22,99dd99 - - - equipment/chest/sorcerer-robe-male.xml|#222255,6666ff - equipment/chest/sorcerer-robe-female.xml|#222255,6666ff - - - equipment/chest/sorcerer-robe-male.xml|#846211,dab333,fffb93,ffffff - equipment/chest/sorcerer-robe-female.xml|#846211,dab333,fffb93,ffffff - - - equipment/chest/sorcerer-robe-male.xml|#16486e,498ec5,e4f2fc - equipment/chest/sorcerer-robe-female.xml|#16486e,498ec5,e4f2fc - - - equipment/chest/sorcerer-robe-male.xml|#56002f,930050,fe70bd,feb7de,ffffff - equipment/chest/sorcerer-robe-female.xml|#56002f,930050,fe70bd,feb7de,ffffff - - - equipment/chest/sorcerer-robe-male.xml|#111111,222222,333333,444444,555555,aaaaaa - equipment/chest/sorcerer-robe-female.xml|#111111,222222,333333,444444,555555,aaaaaa - - - equipment/chest/sorcerer-robe-male.xml|#80280f,b04810,ef681f,ffb830 - equipment/chest/sorcerer-robe-female.xml|#80280f,b04810,ef681f,ffb830 - - - equipment/chest/sorcerer-robe-male.xml|#4f0a76,8010c0,d699f7 - equipment/chest/sorcerer-robe-female.xml|#4f0a76,8010c0,d699f7 - - - equipment/chest/sorcerer-robe-male.xml|#104010,208020,30c030 - equipment/chest/sorcerer-robe-female.xml|#104010,208020,30c030 - - - - equipment/head/bowler-hat-brown.xml|#580000,a40000,c02020,ff6060 - - - equipment/head/bowler-hat-brown.xml|#115511,22aa22,99dd99 - - - equipment/head/bowler-hat-brown.xml|#222255,6666ff - - - equipment/head/bowler-hat-brown.xml|#846211,dab333,fffb93,ffffff - - - equipment/head/bowler-hat-brown.xml|#16486e,498ec5,e4f2fc - - - equipment/head/bowler-hat-brown.xml|#56002f,930050,fe70bd,feb7de,ffffff - - - equipment/head/bowler-hat-brown.xml|#111111,222222,333333,444444,555555,aaaaaa - - - equipment/head/bowler-hat-brown.xml|#80280f,b04810,ef681f,ffb830 - - - equipment/head/bowler-hat-brown.xml|#4f0a76,8010c0,d699f7 - - - equipment/head/bowler-hat-brown.xml|#104010,208020,30c030 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - equipment/head/candlehelmet.xml - - - - - - - - - equipment/head/yeti-mask.xml - - - equipment/head/wizard-hat.xml - - - - equipment/head/bowler-hat.xml - - - equipment/head/monocle.xml - - - equipment/head/panhat.xml - - - equipment/head/chefhat.xml - - - + + + + + + + + + + + + + + + + diff --git a/ircbot.py b/ircbot.py new file mode 100644 index 0000000..e256f9e --- /dev/null +++ b/ircbot.py @@ -0,0 +1,70 @@ +import sys +import threading +import irc.client +from net.packet_out import whisper +import config + +class IRCBot: + + def __init__(self): + self._client_thread = threading.Thread(target=self.__client_threadfunc, args=()) + self.conn = None + self._active = False + self._ready = False + self._reactor = None + self.broadcastFunc = None + + def __client_threadfunc(self): + print '__client_threadfunc started' + self._reactor = irc.client.Reactor() + try: + self.conn = self._reactor.server().connect(config.irc_server, config.irc_port, config.irc_nick, password=config.irc_password) + except irc.client.ServerConnectionError: + print(sys.exc_info()[1]) + raise SystemExit(1) + + self.conn.add_global_handler("welcome", self.__on_connect) + self.conn.add_global_handler("join", self.__on_join) + self.conn.add_global_handler("pubmsg", self.__on_pubmsg) + self.conn.add_global_handler("disconnect", self.__on_disconnect) + + while self._active: + self._reactor.process_once(timeout=1) + + def __on_connect(self, conn, event): + print "Connected to IRC on %s:%i" % (config.irc_server, config.irc_port) + if irc.client.is_channel(config.irc_channel): + self.conn.join(config.irc_channel) + + def __on_join(self, conn, event): + print "Joined channel %s" % config.irc_channel + self._ready = True + + def __on_pubmsg(self, conn, event): + self.broadcastFunc(event.source.nick, event.arguments[0]) + + def __on_disconnect(self, conn, event): + self.stop() + + def send(self, nick, msg): + if not self._ready: + return + if msg[:1] == "!": + self.conn.privmsg(config.irc_channel, "Command sent from TMW by %s:" % nick) + self.conn.privmsg(config.irc_channel, msg) + else: + self.conn.privmsg(config.irc_channel, "<%s> %s" % (nick, msg)) + + def start(self): + self._active = True + self._client_thread.start() + + def stop(self): + self._ready = False + if self._active: + self._active = False + self._client_thread.join() + + +if __name__=='__main__': + print "You should not run this file. Use main.py" diff --git a/main.py b/main.py index aa926bd..4cb65e3 100755 --- a/main.py +++ b/main.py @@ -45,6 +45,7 @@ import tradey import utils import eliza from onlineusers import SqliteDbManager +from ircbot import IRCBot chatbot = eliza.eliza() shop_broadcaster = utils.Broadcast() @@ -57,6 +58,7 @@ sale_tree = tradey.ItemTree() ItemLog = utils.ItemLog() logger = logging.getLogger('ManaLogger') db_manager = SqliteDbManager(config.sqlite3_dbfile) +ircbot = IRCBot() def process_whisper(nick, msg, mapserv): msg = filter(lambda x: x in utils.allowed_chars, msg) @@ -78,7 +80,7 @@ def process_whisper(nick, msg, mapserv): if int(user.get("used_stalls")) == 0 and int(user.get("money")) == 0: mapserv.sendall(whisper(nick, "You can no longer use the bot. If you feel this is in error, please contact" + config.admin)) return - allowed_commands = ['!money', '!help', '!getback', '!info', '!lastseen', "!mail" ] + allowed_commands = ['!money', '!help', '!getback', '!info' ] if not broken_string[0] in allowed_commands: mapserv.sendall(whisper(nick, "Your access level has been set to blocked! If you feel this is in error, please contact" + config.admin)) mapserv.sendall(whisper(nick, "Though, you still can do the following: "+str(allowed_commands))) @@ -201,6 +203,8 @@ def process_whisper(nick, msg, mapserv): mapserv.sendall(whisper(nick, "!lastseen - Show when was online the last time.")) elif broken_string[1] == '!mail': mapserv.sendall(whisper(nick, "!mail - Send a message to .")) + elif broken_string[1] == '!irc': + mapserv.sendall(whisper(nick, "!irc - Enable/disable IRC mode.")) elif user != -10: if int(user.get('accesslevel')) >= 10 and broken_string[1] == '!listusers': mapserv.sendall(whisper(nick, "!listusers - Lists all users which have a special accesslevel, e.g. they are blocked, seller or admin")) @@ -421,9 +425,16 @@ def process_whisper(nick, msg, mapserv): al = int(broken_string[1]) stalls = int(broken_string[2]) player_name = " ".join(broken_string[3:]) - user_tree.add_user(player_name, stalls, al) - mapserv.sendall(whisper(nick, "User Added with " + str(stalls) + " slots.")) - tradey.saveData("User Added: "+player_name+", Slots: "+str(stalls)+", Access Level: "+str(al)) + pl_user = user_tree.get_user(player_name) + if pl_user == -10: + user_tree.add_user(player_name, stalls, al) + mapserv.sendall(whisper(nick, "User Added with " + str(stalls) + " slots.")) + tradey.saveData("User Added: "+player_name+", Slots: "+str(stalls)+", Access Level: "+str(al)) + else: + pl_user.set("accesslevel", str(al)) + pl_user.set("stalls", str(stalls)) + mapserv.sendall(whisper(nick, "User Added with " + str(stalls) + " slots.")) + tradey.saveData("User Added: "+player_name+", Slots: "+str(stalls)+", Access Level: "+str(al)) else: mapserv.sendall(whisper(nick, "Syntax incorrect.")) @@ -664,12 +675,44 @@ def process_whisper(nick, msg, mapserv): db_manager.send_mail(nick, to_, msg_) mapserv.sendall(whisper(nick, "Message to \"%s\" sent" % (to_))) + elif broken_string[0] == "!irc": + if len(broken_string) < 2: + mapserv.sendall(whisper(nick, "Incorrect syntax.")) + return + if broken_string[1] == "on": + if user == -10: + user_tree.add_user(nick, 0, 0) + tradey.saveData("Stub User Added: "+nick+", Slots: 0, Access Level: 0") + user = user_tree.get_user(nick) + user.set("irc", "on") + mapserv.sendall(whisper(nick, "IRC relay mode is now enabled. Reply to chat on IRC.")) + elif broken_string[1] == "off": + if user != -10: + user.set("irc", "off") + if int(user.get("accesslevel")) == 0 and int(user.get("stalls")) == 0 and int(user.get("money")) == 0: + user_tree.remove_user(nick) + tradey.saveData("Stub User Removed: "+nick) + mapserv.sendall(whisper(nick, "IRC relay mode is now disabled.")) + + elif user != -10 and user.get("irc") == "on": + ircbot.send(nick, msg) + db_manager.forEachOnline(broadcast_if_irc_on, nick, "TMW.%s: %s" % (nick, msg)) else: response = chatbot.respond(msg) logger.info("Bot Response: "+response) mapserv.sendall(whisper(nick, response)) #mapserv.sendall(whisper(nick, "Command not recognised, please whisper me !help for a full list of commands.")) +def broadcast_from_irc(nick, msg): + db_manager.forEachOnline(broadcast_if_irc_on, "IRC", u"IRC.%s: %s" % (nick, msg)) + +def broadcast_if_irc_on(pl, sender_nick, msg): + if sender_nick == pl: + return + pl_user = user_tree.get_user(pl) + if pl_user != -10 and pl_user.get("irc") == "on": + mapserv.sendall(whisper(pl, msg.encode("utf-8", "ignore"))) + def main(): # Use rotating log files. log_handler = logging.handlers.RotatingFileHandler('data/logs/activity.log', maxBytes=1048576*3, backupCount=5) @@ -722,6 +765,9 @@ def main(): assert charport + if charip == "127.0.0.1" and config.server != "127.0.0.1": + charip = config.server + char = socket.socket() char.connect((charip, charport)) logger.info("Char connected") @@ -780,7 +826,11 @@ def main(): assert mapport + if mapip == "127.0.0.1" and charip != "127.0.0.1": + mapip = charip + beingManager.container[player_node.id] = Being(player_node.id, 42) + global mapserv mapserv = socket.socket() mapserv.connect((mapip, mapport)) logger.info("Map connected") @@ -797,6 +847,8 @@ def main(): shop_broadcaster.mapserv = mapserv db_manager.mapserv = mapserv db_manager.start() + ircbot.broadcastFunc = broadcast_from_irc + ircbot.start() # Map server packet loop print "Entering map packet loop\n"; diff --git a/net/protocol.py b/net/protocol.py index a6dcb4c..bcf6da0 100644 --- a/net/protocol.py +++ b/net/protocol.py @@ -68,7 +68,7 @@ SMSG_NPC_COMMAND = 0x0212 SMSG_BEING_MOVE3 = 0x0225 SMSG_MAP_MASK = 0x0226 SMSG_MAP_MUSIC = 0x0227 -SMSG_NPC_CHANGETITLE 0x0228 +SMSG_NPC_CHANGETITLE = 0x0228 SMSG_SCRIPT_MESSAGE = 0x0229 SMSG_PLAYER_CLIENT_COMMAND = 0x0230 SMSG_MAP_SET_TILES_TYPE = 0x0231 diff --git a/onlineusers.py b/onlineusers.py index c59834f..55da670 100644 --- a/onlineusers.py +++ b/onlineusers.py @@ -35,7 +35,7 @@ import config class OnlineUsers: - def __init__(self, online_url='http://server.themanaworld.org/online.txt', update_interval=60): + def __init__(self, online_url='http://server.themanaworld.org/online-old.txt', update_interval=20): self._active = False self._timer = 0 self._thread = threading.Thread(target=self._threadfunc, args=()) @@ -98,7 +98,7 @@ class SqliteDbManager: self._mailbox_thread = threading.Thread(target=self.__mailbox_threadfunc, args=()) self._dbfile = dbfile self.mapserv = None - self._online_manager = OnlineUsers(config.online_txt_url) + self._online_manager = OnlineUsers(config.online_txt_url, config.online_txt_interval) self.db, self.cur = self._open_sqlite_db(dbfile) self.cur.execute('create table if not exists LastSeen(\ @@ -200,6 +200,11 @@ class SqliteDbManager: time.sleep(1.0) db.close() + def forEachOnline(self, callback, *args): + users = self._online_manager.online_users + for u in users: + callback(u, *args) + def start(self): self._online_manager.start() self._active = True diff --git a/player.py b/player.py index ed80f66..5da16ba 100644 --- a/player.py +++ b/player.py @@ -55,7 +55,7 @@ class Player: break if not item_found: - return "Server and client inventory out of sync." + return "Server and client inventory out of sync: missing %i (x%i)" % (int(elem.get('itemId')), int(elem.get('amount'))) total_money = 0 for user in user_tree.root: diff --git a/stats/update_sales.sh b/stats/update_sales.sh index 62a4e1e..7662912 100755 --- a/stats/update_sales.sh +++ b/stats/update_sales.sh @@ -1,5 +1,5 @@ #!/bin/bash -cd /home/tmwserver/ManaMarket/stats -python /home/tmwserver/ManaMarket/stats/process_salelog/main.py /home/tmwserver/ManaMarket/data/logs/sale.log /var/www/tmw-homepage/server/manamarket.html -python /home/tmwserver/ManaMarket/stats/process_salelog/main_stat.py /home/tmwserver/ManaMarket/data/logs/sale.log /var/www/tmw-homepage/server/manamarket_stats.html -chmod 644 /var/www/tmw-homepage/server/manamarket.html /var/www/tmw-homepage/server/manamarket_stats.html +cd /var/lib/manamarket/stats +python /var/lib/manamarket/stats/process_salelog/main.py /var/lib/manamarket/data/logs/sale.log /var/lib/manamarket/www/manamarket.html +python /var/lib/manamarket/stats/process_salelog/main_stat.py /var/lib/manamarket/data/logs/sale.log /var/lib/manamarket/www/manamarket_stats.html +chmod 644 /var/lib/manamarket/www/manamarket.html /var/lib/manamarket/www/manamarket_stats.html -- cgit v1.2.3-70-g09d2