* Added mIRC Script language

* Added more samples for mIRC Script

* Delete sample.mrc

* Added unique color to mIRC Script

The first one Ive been able to come across that was free after a few hours of testing.

Not a very pretty one but... that's probably why it's free.
This commit is contained in:
gen-angry 2019-10-13 03:18:50 -04:00 коммит произвёл Colin Seymour
Родитель 1bb3393ea2
Коммит b4a068abf3
10 изменённых файлов: 6316 добавлений и 0 удалений

3
.gitmodules поставляемый
Просмотреть файл

@ -572,6 +572,9 @@
[submodule "vendor/grammars/language-meson"]
path = vendor/grammars/language-meson
url = https://github.com/TingPing/language-meson
[submodule "vendor/grammars/language-msl"]
path = vendor/grammars/language-msl
url = https://github.com/gen-angry/language-msl
[submodule "vendor/grammars/language-ncl"]
path = vendor/grammars/language-ncl
url = https://github.com/rpavlick/language-ncl.git

Просмотреть файл

@ -511,6 +511,8 @@ vendor/grammars/language-mcfunction:
- source.mcfunction-snapshot
vendor/grammars/language-meson:
- source.meson
vendor/grammars/language-msl:
- source.mrc
vendor/grammars/language-ncl:
- source.ncl
vendor/grammars/language-ninja:

Просмотреть файл

@ -6070,6 +6070,14 @@ fish:
tm_scope: source.fish
ace_mode: text
language_id: 415
mIRC Script:
type: programming
color: "#926059"
extensions:
- ".mrc"
tm_scope: source.mrc
ace_mode: text
language_id: 517654727
mcfunction:
type: programming
color: "#E22837"

Просмотреть файл

@ -0,0 +1,223 @@
;=====================================================================================
;====================================== HOSTBOT ======================================
;================================= TWITCH.TV/MRDOCDC =================================
;=============================== AUTO !HOSTME v0.1.4.3 ===============================
;=====================================================================================
;====== Please do not edit below this line unless you know what you are doing!! ======
;== This the basic release for Auto !HOSTME Bot ==
;== This bot will type !HOSTME for you automatically! ==
;== Simple and open source. Questions/Support Contect me below: ==
;== Twitter: @MrDocDC ==
;== Discord: https://discord.gg/ns2uTBS ==
;== Web: https://bluecat.live/faq/ ==
;============================ Enjoy :) ============================
;=====================================================================================
;=======================================================
;=====================Custom stuff======================
;;add your custom scripts here if you would like.
; I advise not spamming channels as this will get you banned!
; I suggest spamming channels every 2 minutes (or 120 seconds)
;=======================================================
;===============CONNECTION AND DISCONNECT===============
ON *:CONNECT: {
SET %version 0.1.4.3
window -g1 @Logs
echo -m @Logs $timestamp Auto Hostme Bot Successfully loaded. Version: %version
echo -m @Logs $timestamp 3To check for the latest version:12 https://bluecat.live/update/
echo -m @Logs $timestamp
echo -m @Logs $timestamp
IF ($server == tmi.twitch.tv) {
timers off
twitchpart
CAP REQ :twitch.tv/commands twitch.tv/tags twitch.tv/membership
VAR %x = 1
;; loop to join all the channels in the autojoin.txt file
WHILE ($read(autojoin.txt, t,%x) != $null) {
VAR %chan $chr(35) $+ $read(autojoin.txt, t, %x)
.TIMER -m 1 $calc(%x * 333) JOIN %chan
INC %x
}
if (%advertson) { startad }
startclear
SET %myName $me
VAR %livecheck $livechecker(%myName)
}
}
ON *:DISCONNECT:IF ($server == tmi.twitch.tv) twitchpart
alias twitchpart {
VAR %chans $chan(0)
WHILE (%chans) {
VAR %chan $chan(%chans)
PART %chan
DEC %chans
}
}
;=======================================================
;==================== menu aliases =====================
menu query,channel,status {
$style(2) &Version  %version:$null 
-
Help
.Trouble Shooting &Video: /url https://www.youtube.com/channel/UCI4C1vG7LMqnwfimJQe6VcA/playlists
.Trouble Shooting &Link: /url https://bluecat.live/faq/
-
Check For &Updates: /url https://bluecat.live/update/
-
Get your &oAuth: /url https://twitchapps.com/tmi/
-
&Clear &Current Screen:/clear
}
menu @Logs {
Clear
.Clear Current://clear
.Clear All://clearall
}
;=======================================================
;===================== bot scripts =====================
;;waits for unhost, picks a random number between 1 and 45, posts !hostme in that (random)time in seconds
ON *:NOTICE:*Exited host mode*:#: {
VAR %livecheck $livechecker(%myName)
if (%livecheck) && (%livecheck != $false) {
if ($chan == #p0sitivitybot) {
timer $+ $chan 1 $rand(1,45) { msg $chan $chr(63) $+ HOSTME | echo -m @Logs $timestamp 9Entered into the raffle for channel  $+ $chan $+ . USED $chr(63) $+ HOSTME }
return
}
elseif ($chan == #shouman) {
timer $+ $chan 1 $rand(1,45) { msg $chan $chr(36) $+ HOSTME | echo -m @Logs $timestamp 9Entered into the raffle for channel  $+ $chan $+ . USED $chr(36) $+ HOSTME }
return
}
else {
timer $+ $chan 1 $rand(1,45) { msg $chan !hostme | echo -m @Logs $timestamp 9Entered into the raffle for channel  $+ $chan $+ . USED $chr(33) $+ HOSTME }
}
}
else { echo -m @Logs $timestamp 4Not Entered into the raffle for $chan $+ . $chr(91) $+ not live $+ $chr(93) }
}
;;if you have posted the same message too soon, it will try again in 32 seconds.
;; this will only happen once as to not keep infinitely looping.
ON *:NOTICE:*identical to the previous*:#: {
if (%advertson) && (%retry < 1) {
VAR %retry 0
SET %tryagain $chan
INC %retry 1
.timer.tryagain 1 32 { msg %tryagain !hostme | echo -m @Logs $timestamp 9Entered you were entered into the raffle for channel $+ %tryagain $+ . }
}
}
;;notice if room is in followers-only mode.
ON *:NOTICE:*followers-only mode*:#: {
echo -m @Logs $timestamp 4Not Entered into the raffle for $chan $+ . $chr(91) $+ not following $+ $chr(93) Click here and follow: 12https://twitch.tv/ $+ $remove($chan, $chr(35))
}
;;this will let the dev know if anyone is running an outdated version. dev will message you to update.
ON *:text:!version:#: {
if ($nick == MrDocDC) {
msg $nick I'm running the Auto !HOSTME Bot VERSION: %version
}
}
;; timer to clear the channel windows every 999seconds to keep buffer down
alias startclear {
.TIMER.CLEAR.* off
VAR %xx 1
WHILE ($read(autojoin.txt, t,%xx) != $null) {
VAR %chan $chr(35) $+ $read(autojoin.txt, t, %xx)
.TIMER.CLEAR. $+ %xx 0 999 clear %chan
INC %xx
}
}
;;this will call the alias to verify the streamer is live
;; in oter words, it will only send the message if you are live streaming!
alias livechecker {
JSONOpen -uw livecheck https://api.twitch.tv/kraken/streams/ $+ $1 $+ ?nocache= $+ $ticks
JSONHttpHeader livecheck Client-ID avm4vi7zv0xpjkpi3d4x0qzk8xbrdw8
JSONHttpFetch livecheck
VAR %x $IIF($json(livecheck,stream,created_at).value,$true,$false)
JSONClose livecheck
RETURN %x
}
;======================= end bot =======================
;=======================================================
;=======================================================
;===================== Change Logs =====================
;
; v 0.1.4.3 12MAR2019
; + Minor changes to colors and menu
; + Added notice of followers-only mode in @Logs window
;
; v 0.1.4.2 03MAR2019
; + fixed live checker
; + Need: notice of not following; follower-only chat
;
; v 0.1.4.1 03MAR2019
; + added more channels to join
; + patched
;
; v 0.1.4.0 06NOV2018
; + changed channels
; + !hostme only sends if streamer is live
; + updated website and video
;
; v 0.1.3.0 14OCT2018
; + changed channels
; + made !hostme only send if channel unhosts
; + updated video to reflect this version
;
;
; v 0.1.2.1 20JUN2018
; + minor changes to autojoin channels due to not hosting 24/7
;
; v 0.1.2.0 12JUN2018
; + updated files and added step to install mIRC separately
; + resolved issues with evaluation exired.
; * wait for continue button to be clickable
; * click register, close browser, wait for continue button to be clickable
; * delete and stop using produce or register it.
;
; v 0.1.1.1 12JUN2018
;
; + Added links to new help desk! https://bluecat.live/support/
; + Auto/Manual Timers
; + Wait timer for .unhost (electricalskateboard/hostraffles/more to come)
; + Fix timing between msg channels
; + Instructions on youtube
; + Hosted files both initial install and update
; + Added a help file online. Will link everything there eventually
; + All-in-one zip for initial update
;
;
; v 0.1.1.0 10JUN2018
;
; Added mIRC.exe to the .zip file. Changed timers for notify on host mode.
; - timers will help keep congestion down in channels.
;
;
; v 0.1.0.2 10JUN2018
;
; TODO: try to see if whole mIRC dir can be put in zip for fewer steps on install. +Done v0.1.1.1
; Took out channels that only accept entries after .unhost
; Added msg on unhost / made file to read those that will mass message only
; Added repeat try if message identical
; Changed timers from miliseconds to seconds, with 3 seconds between each one.
;
;
; v 0.1.0.1 09JUN2018
;
; Changed the below command to ON NOTICE. TEXT didn't respond.
; Added ON TEXT to send !hostme if a channel has .unhost'd
; Updated googledrive file.
; Changed method for sending message from /amsg to a while loop for all channels in autojoin.
;
; v 0.1.0.0 07JUN2018
;
; Uploaded files to youtube & drive
; Updated raffle channels
; Coded simple !hostme bot to say !hostme in all joined host raffle channels
;=======================================================
;=================== End script1.mrc ===================

Просмотреть файл

@ -0,0 +1,316 @@
; -=- Script Settings v1.3 (May 28 2016)
; This script will automatically use SSL if the proper libraries are installed.
; To check: go to Tools - Options, Connect - Options. If the SSL button is greyed out, it is not active.
; API Key. Change to your API key.
alias -l prof.apikey { return apikey12 }
; Enabled Channel List. Separate by space.
alias -l prof.chanlist { return #pmvtest #pmv }
; Colours. Same order as the UTA bot. Change by pressing CTRL-K and two digit combination.
alias -l prof.col {
if ($1 == 1) { return 10 } ; Primary
if ($1 == 2) { return 07 } ; Secondary (Highlights)
if ($1 == 3) { return 03 } ; Help
if ($1 == 4) { return 13 } ; Note
if ($1 == 5) { return 04 } ; Error
if ($1 == 6) { return 03 } ; Good/Positive
if ($1 == 7) { return 04 } ; Bad/Negative
if ($1 == 8) { return 06 } ; Subnote
}
; Do you want the link displayed after? if not, change to 0.
alias -l prof.linkafter { return 1 }
; ID File Locations. The default is usually fine.
alias -l prof.idsfile { return $qt($scriptdir $+ id.hsh) }
alias -l prof.idsnamefile { return $qt($scriptdir $+ idname.hsh) }
; -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
; -=- Script Code. You do not need to edit/set anything under this line unless you want to change it. -=-
; -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
on 1:start:{
if ($hget(prof.ids)) { hfree prof.ids }
hmake prof.ids 100
if ($exists($prof.idsfile)) { hload prof.ids $prof.idsfile }
if ($hget(prof.idsname)) { hfree prof.idsname }
hmake prof.idsname 100
if ($exists($prof.idsnamefile)) { hload prof.idsname $prof.idsnamefile }
}
on *:text:*:#: {
if ($istok($prof.chanlist,$chan,32)) {
tokenize 32 $strip($replace($1-, $chr(9), $chr(32), $chr(194), $chr(32)))
if ($1 == !addid) {
if ($2 == $null) {
msg # $prof.col(3) $+ Adds an ID to the bot. $prof.col(1) $+ Usage: $+ $prof.col(2) !addid Name TornID
msg # $prof.col(4) $+ Note: $+ $prof.col(8) if your name displays wrong after adding to the bot, you can fix yourself with: $prof.col(4) $+ !setname Name $prof.col(8) $+ or get an op to use $prof.col(4) $+ !setmain Name ID
}
else {
if ($2 isnum && $3 == $null) { var %pid = $prof.cleanN($2) | var %pnick = $nick }
elseif ($3 isnum) { var %pid = $prof.cleanN($3) | var %pnick = $2 }
else { msg # $prof.col(5) $+ Try again. Usage: $+ $prof.col(2) !addid Name TornID | halt }
if (%pid != $null) {
var %retid = $prof.getid(%pnick)
if (%retid == $null) {
hadd -m prof.ids %pnick %pid
hsave prof.ids $prof.idsfile
msg # $prof.col(1) $+ Added $+ $prof.col(2) %pnick $prof.colid(%pid,1,2) to the database! If your name displays weird, fix with: $+ $prof.col(2) !setname Name
}
else { msg # $prof.col(5) $+ Whoops! $+ $prof.col(2) %pnick $prof.col(5) $+ already exists in the bot with ID $+ $prof.col(2) %retid $+ $prof.col(5) $+ . }
}
}
}
if ($1 == !delid) {
if ($2 == $null) { var %pnick = $nick }
else { var %pnick = $2 }
var %retid = $prof.getid(%pnick)
if (%retid != $null) {
hdel prof.ids %pnick
hsave prof.ids $prof.idsfile
if ($prof.getname(%retid) == %pnick) {
if ($hget(prof.idsname,%retid) != $null) {
hdel prof.idsname %retid
hsave prof.idsname $prof.idsnamefile
}
}
msg # $prof.col(6) $+ Removed $+ $prof.col(2) %pnick $prof.col(6) $+ from the database!
}
else { msg # $prof.col(5) $+ No can do, $+ $prof.col(2) %pnick $prof.col(5) $+ does not exist in the database! }
}
if ($1 == !setname) {
if ($2 != $null) {
var %id = $prof.getid($2), %idchk = $prof.getid($nick)
if (%id != $null) {
if (%idchk == %id) {
hadd -m prof.idsname %id $2
hsave prof.idsname $prof.idsnamefile
msg # $prof.col(6) $+ I have assigned $+ $prof.col(2) $2 $prof.col(6) $+ as the main name for ID $prof.colid(%id,6,2) $+ !
}
else { msg # $prof.col(2) $+ $nick $+ $prof.col(5) and $prof.col(2) $+ $2 $+ $prof.col(5) do not have the same ID saved. }
}
else { msg # $prof.col(5) $+ I have no idea who $+ $prof.col(2) $2 $prof.col(5) $+ is, please make sure that it's added via !addid first }
}
else { msg # $prof.col(3) $+ Sets your main name (needs to be added via !addid). $prof.col(1) $+ Usage: $+ $prof.col(2) !setname Name }
}
if ($istok(!revive !id !bust !bail !bazaar !pstats !display !trade !cash !money !mail !msg !message !attack !atk !mug !bounty !friend !friendlist !flist !enemy !blacklist !blist,$1,32)) {
if ($2 == $null) { var %searchnick = $nick }
else { var %searchnick = $2 }
var %retid = $prof.getid(%searchnick)
if (%retid == $null) { msg # $prof.col(5) $+ Sorry, I have no idea who $+ $prof.col(2) %searchnick $prof.col(5) $+ is! }
else {
var %retnick = $prof.getname(%retid)
if ($1 == !id) {
if (%searchnick != $nick) { msg # $prof.col(2) $+ %searchnick $+ $prof.col(1) $+ 's stored ID is $+ $prof.col(2) %retnick $prof.colid(%retid,1,2) - Profile link: $+ $prof.col(2) http://www.torn.com/profiles.php?XID= $+ %retid }
else { msg # $prof.col(1) $+ Your stored ID is $+ $prof.col(2) %retnick $prof.colid(%retid,1,2) - Profile link: $+ $prof.col(2) http://www.torn.com/profiles.php?XID= $+ %retid }
}
if ($1 == !revive) { msg # $prof.col(1) $+ Revive $+ $prof.col(2) %retnick $prof.colid(%retid,1,2) $+ ! - $+ $prof.col(2) http://www.torn.com/profiles.php?XID= $+ %retid }
if ($1 == !bust) { msg # $prof.col(1) $+ Bust $+ $prof.col(2) %retnick $prof.colid(%retid,1,2) out of jail! - $+ $prof.col(2) http://www.torn.com/profiles.php?XID= $+ %retid }
if ($1 == !bail) { msg # $prof.col(1) $+ Bail $+ $prof.col(2) %retnick $prof.colid(%retid,1,2) out of jail! - $+ $prof.col(2) http://www.torn.com/profiles.php?XID= $+ %retid }
if ($1 == !bazaar) { msg # $prof.col(1) $+ Visit $+ $prof.col(2) %retnick $prof.colid(%retid,1,2) $+ 's bazaar! - $+ $prof.col(2) http://www.torn.com/bazaar.php#/p=bazaar&userID= $+ %retid }
if ($1 == !pstats) { msg # $prof.col(1) $+ View $+ $prof.col(2) %retnick $prof.colid(%retid,1,2) $+ 's personal stats! - $+ $prof.col(2) http://www.torn.com/personalstats.php?ID= $+ %retid }
if ($1 == !display) { msg # $prof.col(1) $+ View $+ $prof.col(2) %retnick $prof.colid(%retid,1,2) $+ 's display case! - $+ $prof.col(2) http://www.torn.com/displaycase.php?userID= $+ %retid }
if ($1 == !trade) { msg # $prof.col(1) $+ Trade with $+ $prof.col(2) %retnick $prof.colid(%retid,1,2) $+ ! - $+ $prof.col(2) http://www.torn.com/trade.php#step=start&userID= $+ %retid }
if ($1 == !cash || $1 == !money) { msg # $prof.col(1) $+ Send cash to $+ $prof.col(2) %retnick $prof.colid(%retid,1,2) $+ ! - $+ $prof.col(2) http://www.torn.com/sendcash.php#/XID= $+ %retid }
if ($1 == !mail || $1 == !msg || $1 == !message) { msg # $prof.col(1) $+ Send a message to $+ $prof.col(2) %retnick $prof.colid(%retid,1,2) $+ ! - $+ $prof.col(2) http://www.torn.com/messages.php#/p=compose&XID= $+ %retid }
if ($1 == !attack || $1 == !atk) { msg # $prof.col(1) $+ Attack $+ $prof.col(2) %retnick $prof.colid(%retid,1,2) $+ ! - $+ $prof.col(2) http://www.torn.com/attack.php?PID= $+ %retid }
if ($1 == !mug) { msg # $prof.col(1) $+ Mug $+ $prof.col(2) %retnick $prof.colid(%retid,1,2) $+ ! - $+ $prof.col(2) http://www.torn.com/attack.php?PID= $+ %retid }
if ($1 == !bounty) { msg # $prof.col(1) $+ Bounty $+ $prof.col(2) %retnick $prof.colid(%retid,1,2) $+ ! - $+ $prof.col(2) http://www.torn.com/bounties.php#/p=add&XID= $+ %retid }
if ($1 == !friend || $1 == !friendlist || $1 == !flist) { msg # $prof.col(1) $+ Add $+ $prof.col(2) %retnick $prof.colid(%retid,1,2) to your $prof.col(6) $+ friends list $+ $prof.col(1) $+ ! - $+ $prof.col(2) http://www.torn.com/friendlist.php#/p=add&XID= $+ %retid }
if ($1 == !enemy || $1 == !blacklist || $1 == !blist) { msg # $prof.col(1) $+ Add $+ $prof.col(2) %retnick $prof.colid(%retid,1,2) to your $prof.col(7) $+ blacklist $+ $prof.col(1) $+ ! - $+ $prof.col(2) http://www.torn.com/blacklist.php#/p=add&XID= $+ %retid }
}
}
if ($1 == !attackid || $1 == !atkid) {
if ($2 isnum) {
var %namechk = $prof.getname($2)
if (%idchk != $null) { var %idpost = $prof.col(2) $+ %namechk }
else { var %idpost = $prof.colid($2,1,2) }
msg # $prof.col(1) $+ Attack %idpost $+ $prof.col(1) $+ ! - $+ $prof.col(2) http://www.torn.com/attack.php?PID= $+ $2
}
else { msg # $prof.col(3) $+ Displays an attack link from an ID that you specify. $prof.col(1) $+ Usage: $+ $prof.col(2) !attackid ID }
}
if ($istok(!prof !profile !info !find,$1,32)) {
if ($2 == $null) { var %name = $nick }
if ($2 isnum) { var %id = $2 }
else { if (%name == $null) { var %name = $2 } }
if (%id == $null) { var %id = $prof.getid(%name) }
if (%id == $null) { msg # $prof.col(5) $+ There is no ID stored for $+ $prof.col(2) %name $+ $prof.col(5) $+ ! | halt }
set %prof.find %id
set %prof.chan #
sockclose profile
if ($sslready) { sockopen -e profile api.torn.com 443 }
else { sockopen profile api.torn.com 80 }
}
}
}
; New getname/getid split call system from UTA 7
alias -l prof.getid { return $hget(prof.ids,$1) }
alias -l prof.getname {
if ($hget(prof.idsname,$1) != $null) { return $hget(prof.idsname,$1) }
else { return $hfind(prof.ids,$1).data }
}
; Colors and sets a bracket around ID numbers.
alias -l prof.colid { return $prof.col($2) $+ $chr(91) $+ $prof.col($3) $+ $1 $+ $prof.col($2) $+ $chr(93) }
; Strips all input ascii chars aside from decimals and numbers.
; Used to clean accidental/intentional letters in inputs that expect numbers.
alias -l prof.cleanN {
var %a = 0 | var %b = $1
while (%a < 255) { if (%a != 46 && %a !isnum 48-57) { var %b = $remove(%b, $chr(%a)) } | inc %a }
return %b
}
; Strips HTML tags.
alias -l prof.cleanH { return $regsubex($1,/^[^<]*>|<[^>]*>|<[^>]*$/g,$null) }
; Separates a number into neat little commas.
alias -l prof.addComma { var %a, %b = $regsub($ticks,$1,/\G([+-]?\d+?)(?=(?:\d{3})++(?=\.\d++$|$))/g,\1 $+ $chr(44),%a) | return %a }
; Profile String Builder
alias -l prof.outstr {
; broke it up to make it easier to read.
; check for online/offline status (api doesnt return it, so determine it)
if ($gettok(%prof.last,2,32) == minute || $gettok(%prof.last,2,32) == minutes) {
if ($gettok(%prof.last,1,32) <= 15) { set %prof.ol $prof.col(6) $+ [On] }
else { set %prof.ol $prof.col(7) $+ [Off] }
}
else { set %prof.ol $prof.col(7) $+ [Off] }
; fix a few odd chars
set %prof.fact $replace(%prof.fact,&#33;,$chr(33))
set %prof.fact $replace(%prof.fact,&#39;,$chr(33))
set %prof.fact $replace(%prof.fact,&#40;,$chr(33))
set %prof.fact $replace(%prof.fact,&#41;,$chr(33))
; then replace a few longer strings with shorter forms
set %prof.status $replace(%prof.status,In hospital,Hosp)
set %prof.status $remove(%prof.status,- Hospitalized)
set %prof.status $replace(%prof.status,In jail,Jail)
set %prof.status $replace(%prof.status,In federal jail,Fed)
set %prof.status $replace(%prof.status,Was caught trying to break out,Caught busting)
set %prof.status $replace(%prof.status,currently okay,okay)
set %prof.status $replace(%prof.status,1 hrs,1 hr)
set %prof.status $replace(%prof.status,1 mins,1 min)
set %prof.status $replace(%prof.status,$+($chr(34),$chr(44),$chr(34)),$+($chr(32),$chr(45),$chr(32)))
set %prof.last $replace(%prof.last,minutes,mins,minute,min)
set %prof.prop $replace(%prof.prop,Private Island,PI)
if ($right(%prof.status,1) == $chr(45)) { set %prof.status $left(%prof.status,-1) }
; make the age display more useful
if (%prof.age >= 365) {
var %yr = 0
var %dy = %prof.age
while (%dy >= 365) {
inc %yr
var %dy = $calc(%dy - 365)
}
if (%dy = 0) { var %agestring = $prof.col(6) $+ %yr $+ y }
else { var %agestring = %yr $+ y %dy $+ d }
}
else { var %agestring = $prof.addComma(%prof.age) }
; add a percentage to life
var %lifeperc $round($calc((%prof.lifecur / %prof.lifemax) * 100),0)
; colorize specific parts if needed
if ((%prof.fact == None) && (%prof.facrank == None)) {
var %facstr $prof.col(7) $+ None
}
else {
var %facstr $prof.col(2) $+ %prof.facrank $prof.col(1) $+ of $+ $prof.col(2) %prof.fact
}
if (%prof.spname == None && %prof.spdur == 0) { var %spstr $prof.col(7) $+ None }
else { var %spstr $prof.col(2) $+ %prof.spname $prof.col(8) $+ (for %prof.spdur $+ d) }
if (%prof.lifecur == %prof.lifemax) { var %lifecol 6 }
elseif (%prof.lifecur <= 1) { var %lifecol = 7 }
else { var %lifecol 2 }
if (okay isin %prof.status) { set %prof.status $prof.col(6) $+ %prof.status }
elseif (Jail for isin %prof.status) { set %prof.status $prof.col(7) $+ %prof.status }
elseif (Fed for isin %prof.status) { set %prof.status $prof.col(7) $+ %prof.status }
elseif (Hosp for isin %prof.status) { set %prof.status $prof.col(7) $+ %prof.status }
else { set %prof.status $prof.col(2) $+ %prof.status }
; now format output string
var %out = $prof.col(2) $+ %prof.name $prof.colid(%prof.id,1,2) %prof.ol
if (%prof.don == 1) { var %out = %out $prof.col(6) $+ $chr(42) }
var %out = %out $+ $prof.col(1) ( $+ $prof.col(2) $+ %prof.sex
var %out = %out $+ $prof.col(1) $+ , Level: $+ $prof.col(2) %prof.lvl
var %out = %out $+ $prof.col(1) $+ , Title: $+ $prof.col(2) %prof.rank
var %out = %out $+ $prof.col(1) $+ , Age: $+ $prof.col(2) %agestring
if (%prof.age >= 365) { var %out = %out $prof.col(8) $+ ( $+ %prof.age $+ ) }
var %out = %out $+ $prof.col(1) $+ , Spouse: %spstr
var %out = %out $+ $prof.col(1) $+ , Prop: $+ $prof.col(2) %prof.prop
var %out = %out $+ $prof.col(1) $+ , Fac: %facstr
var %out = %out $+ $prof.col(1) $+ , Life: $+ $prof.col(%lifecol) $prof.addComma(%prof.lifecur) $+ $prof.col(1) $+ / $+ $prof.col(%lifecol) $+ $prof.addComma(%prof.lifemax) $prof.col(8) $+ ( $+ %lifeperc $+ $chr(37) $+ )
var %out = %out $+ $prof.col(1) $+ , A: $+ $prof.col(2) $+ %prof.award $+ $prof.col(1) $+ /F: $+ $prof.col(6) $+ %prof.friend $+ $prof.col(1) $+ /E: $+ $prof.col(7) $+ %prof.enemy
var %out = %out $+ $prof.col(1) $+ , Seen: $+ $prof.col(2) %prof.last
var %out = %out $+ $prof.col(1) $+ , Status: %prof.status
var %out = %out $+ $prof.col(1) $+ )
return %out
}
; -=- Socket Code
on *:sockopen:profile:{
if ($sockerr) { echo -s 04Socket Error. Socket: $sockname --- Message: $sock($sockname).wsmsg --- Num: $sock($sockname).wserr }
else {
sockwrite -nt profile GET /user/ $+ %prof.find $+ ?selections=profile&key= $+ $prof.apikey HTTP/1.1
sockwrite -nt profile Host: api.torn.com
sockwrite -nt profile $crlf
}
}
on *:sockread:profile:{
if ($sockerr) { echo -s 4Socket Error. Socket: $sockname --- Message: $sock($sockname).wsmsg --- Num: $sock($sockname).wserr }
else {
var %read | sockRead %read | var %readln $remove(%read, $chr(9))
;write $qt($scriptdir $+ test $+ $gmt $+ .txt) %readln
if ($regex(%readln,error":"(.+?)")) { set %prof.err $regml(1) }
if ($regex(%readln,rank":"(.+?)")) { set %prof.rank $regml(1) }
if ($regex(%readln,level":(.+?)")) { set %prof.lvl $prof.cleanN($regml(1)) }
if ($regex(%readln,gender":"(.+?)")) { set %prof.sex $regml(1) }
if ($regex(%readln,property":"(.+?)")) { set %prof.prop $regml(1) }
if ($regex(%readln,status":\["(.+?)"\])) { set %prof.status $prof.cleanH($regml(1)) }
if ($regex(%readln,awards":(.+?)")) { set %prof.award $prof.cleanN($regml(1)) }
if ($regex(%readln,friends":(.+?)")) { set %prof.friend $prof.cleanN($regml(1)) }
if ($regex(%readln,enemies":(.+?)")) { set %prof.enemy $prof.cleanN($regml(1)) }
if ($regex(%readln,age":(.+?)")) { set %prof.age $prof.cleanN($regml(1)) }
if ($regex(%readln,donator":1)) { set %prof.don 1 }
if ($regex(%readln,player_id":(.+?)")) { set %prof.id $prof.cleanN($regml(1)) }
if ($regex(%readln,name":"(.+?)")) { set %prof.name $regml(1) }
if ($regex(%readln,last_action":"(.+?)")) { set %prof.last $regml(1) }
if ($regex(%readln,current":(.+?)")) { set %prof.lifecur $prof.cleanN($regml(1)) }
if ($regex(%readln,maximum":(.+?)")) { set %prof.lifemax $prof.cleanN($regml(1)) }
if ($regex(%readln,faction_name":"(.+?)")) { set %prof.fact $regml(1) }
if ($regex(%readln,faction":{"position":"(.+?)")) { set %prof.facrank $regml(1) }
if ($regex(%readln,spouse_name":"(.+?)")) { set %prof.spname $regml(1) }
if ($regex(%readln,duration":(.+?)})) { set %prof.spdur $prof.cleanN($regml(1)) }
if ($regex(%readln,}})) { prof.sockclose 1 }
}
}
on *:sockclose:profile:{ prof.sockclose }
; calls on close socket or at the end of a string, whichever comes first.
; helps avoid the timeout glitch. If called with $1 == 1, it forces a sockclose.
alias -l prof.sockclose {
if (%prof.err != $null) { msg %prof.chan $prof.col(5) $+ Error: $+ $prof.col(2) %prof.err }
else {
msg %prof.chan $prof.outstr
if ($prof.linkafter == 1) {
msg %prof.chan $prof.col(1) $+ Link: $+ $prof.col(2) http://www.torn.com/profiles.php?XID= $+ %prof.id
}
}
if ($1 == 1) { sockclose profile }
unset %prof.*
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,632 @@
ON 1:START:{ unset %tornstats* | unset %tsspy.* | tornstats.init }
alias -l tornstats.cfgfile { return $qt($scriptdir $+ tornstats.ini) }
alias -l tornstats.localfile { return $qt($scriptdir $+ spy.db) }
alias -l tornstats.botvers { return 3.0 }
alias -l tornstats.init {
if (!$exists($tornstats.cfgfile)) { tornstats.upg | echo -ag www.tornstats.com Spy Database script: Default values have been written. Right click channel section for config panel. }
if ($readini($tornstats.cfgfile,n,Spy,vers) != $tornstats.botvers) { tornstats.upg | echo -ag www.tornstats.com Spy Database script: Thank you for updating, new config entries have been populated with default values. }
set %tornstats.chanlist $addtok(%tornstats.chanlist,$readini($tornstats.cfgfile,n,Spy,chan),44)
echo -sg 10tornstats.com Spy Database script made by:7 PMV 10[07157799310] v07 $+ $tornstats.botvers 10- Initialized Successfully!
}
; ##################################################################### CONFIG CODE #####################################################################
dialog -l tornstats.cfgview {
title "www.tornstats.com Spy Database Config"
size -1 -1 260 125
option dbu
check "Enable Script (warning: Disable the spy bot on Universal TC Bot if using this script!)",1,4 4 220 10
text "Channel(s):",1001,4 18 40 10, right
text "Tornstats Key:",1002,4 32 40 10, right
text "API Key:",1003,4 44 40 10, right
edit "",100,50 16 150 10, autohs
edit "",101,50 30 150 10, autohs
edit "",102,50 42 150 10, autohs
button "Set",10,220 20 25 25
check "Cache Saved Spies Locally (works with Asshole v5.0 or higher/Universal TC Bot)",2,4 56 200 10
check "Display Socket Errors",3,4 68 200 10
text "",999,4 115 252 10, center
}
on 1:DIALOG:tornstats.cfgview:sclick:1:{
if ($readini($tornstats.cfgfile,n,Spy,enable) == no) { writeini -n $tornstats.cfgfile Spy enable yes | did -c tornstats.cfgview 1 | did -a tornstats.cfgview 999 Script is now ENABLED. }
else { writeini -n $tornstats.cfgfile Spy enable no | did -u tornstats.cfgview 1 | did -a tornstats.cfgview 999 Script is now DISABLED. }
flushini $tornstats.cfgfile
}
on 1:DIALOG:tornstats.cfgview:sclick:2:{
if ($readini($tornstats.cfgfile,n,Spy,cache) == no) { writeini -n $tornstats.cfgfile Spy cache yes | did -c tornstats.cfgview 2 | did -a tornstats.cfgview 999 Script will now save spy updates locally as well. }
else { writeini -n $tornstats.cfgfile Spy cache no | did -u tornstats.cfgview 2 | did -a tornstats.cfgview 999 Script will NOT save updates locally. }
flushini $tornstats.cfgfile
}
on 1:DIALOG:tornstats.cfgview:sclick:3:{
if ($readini($tornstats.cfgfile,n,Spy,sockerr) == no) { writeini -n $tornstats.cfgfile Spy sockerr yes | did -c tornstats.cfgview 3 | did -a tornstats.cfgview 999 Script will now display socket errors if any. }
else { writeini -n $tornstats.cfgfile Spy sockerr no | did -u tornstats.cfgview 3 | did -a tornstats.cfgview 999 Script will hide socket errors. }
flushini $tornstats.cfgfile
}
on 1:DIALOG:tornstats.cfgview:sclick:10:{
if ($did(tornstats.cfgview,100).text != $null) { writeini -n $tornstats.cfgfile Spy chan $remove($did(tornstats.cfgview,100).text,$chr(32)) }
else { if ($readini($tornstats.cfgfile,n,Spy,chan) != $null) { remini $tornstats.cfgfile Spy chan } }
if ($did(tornstats.cfgview,101).text != $null) { writeini -n $tornstats.cfgfile Spy key $did(tornstats.cfgview,101).text }
else { if ($readini($tornstats.cfgfile,n,Spy,key) != $null) { remini $tornstats.cfgfile Spy key } }
if ($did(tornstats.cfgview,102).text != $null) { writeini -n $tornstats.cfgfile Spy api $did(tornstats.cfgview,102).text }
else { if ($readini($tornstats.cfgfile,n,Spy,api) != $null) { remini $tornstats.cfgfile Spy api } }
set %tornstats.chanlist $readini($tornstats.cfgfile,n,Spy,chan)
did -ra tornstats.cfgview 999 Channel list and both keys saved.
did -ra tornstats.cfgview 100 $readini($tornstats.cfgfile,n,Spy,chan)
did -ra tornstats.cfgview 101 $readini($tornstats.cfgfile,n,Spy,key)
did -ra tornstats.cfgview 102 $readini($tornstats.cfgfile,n,Spy,api)
flushini $tornstats.cfgfile
}
menu status,channel {
www.tornstats.com Spy Database v $+ $tornstats.botvers Config:tornstats.cfg
}
alias -l tornstats.cfg {
if ($dialog(tornstats.cfgview)) { halt } | dialog -m tornstats.cfgview tornstats.cfgview
if ($readini($tornstats.cfgfile,n,Spy,enable) == yes) { did -c tornstats.cfgview 1 } | else { did -u tornstats.cfgview 1 }
if ($readini($tornstats.cfgfile,n,Spy,cache) == yes) { did -c tornstats.cfgview 2 } | else { did -u tornstats.cfgview 2 }
if ($readini($tornstats.cfgfile,n,Spy,sockerr) == yes) { did -c tornstats.cfgview 3 } | else { did -u tornstats.cfgview 3 }
did -ra tornstats.cfgview 100 $readini($tornstats.cfgfile,n,Spy,chan)
did -ra tornstats.cfgview 101 $readini($tornstats.cfgfile,n,Spy,key)
did -ra tornstats.cfgview 102 $readini($tornstats.cfgfile,n,Spy,api)
}
alias -l tornstats.cfgcheck { if (!$exists($tornstats.cfgfile)) { tornstats.upg | echo -ag www.tornstats.com Spy Database script: Default values have been written. Right click channel section for config panel. } }
; ##################################################################### SOCKET CODE #####################################################################
on *:sockopen:getinfo:{
if ($sockerr) { echo -s 4Socket Error. Socket: $sockname --- Message: $sock($sockname).wsmsg --- Num: $sock($sockname).wserr }
else {
if (%tsspy.oldspy != $null) { var %table = tsspy. $+ %tsspy.oldspy }
else { var %table = tsspy. $+ %tsspy.spy }
sockwrite -nt $sockname GET /user/ $+ $hget(%table,id) $+ ?selections=profile&key= $+ $readini($tornstats.cfgfile,n,Spy,api) HTTP/1.1
sockwrite -nt $sockname Host: api.torn.com
sockwrite -nt $sockname $crlf
}
}
on *:sockread:getinfo:{
if ($sockerr && $readini($tornstats.cfgfile,n,Spy,sockerr) == yes) { echo -s 4Socket Error. Socket: $sockname --- Message: $sock($sockname).wsmsg --- Num: $sock($sockname).wserr }
else {
var %read | sockRead %read | var %readln $remove(%read, $chr(9))
;write $qt($scriptdirtest.htm) %readln
if (%tsspy.oldspy != $null) { var %table = tsspy. $+ %tsspy.oldspy }
else { var %table = tsspy. $+ %tsspy.spy }
if ($regex(%readln,error":"(.+?)")) {
msg %tsspy.postchan 04API Error: $regml(1)
tornstats.spywrite
}
if ($regex(%readln,level":(.+?)")) { hadd %table lvl $tornstats.cleanN($regml(1)) }
if ($regex(%readln,faction_name":"(.+?)")) { hadd %table fact $tornstats.cleanW($regml(1))) }
if (($hget(%table,lvl) != $null) && ($hget(%table,fact) != $null)) { tornstats.spywrite }
}
}
on *:SOCKOPEN:spysave: {
if ($sockerr && $readini($tornstats.cfgfile,n,Spy,sockerr) == yes) { echo -s 4Socket Error. Socket: $sockname --- Message: $sock($sockname).wsmsg --- Num: $sock($sockname).wserr }
else {
if (%tsspy.oldspy != $null) { var %table = tsspy. $+ %tsspy.oldspy }
else { var %table = tsspy. $+ %tsspy.spy }
var %a = /tornbot/someelusivebotscript.php?action=spy&step=save
var %a = %a $+ &key= $+ $tornstats.uencode($readini($tornstats.cfgfile,n,Spy,key))
var %a = %a $+ &name= $+ $tornstats.uencode($hget(%table,name))
var %a = %a $+ &id= $+ $tornstats.uencode($hget(%table,id))
var %a = %a $+ &lvl= $+ $tornstats.uencode($hget(%table,lvl))
var %a = %a $+ &faction= $+ $tornstats.uencode($hget(%table,fact))
var %a = %a $+ &str= $+ $tornstats.uencode($hget(%table,str))
var %a = %a $+ &def= $+ $tornstats.uencode($hget(%table,def))
var %a = %a $+ &spd= $+ $tornstats.uencode($hget(%table,spd))
var %a = %a $+ &dex= $+ $tornstats.uencode($hget(%table,dex))
var %a = %a $+ &tot= $+ $tornstats.uencode($hget(%table,totb))
sockwrite -nt $sockname GET %a HTTP/1.1
sockwrite -nt $sockname User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
sockwrite -nt $sockname Host: www.tornstats.com
sockwrite -nt $sockname Accept-Language: en-us
sockwrite -nt $sockname Accept: */*
sockwrite -nt $sockname $crlf
}
}
on *:SOCKREAD:spysave: {
if ($sockerr && $readini($tornstats.cfgfile,n,Spy,sockerr) == yes) { echo -s 4Socket Error. Socket: $sockname --- Message: $sock($sockname).wsmsg --- Num: $sock($sockname).wserr }
else {
:nextread
sockread -f %tsspy.str
;write $qt($scriptdirtest $+ $gmt $+ .htm) %tsspy.str
if ($sockbr == 0) { return }
if (%tsspy.str == $null) { %tsspy.str = - }
if (<p> isin %tsspy.str) {
set %tsspy.response $remove(%tsspy.str,<p>,</p>)
tornstats.savetosite
sockclose spyget
}
else { goto nextread }
}
}
on *:SOCKCLOSE:spysave:{ tornstats.savetosite }
alias -l tornstats.savetosite {
if (%tsspy.postchan != $null) {
if (%tsspy.response != $null) { msg %tsspy.postchan 10 $+ %tsspy.response }
else { msg %tsspy.postchan 04Oops! The server did not send a valid response, please check your settings! }
if (%tsspy.oldspy != $null) { var %table = tsspy. $+ %tsspy.oldspy }
else { var %table = tsspy. $+ %tsspy.spy }
hfree %table
.timer0.tornstats.spyauto off
unset %tsspy.* | unset %tsprofsw.*
}
}
on *:SOCKOPEN:spyget: {
if ($sockerr && $readini($tornstats.cfgfile,n,Spy,sockerr) == yes) { echo -s 4Socket Error. Socket: $sockname --- Message: $sock($sockname).wsmsg --- Num: $sock($sockname).wserr }
else {
var %a = /tornbot/someelusivebotscript.php?action=spy&step=get
var %a = %a $+ &key= $+ $tornstats.uencode($readini($tornstats.cfgfile,n,Spy,key))
if ($gettok(%tsspy.search,1,32) == i) { var %a = %a $+ &id= $+ $tornstats.uencode($gettok(%tsspy.search,2,32)) }
else { var %a = %a $+ &name= $+ $tornstats.uencode($gettok(%tsspy.search,2,32)) }
sockwrite -nt $sockname GET %a HTTP/1.1
sockwrite -nt $sockname User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
sockwrite -nt $sockname Host: www.tornstats.com
sockwrite -nt $sockname Accept-Language: en-us
sockwrite -nt $sockname Accept: */*
sockwrite -nt $sockname $crlf
}
}
on *:SOCKREAD:spyget: {
if ($sockerr && $readini($tornstats.cfgfile,n,Spy,sockerr) == yes) { echo -s 4Socket Error. Socket: $sockname --- Message: $sock($sockname).wsmsg --- Num: $sock($sockname).wserr }
else {
:nextread
sockread -f %tsspy.read
;write $qt($scriptdirtest $+ $gmt $+ .htm) %tsspy.read
if ($sockbr == 0) { return }
if (%tsspy.read == $null) { %tsspy.read = - }
if (Name: isin %tsspy.read) { set %tsspy.name $gettok(%tsspy.read,2,32) }
if (ID: isin %tsspy.read) { set %tsspy.id $gettok(%tsspy.read,2,32) }
if (Level: isin %tsspy.read) {
set %tsspy.lvl $gettok(%tsspy.read,2,32)
if ($calc(%tsspy.lvl) == 0 || %tsspy.lvl == $null) { set %tsspy.lvl 04N/A }
}
if (Faction: isin %tsspy.read) {
set %tsspy.fac $remove(%tsspy.read,Faction:)
if (%tsspy.fac == 0 || %tsspy.fac == $null || %tsspy.fac == $chr(32)) { set %tsspy.fac 04N/A }
}
if (Strength: isin %tsspy.read) {
set %tsspy.str $gettok(%tsspy.read,2,32)
if ($calc(%tsspy.str) == 0 || %tsspy.str == $null) { set %tsspy.str 04N/A }
}
if (Defense: isin %tsspy.read) {
set %tsspy.def $gettok(%tsspy.read,2,32)
if ($calc(%tsspy.def) == 0 || %tsspy.def == $null) { set %tsspy.def 04N/A }
}
if (Speed: isin %tsspy.read) {
set %tsspy.spd $gettok(%tsspy.read,2,32)
if ($calc(%tsspy.spd) == 0 || %tsspy.spd == $null) { set %tsspy.spd 04N/A }
}
if (Dexterity: isin %tsspy.read) {
set %tsspy.dex $gettok(%tsspy.read,2,32)
if ($calc(%tsspy.dex) == 0 || %tsspy.dex == $null) { set %tsspy.dex 04N/A }
}
if (Total: isin %tsspy.read) {
set %tsspy.tot $gettok(%tsspy.read,2,32)
if ($calc(%tsspy.tot) == 0 || %tsspy.tot == $null) { set %tsspy.tot 04N/A }
}
if (Updated: isin %tsspy.read) { set %tsspy.upd $gettok($remove(%tsspy.read,</p>),2,32) }
if (Error: isin %tsspy.read) { set %tsspy.err $deltok($remove(%tsspy.read,</p>,<p>),1,32) }
if (</p> isin %tsspy.read) {
tornstats.displayspy
sockclose spyget
}
else { goto nextread }
}
}
on *:SOCKCLOSE:spyget:{ tornstats.displayspy }
alias -l tornstats.displayspy {
if (%tsspy.name != $null) {
var %age = $calc($gmt - %tsspy.upd)
if (%age >= 2592000) { var %oldtag = 04[OLD] }
else { var %oldtag = $null }
msg %tsspy.postchan 10Spy Entry for07 %tsspy.name 10[07 $+ %tsspy.id $+ 10] (Lv:07 %tsspy.lvl 10- Fact:07 %tsspy.fac $+ 10) - Added on:07 $asctime(%tsspy.upd,mmm d) 10@07 $asctime(%tsspy.upd,h:nn:ss tt) 06( $+ $duration(%age) ago) %oldtag
msg %tsspy.postchan 10Strength:07 $tornstats.addComma(%tsspy.str)
msg %tsspy.postchan 10Defense:07 $tornstats.addComma(%tsspy.def)
msg %tsspy.postchan 10Speed:07 $tornstats.addComma(%tsspy.spd)
msg %tsspy.postchan 10Dexterity:07 $tornstats.addComma(%tsspy.dex)
msg %tsspy.postchan 10Total:07 $tornstats.addComma(%tsspy.tot)
}
else {
if (%tsspy.err != $null) { msg %tsspy.postchan 04 $+ %tsspy.err }
else { msg %tsspy.postchan 04Oops! A problem has occurred, check your settings! }
}
unset %tsspy.*
}
on *:SOCKOPEN:spyfind: {
if ($sockerr && $readini($tornstats.cfgfile,n,Spy,sockerr) == yes) { echo -s 4Socket Error. Socket: $sockname --- Message: $sock($sockname).wsmsg --- Num: $sock($sockname).wserr }
else {
var %a = /tornbot/someelusivebotscript.php?action=spy&step=search $+ %tsspy.find
var %a = %a $+ &key= $+ $tornstats.uencode($readini($tornstats.cfgfile,n,Spy,key))
sockwrite -nt $sockname GET %a HTTP/1.1
sockwrite -nt $sockname User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
sockwrite -nt $sockname Host: www.tornstats.com
sockwrite -nt $sockname Accept-Language: en-us
sockwrite -nt $sockname Accept: */*
sockwrite -nt $sockname $crlf
}
}
on *:SOCKREAD:spyfind: {
if ($sockerr && $readini($tornstats.cfgfile,n,Spy,sockerr) == yes) { echo -s 4Socket Error. Socket: $sockname --- Message: $sock($sockname).wsmsg --- Num: $sock($sockname).wserr }
else {
:nextread
sockread -f %tsspy.read
;write $qt($scriptdirtest $+ $gmt $+ .htm) %tsspy.read
if ($sockbr == 0) { return }
if (%tsspy.read == $null) { %tsspy.read = - }
if (Found: isin %tsspy.read) { tornstats.spypost $gettok(%tsspy.read,2,32) $gettok(%tsspy.read,3,32) }
if (</p> isin %tsspy.read) {
tornstats.spysearchres
sockclose spyget
}
else { goto nextread }
}
}
on *:SOCKCLOSE:spyfind:{ tornstats.spysearchres }
alias -l tornstats.spysearchres {
if (%tsspy.postchan != $null) {
if (%tsspy.post != $null) { msg %tsspy.postchan $left(%tsspy.post, $calc($len(%tsspy.post) - 1)) $+ $chr(46) }
if (%tsspy.found != $null) { msg %tsspy.postchan 10Total:7 %tsspy.found 10spies! }
else { msg %tsspy.postchan 04There were no spies found for that query. }
unset %tsspy.*
}
}
; ##################################################################### ALIAS CODE #####################################################################
alias -l tornstats.addComma { var %a, %b = $regsub($ticks,$1,/\G([+-]?\d+?)(?=(?:\d{3})++(?=\.\d++$|$))/g,\1 $+ $chr(44),%a) | return %a }
; strips all input ascii chars aside from decimals and numbers. Used to clean accidental/intentional letters in inputs that expect numbers.
alias -l tornstats.cleanN {
var %a = 0 | var %b = $1
while (%a < 255) { if (%a != 46 && %a !isnum 48-57) { var %b = $remove(%b, $chr(%a)) } | inc %a }
return %b
}
; strips leading and trailing whitespace
alias -l tornstats.cleanW { var %a, %b = $regsub($ticks,$1,^[ \t]+|[ \t]+$,$null,%a) | return %a }
alias -l tornstats.uencode {
var %a = $replace($1-,$chr(37),$+($chr(37),25)), %ptr = 32
while (%ptr <= 126) {
if (%ptr == 37) { inc %ptr | continue }
if (%ptr >= 48 && %ptr <= 57) { inc %ptr | continue }
if (%ptr >= 65 && %ptr <= 90) { inc %ptr | continue }
if (%ptr >= 97 && %ptr <= 122) { inc %ptr | continue }
var %a = $replace(%a,$chr(%ptr),$+($chr(37),$base(%ptr,10,16)))
inc %ptr
}
return %a
}
alias -l tornstats.spywrite {
sockclose getinfo
if ($timer(0.tornstats.spyscrape)) { .timer $+ 0.tornstats.spyscrape off }
if (%tsspy.oldspy != $null) { var %table = tsspy. $+ %tsspy.oldspy }
else { var %table = tsspy. $+ %tsspy.spy }
if ($hget(%table,id) != $null) {
msg %tsspy.postchan 10Saving spy entry for07 $hget(%table,name) 10[07 $+ $hget(%table,id) $+ 10] to tornstats.com...
if (!$hfind(%table,fact) || $hget(%table,fact) == $null) { hadd -m %table fact N/A }
if (!$hfind(%table,lvl) || $hget(%table,lvl) !isnum) { hadd -m %table lvl 0 }
if ($readini($tornstats.cfgfile,n,Spy,cache) == yes) {
var %savestring = $hget(%table,name) $+ $chr(9) $+ $hget(%table,id) $+ $chr(9) $+ $hget(%table,lvl) $+ $chr(9) $+ $hget(%table,fact) $+ $chr(9) $+ $hget(%table,spd) $+ $chr(9) $+ $hget(%table,str) $+ $chr(9) $+ $hget(%table,def) $+ $chr(9) $+ $hget(%table,dex) $+ $chr(9) $+ $hget(%table,totb) $+ $chr(9) $+ $hget(%table,man) $+ $chr(9) $+ $hget(%table,int) $+ $chr(9) $+ $hget(%table,end) $+ $chr(9) $+ $hget(%table,totw) $+ $chr(9) $+ $hget(%table,cash) $+ $chr(9) $+ %tsspy.spy $+ $chr(9) $+ $hget(%table,adate)
if ($exists($tornstats.localfile)) {
var %eof = $lines($tornstats.localfile), %ptr = 1
while (%ptr <= %eof) {
var %readid = $gettok($read($tornstats.localfile,%ptr),2,9)
if (%readid == $hget(%table,id)) { var %spyold = 1 | write -dl $+ %ptr $tornstats.localfile | break }
inc %ptr
}
}
write $tornstats.localfile %savestring
}
sockclose spysave
sockopen -e spysave www.tornstats.com 443
}
else {
msg %tsspy.postchan 04I somehow do not have the ID so I cannot save the spy. Cancelling.
tornstats.spyclean
}
}
alias -l tornstats.spysave {
if (%tsspy.oldspy != $null) { var %table = tsspy. $+ %tsspy.oldspy }
else { var %table = tsspy. $+ %tsspy.spy }
if ($hget(%table,id) == $null) {
msg %tsspy.postchan 04The ID was not successfully read. Paste your spy exactly how Torn sends it to you without modification.
msg %tsspy.postchan 10Use:07 !addspy 10to see manual input help.
}
else {
if (!$hfind(%table,str) || $hget(%table,str) !isnum) { hadd -m %table str 0 }
if (!$hfind(%table,spd) || $hget(%table,spd) !isnum) { hadd -m %table spd 0 }
if (!$hfind(%table,dex) || $hget(%table,dex) !isnum) { hadd -m %table dex 0 }
if (!$hfind(%table,def) || $hget(%table,def) !isnum) { hadd -m %table def 0 }
if (!$hfind(%table,totb) || $hget(%table,totb) !isnum) { hadd -m %table totb 0 }
if (!$hfind(%table,man) || $hget(%table,man) !isnum) { hadd -m %table man 0 }
if (!$hfind(%table,int) || $hget(%table,int) !isnum) { hadd -m %table int 0 }
if (!$hfind(%table,end) || $hget(%table,end) !isnum) { hadd -m %table end 0 }
if (!$hfind(%table,totw) || $hget(%table,totw) !isnum) { hadd -m %table totw 0 }
if (!$hfind(%table,cash) || $hget(%table,cash) !isnum) { hadd -m %table cash -1 }
if (!$hfind(%table,adate)) { hadd -m %table adate $gmt }
sockclose getinfo
sockopen -e getinfo www.torn.com 443
msg %tsspy.postchan 06Attempting to get additional info from the API (5 seconds max)...
.timer $+ 0.tornstats.spyscrape 1 5 tornstats.spywrite
}
}
alias -l tornstats.spycancel {
msg %tsspy.postchan 10Spy auto-entry cancelled.
tornstats.spyclean
}
; called in a few places
alias -l tornstats.spyclean {
if ($hget(tsspy. $+ %tsspy.spy)) { hfree tsspy. $+ %tsspy.spy }
unset %tsspy.spy | unset %tsspy.postchan
}
alias -l tornstats.spypost {
; $1 is name, $2 is id
if (%tsspy.found == $null) { set %tsspy.found 0 }
if (%tsspy.ptr == $null) { set %tsspy.ptr 1 }
set %tsspy.post %tsspy.post 07 $+ $1 10[07 $+ $2 $+ 10] $+ $chr(44)
inc %tsspy.ptr
inc %tsspy.found
if (%tsspy.ptr == 7) {
msg %tsspy.postchan %tsspy.post
set %tsspy.ptr 1
set %tsspy.post $null
}
}
alias -l tornstats.bq {
; query string builder for findspy
var %src = $1, %query = $null, %count = $numtok(%src,32), %ptr = 1
while (%ptr <= %count) {
var %prop = $gettok(%src,%ptr,32)
var %data = $right(%prop,-4)
if (%data == $null) {
msg %tsspy.postchan 04Don't understand your query, use !findspy without params to see some examples
unset %tsspy.*
halt
}
if ($left(%prop,4) == Fac:) { var %query = %query $+ &faction= $+ %data }
if ($left(%prop,3) == Str) {
if ($mid(%prop,4,1) == $chr(60)) { var %param = l } | else { var %param = g }
var %query = %query $+ &str= $+ $replace(%data,k,000,m,000000,b,000000000,t,000000000000) $+ &strd= $+ %param
}
if ($left(%prop,3) == Spd) {
if ($mid(%prop,4,1) == $chr(60)) { var %param = l } | else { var %param = g }
var %query = %query $+ &spd= $+ $replace(%data,k,000,m,000000,b,000000000,t,000000000000) $+ &spdd= $+ %param
}
if ($left(%prop,3) == Dex) {
if ($mid(%prop,4,1) == $chr(60)) { var %param = l } | else { var %param = g }
var %query = %query $+ &dex= $+ $replace(%data,k,000,m,000000,b,000000000,t,000000000000) $+ &dexd= $+ %param
}
if ($left(%prop,3) == Def) {
if ($mid(%prop,4,1) == $chr(60)) { var %param = l } | else { var %param = g }
var %query = %query $+ &def= $+ $replace(%data,k,000,m,000000,b,000000000,t,000000000000) $+ &defd= $+ %param
}
if ($left(%prop,3) == Tot) {
if ($mid(%prop,4,1) == $chr(60)) { var %param = l } | else { var %param = g }
var %query = %query $+ &tot= $+ $replace(%data,k,000,m,000000,b,000000000,t,000000000000) $+ &totd= $+ %param
}
inc %ptr
}
return %query
;msg #pmv src = %src | msg #pmv query = %query | halt
}
alias -l tornstats.addspyhelp { return 03Adds a spy to the bot. Manual usage: 07!addspy Name TornID Str Spd Dex Def Total 10Faction (optional). 10To add automatically, use: 07!addspy auto 10if you have the full paste, or 07!addspy Name TornID auto 10if you only have the stats portion. 06For automatic pre-RESPO reports, use: !addspy old }
; ##################################################################### CHANNEL CODE #####################################################################
on *:text:*:%tornstats.chanlist: {
if ($readini($tornstats.cfgfile,n,Spy,enable) == yes) {
tornstats.cfgcheck
tokenize 32 $strip($replace($1-, $chr(9), $chr(32)))
if ($eval($findfile,0) isin $1-) { halt }
if ($nick isop #) {
if (%tsspy.spy == $nick) {
var %tablename = tsspy. $+ %tsspy.spy
if ($istok(Strength: Speed: Defense: Dexterity: Total:,$1,32)) {
.timer $+ 0.tornstats.spyauto off
.timer $+ %tsspy.spy $+ .spy -co 1 5 tornstats.spysave
}
if ($1 == Name:) {
hadd -m %tablename name $2
hadd -m %tablename id $remove($3,$chr(91),$chr(93))
}
if ($1 == Level:) { hadd -m %tablename lvl $2 }
if ($1 == Strength:) { hadd -m %tablename str $remove($2,$chr(44),$chr(32)) }
if ($1 == Speed:) { hadd -m %tablename spd $remove($2,$chr(44),$chr(32)) }
if ($1 == Defense:) { hadd -m %tablename def $remove($2,$chr(44),$chr(32)) }
if ($1 == Dexterity:) { hadd -m %tablename dex $remove($2,$chr(44),$chr(32)) }
if ($1 == Total:) {
if ($hget(%tablename,end)) { hadd -m %tablename totw $remove($2,$chr(44),$chr(32)) }
else { hadd -m %tablename totb $remove($2,$chr(44),$chr(32)) }
}
}
if (%tsspy.oldspy == $nick) {
var %tablename = tsspy. $+ %tsspy.oldspy
if ($istok(Name: Level: Strength: Speed: Defense: Dexterity: Total: Manual Intelligence: Endurance: Money:,$1,32)) {
.timer $+ 0.tornstats.spyauto off
.timer $+ %tsspy.spy $+ .spy -co 1 5 tornstats.spysave
}
if ($1 == Name:) {
hadd -m %tablename name $2
hadd -m %tablename id $remove($3,$chr(91),$chr(93))
}
if ($1 == Level:) { hadd -m %tablename lvl $2 }
if ($1 == Strength:) { hadd -m %tablename str $remove($2,$chr(44),$chr(32)) }
if ($1 == Speed:) { hadd -m %tablename spd $remove($2,$chr(44),$chr(32)) }
if ($1 == Defense:) { hadd -m %tablename def $remove($2,$chr(44),$chr(32)) }
if ($1 == Dexterity:) { hadd -m %tablename dex $remove($2,$chr(44),$chr(32)) }
if ($1 == Total:) {
if ($hget(%tablename,end)) { hadd -m %tablename totw $remove($2,$chr(44),$chr(32)) }
else { hadd -m %tablename totb $remove($2,$chr(44),$chr(32)) }
}
if ($1 == Manual) { hadd -m %tablename man $remove($3,$chr(44),$chr(32)) }
if ($1 == Intelligence:) { hadd -m %tablename int $remove($2,$chr(44),$chr(32)) }
if ($1 == Endurance:) { hadd -m %tablename end $remove($2,$chr(44),$chr(32)) }
if ($1 == Money:) { hadd -m %tablename cash $remove($2,$chr(36),$chr(44),$chr(32)) }
}
if ($1 == !purgespy || $1 == !spypurge) {
msg # 10The spy storage script should be 'unstuck' now. Sorry about that...
unset %tsspy.*
}
if ($1 == !addspy || $1 == !storespy) {
if (%tsspy.oldspy != $null || %tsspy.spy != $null) { msg # 04I'm already watching for a spy paste! | halt }
elseif (($2 == $null) || (auto !isin $2- && $numtok($2-,32) < 7)) { msg # $tornstats.addspyhelp | halt }
elseif ($2 == old && $3 == $null) { var %spyoldauto = 1 }
elseif ($3 == old && $4 == $null) { var %spyoldauto = 1 }
elseif ($4 == old && $5 == $null) { var %spyoldauto = 1, %spyname = $remove($2,$chr(32)), %spyid = $remove($3,$chr(32),$chr(93),$chr(91)) }
elseif ($2 == auto && $3 == $null) { var %spyauto = 1 }
elseif ($3 == auto && $4 == $null) { msg # $tornstats.addspyhelp | halt }
elseif ($4 == auto && $5 == $null) { var %spyauto = 1, %spyname = $remove($2,$chr(32)), %spyid = $remove($3,$chr(32),$chr(93),$chr(91)) }
else {
set %tsspy.postchan #
set %tsspy.spy $nick
var %tablename = tsspy. $+ $nick
var %chk = 1, %chkstr = $replace($2-,Strength:,$chr(32) $+ Strength:,Speed:,$chr(32) $+ Speed:,Dexterity:,$chr(32) $+ Dexterity:,Defense:,$chr(32) $+ Defense:,Total:,$chr(32) $+ Total:)
while (%chk < $numtok(%chkstr,32)) {
if ($gettok(%chkstr,%chk,32) == Speed:) { var %spd = $tornstats.cleanN($gettok(%chkstr,$calc(%chk + 1),32)) }
if ($gettok(%chkstr,%chk,32) == Strength:) { var %str = $tornstats.cleanN($gettok(%chkstr,$calc(%chk + 1),32)) }
if ($gettok(%chkstr,%chk,32) == Defense:) { var %def = $tornstats.cleanN($gettok(%chkstr,$calc(%chk + 1),32)) }
if ($gettok(%chkstr,%chk,32) == Dexterity:) { var %dex = $tornstats.cleanN($gettok(%chkstr,$calc(%chk + 1),32)) }
if ($gettok(%chkstr,%chk,32) == Total:) { var %tot = $tornstats.cleanN($gettok(%chkstr,$calc(%chk + 1),32)) | var %totmark = $calc(%chk + 1) }
inc %chk
}
if (%spd == $null) {
var %chkspd = $tornstats.cleanN($5)
if (%chkspd isnum) { var %spd = %chkspd }
}
if (%str == $null) {
var %chkstr = $tornstats.cleanN($4)
if (%chkstr isnum) { var %str = %chkstr }
}
if (%def == $null) {
var %chkdef = $tornstats.cleanN($7)
if (%chkdef isnum) { var %def = %chkdef }
}
if (%dex == $null) {
var %chkdex = $tornstats.cleanN($6)
if (%chkdex isnum) { var %dex = %chkdex) }
}
if (%tot == $null) {
var %chktot = $tornstats.cleanN($8)
if (%chktot isnum) { var %tot = %chktot }
}
if (%totmark != $null) {
var %clnstart = 1, %fac = $2-
while (%clnstart <= %totmark) { var %fac = $deltok(%fac,1,32) | inc %clnstart }
}
elseif ($9 != $null) { var %fac = $9- }
else { var %fac = $null }
hadd -m %tablename name $2
hadd -m %tablename id $remove($3,$chr(91),$chr(93))
hadd -m %tablename spd %spd
hadd -m %tablename str %str
hadd -m %tablename def %def
hadd -m %tablename dex %dex
hadd -m %tablename totb %tot
if (%fac != $null) { hadd -m %tablename fact %fac }
tornstats.spysave
}
if (%spyoldauto != $null) {
set %tsspy.oldspy $nick
set %tsspy.postchan #
if (%tablename == $null) { var %tablename = tsspy. $+ $nick }
if (%spyname != $null) { hadd -m %tablename name %spyname }
if (%spyid != $null) { hadd -m %tablename id %spyid }
.timer $+ 0.tornstats.spyauto 1 10 tornstats.spycancel
msg # 10Go ahead and paste your pre-RESPO spy report07 $nick $+ 10, I'm watching for it...
}
if (%spyauto != $null) {
set %tsspy.spy $nick
set %tsspy.postchan #
if (%tablename == $null) { var %tablename = tsspy. $+ $nick }
if (%spyname != $null) { hadd -m %tablename name %spyname }
if (%spyid != $null) { hadd -m %tablename id %spyid }
.timer $+ 0.tornstats.spyauto 1 10 tornstats.spycancel
msg # 10Go ahead and paste your spy report7 $nick $+ 10, I'm watching for it...
}
}
if ($1 == !spy || $1 == !read) {
if ($2 == $null) { msg # 03Displays stored spy record. 10Usage:07 !spy Name 10or07 !read ID | halt }
if (!$timer(0.tornstats.spam)) {
set %tsspy.postchan #
if ($1 == !read) { set %tsspy.search i $2 }
else { set %tsspy.search n $2 }
sockclose spyget
sockopen -e spyget www.tornstats.com 443
.timer $+ 0.tornstats.spam -o 1 10 noop
}
else { msg # 04No can do, too many requests too often. You can try again in07 $timer(0.tornstats.spam).secs 04seconds. }
}
if ($1 == !findspy || $1 == !spyfind) {
if ($2 == $null || Fac: !isin $2-) {
msg # 03Searches for a spy. 10Usage:07 !findspy Query 10- Param List:07 Fac(reqd) Str Dex Def Spd Tot
msg # 06Example:13 !findspy Fac:test Str>100k Dex<2m Tot:6m 10will search for anyone in faction "test", over 100k str, under 2m dex, and over 6m total stats.
halt
}
if (!$timer(0.tornstats.spam)) {
set %tsspy.postchan #
set %tsspy.find $tornstats.bq($2-)
msg # 10Searching for spies, one sec...
sockclose spyfind
sockopen -e spyfind www.tornstats.com 443
.timer $+ 0.tornstats.spam -o 1 5 noop
}
else { msg # 04No can do, too many requests too often. You can try again in07 $timer(0.tornstats.spam).secs 04seconds. }
}
if ($1 == !botinfo) { msg # 10 $+ www.tornstats.com Spy Database script made by: $+ 07 PMV 10[07157799310] v $+ 07 $+ $tornstats.botvers }
}
}
}
; --------------------------------- initial file generators and setup script ---------------------------------
alias -l tornstats.upg {
writeini -n $tornstats.cfgfile Spy vers $tornstats.botvers
if ($readini($tornstats.cfgfile,n,Spy,enable) == $null) { writeini -n $tornstats.cfgfile Spy enable no }
if ($readini($tornstats.cfgfile,n,Spy,cache) == $null) { writeini -n $tornstats.cfgfile Spy cache no }
if ($readini($tornstats.cfgfile,n,Spy,sockerr) == $null) { writeini -n $tornstats.cfgfile Spy sockerr no }
flushini $tornstats.cfgfile
}

1
vendor/README.md поставляемый
Просмотреть файл

@ -464,6 +464,7 @@ This is a list of grammars that Linguist selects to provide syntax highlighting
- **eC:** [ecere/ec.tmbundle](https://github.com/ecere/ec.tmbundle)
- **edn:** [atom/language-clojure](https://github.com/atom/language-clojure)
- **fish:** [l15n/fish-tmbundle](https://github.com/l15n/fish-tmbundle)
- **mIRC Script:** [gen-angry/language-msl](https://github.com/gen-angry/language-msl)
- **mcfunction:** [Arcensoth/language-mcfunction](https://github.com/Arcensoth/language-mcfunction)
- **mupad:** [ccreutzig/sublime-MuPAD](https://github.com/ccreutzig/sublime-MuPAD)
- **nanorc:** [Alhadis/language-etc](https://github.com/Alhadis/language-etc)

1
vendor/grammars/language-msl поставляемый Submodule

@ -0,0 +1 @@
Subproject commit 8418ec2b4afe24660f05f0ddf9115d0beb3beb85

27
vendor/licenses/grammar/language-msl.txt поставляемый Normal file
Просмотреть файл

@ -0,0 +1,27 @@
---
type: grammar
name: language-msl
version: 8418ec2b4afe24660f05f0ddf9115d0beb3beb85
license: mit
---
MIT License
Copyright (c) 2017 lol2k
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.