Skip to content

Commit

Permalink
Merge pull request #18 from endavis/master
Browse files Browse the repository at this point in the history
update from master to r2098
  • Loading branch information
endavis authored Sep 11, 2017
2 parents e80843f + 1d1d3a4 commit 6fedd20
Show file tree
Hide file tree
Showing 7 changed files with 140 additions and 25 deletions.
10 changes: 10 additions & 0 deletions Bast/BastmushChanges.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
Bastmush Changes List

r2098 snapshot
- pluginhelper
- change web address
- broadcast_quest
- added qp for hardcore and opk
- statdb
- added columns for hardcore and opk qp
- miniwin_stats
- added output for hardcore and opk qp

r2097 snapshot
- miniwin
- updates for changes to the AardMUSH client
Expand Down
12 changes: 10 additions & 2 deletions Bast/StatMonitor.xml
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,17 @@ function formatquest()
table.insert(tmsg, colourwrap('+'))
table.insert(tmsg, colourwrap(quest_stuff.mccp, 'stat'))
end
if quest_stuff.tier and tonumber(quest_stuff.tier) > 0 then
if quest_stuff.tierqp and tonumber(quest_stuff.tierqp) > 0 then
table.insert(tmsg, colourwrap('+'))
table.insert(tmsg, colourwrap(quest_stuff.tier, 'stat'))
table.insert(tmsg, colourwrap(quest_stuff.tierqp, 'stat'))
end
if quest_stuff.opk and tonumber(quest_stuff.opk) > 0 then
table.insert(tmsg, colourwrap('+'))
table.insert(tmsg, colourwrap(quest_stuff.opk, 'stat'))
end
if quest_stuff.hardcore and tonumber(quest_stuff.hardcore) > 0 then
table.insert(tmsg, colourwrap('+'))
table.insert(tmsg, colourwrap(quest_stuff.hardcore, 'stat'))
end
if quest_stuff.daily and tonumber(quest_stuff.daily) == 1 then
table.insert(tmsg, colourwrap('+'))
Expand Down
8 changes: 6 additions & 2 deletions Bast/broadcast_quest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,15 @@ function blankquest ()
quest_info.double = 0
quest_info.qp = 0
quest_info.gold = 0
quest_info.tier = 0
quest_info.tierqp = 0
quest_info.mccp = 0
quest_info.lucky = 0
quest_info.tp = 0
quest_info.trains = 0
quest_info.pracs = 0
quest_info.failed = 0
quest_info.hardcore = 0
quest_info.opk = 0
return quest_info
end
Expand Down Expand Up @@ -243,7 +245,7 @@ function OnPluginBroadcast (msg, id, name, text)
elseif stuff.action == 'comp' then
phelper.tquest['qp'] = stuff.qp
phelper.tquest['gold'] = stuff.gold
phelper.tquest['tier'] = stuff.tierqp
phelper.tquest['tierqp'] = stuff.tierqp
phelper.tquest['lucky'] = stuff.lucky
phelper.tquest['mccp'] = stuff.mccp
phelper.tquest['tp'] = stuff.tp
Expand All @@ -252,6 +254,8 @@ function OnPluginBroadcast (msg, id, name, text)
phelper.tquest['finishtime'] = GetInfo(304)
phelper.tquest['double'] = 0
phelper.tquest['daily'] = 0
phelper.tquest['hardcore'] = stuff.hardcore
phelper.tquest['opk'] = stuff.opk
phelper.tquest['totqp'] = tonumber(stuff.totqp)
if tonumber(stuff.double) == 1 then
phelper.tquest['double'] = 1
Expand Down
69 changes: 67 additions & 2 deletions Bast/lua/chardb.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,14 @@ require 'tablefuncs'

Statdb = Sqlitedb:subclass()

function donothing(args)

end

function Statdb:initialize(args)
super(self, args) -- notice call to superclass's constructor
self.dbname = "\\stats.db"
self.version = 14
self.version = 16
self.versionfuncs[2] = self.updatedblqp -- update double qp flag
self.versionfuncs[3] = self.updatemobkills -- slit, assassinate, etc..
self.versionfuncs[4] = self.addmobsblessing -- add blessing xp to mobs table
Expand All @@ -45,6 +49,8 @@ function Statdb:initialize(args)
self.versionfuncs[12] = self.addbonusqpcp
self.versionfuncs[13] = self.addrarexp_v13
self.versionfuncs[14] = self.addnoexp_v14
self.versionfuncs[15] = donothing
self.versionfuncs[16] = self.addhardcoreopk_v16

self:addtable('stats', [[CREATE TABLE stats(
stat_id INTEGER NOT NULL PRIMARY KEY autoincrement,
Expand Down Expand Up @@ -87,9 +93,11 @@ function Statdb:initialize(args)
daily INT default 0,
totqp INT default 0,
gold INT default 0,
tier INT default 0,
tierqp INT default 0,
mccp INT default 0,
lucky INT default 0,
opk INT default 0,
hardcore INT default 0,
tp INT default 0,
trains INT default 0,
pracs INT default 0,
Expand Down Expand Up @@ -1485,3 +1493,60 @@ function Statdb:addnoexp_v14()
self:close('addnoexp_v14_2')
end
end

function Statdb:addhardcoreopk_v16()
if not self:checktableexists('quests') then
return
end
if self:open('addhardcoreopk_v161') then
local oldquests = {}
for a in self.db:nrows("SELECT * FROM quests") do
oldquests[a.quest_id] = a
oldquests[a.quest_id]['hardcore'] = 0
oldquests[a.quest_id]['opk'] = 0
oldquests[a.quest_id]['tierqp'] = a.tier
end
self:close('addhardcoreopk_v161', true)
self:open('addhardcoreopk_v162')
self.db:exec([[DROP TABLE IF EXISTS quests;]])
self:close('addhardcoreopk_v162', true)
self:open('addhardcoreopk_v163')
self.db:exec([[CREATE TABLE quests(
quest_id INTEGER NOT NULL PRIMARY KEY autoincrement,
starttime INT default 0,
finishtime INT default 0,
mobname TEXT default "Unknown",
mobarea TEXT default "Unknown",
mobroom TEXT default "Unknown",
qp INT default 0,
double INT default 0,
daily INT default 0,
totqp INT default 0,
gold INT default 0,
tierqp INT default 0,
mccp INT default 0,
lucky INT default 0,
opk INT default 0,
hardcore INT default 0,
tp INT default 0,
trains INT default 0,
pracs INT default 0,
level INT default -1,
failed INT default 0
)]])
assert (self.db:exec("BEGIN TRANSACTION"))
local stmt = self.db:prepare[[ INSERT INTO quests VALUES (:quest_id, :starttime, :finishtime,
:mobname, :mobarea, :mobroom, :qp, :double, :daily, :totqp,
:gold, :tierqp, :mccp, :lucky, :opk, :hardcore, :tp,
:trains, :pracs, :level, :failed) ]]

for i,v in tableSort(oldquests, 'quest_id') do
stmt:bind_names(v)
stmt:step()
stmt:reset()
end
stmt:finalize()
assert (self.db:exec("COMMIT"))
self:close('addhardcoreopk_v163')
end
end
8 changes: 7 additions & 1 deletion Bast/lua/phelpobject.lua
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,12 @@ function Phelpobject:registerevent(tevent, object, tfunction, plugin)
end
end
if not found then
table.insert(self.events[tevent], {object=object or {}, func=tfunction, plugin=plugin})
if not plugin then
pluginname = 'None'
else
pluginname = GetPluginInfo(plugin, 1)
end
table.insert(self.events[tevent], {object=object or {}, func=tfunction, plugin=plugin, name=pluginname})
end
end

Expand All @@ -208,6 +213,7 @@ function Phelpobject:processevent(tevent, args)
end
DoAfterSpecial(.1, funcstr, sendto.script)
else

if v.func then
v.func(v.object, args)
end
Expand Down
2 changes: 1 addition & 1 deletion Bast/lua/pluginhelper.lua
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function Pluginhelper:initialize(args)
self:add_setting('cmd', {help="the command to type for this plugin", type="string", after="set_plugin_alias", default="mb", longname="Plugin Command", sortlev=99})
self:add_setting('time', {help="show function timers", type="bool", default=false, sortlev=99})

self:addlink('Plugin', "Bast's MUSHclient plugins homepage", "http://code.google.com/p/bastmush",
self:addlink('Plugin', "Bast's MUSHclient plugins homepage", "https://github.com/endavis/bastmush",
"Go to Bast's MUSHclient plugins homepage")
self:addlink('MUSHclient', "Get Dina a monospace bitmap font. (recommended)", "http://www.donationcoder.com/Software/Jibz/Dina/index.html",
"Follow the instruction on the site to install the font.")
Expand Down
56 changes: 39 additions & 17 deletions Bast/miniwin_stats.xml
Original file line number Diff line number Diff line change
Expand Up @@ -508,13 +508,17 @@ function build_quest_window()
end
for a in db.db:nrows([[SELECT AVG(finishtime - starttime) as avetime,
SUM(qp) as qp,
SUM(tier) as tier,
AVG(tier) as avetier,
AVG(qp) as qpquestave,
SUM(tierqp) as tierqp,
AVG(tierqp) as tierqpave,
SUM(mccp) as mccp,
AVG(mccp) as mccpave,
SUM(lucky) as lucky,
AVG(qp) as qpquestave,
AVG(lucky) as luckave,
AVG(lucky) as luckyave,
SUM(hardcore) as hardcore,
AVG(hardcore) as hardcoreave,
SUM(opk) as opk,
AVG(opk) as opkave,
SUM(tp) as tp,
AVG(tp) as tpave,
SUM(trains) as trains,
Expand All @@ -528,16 +532,20 @@ function build_quest_window()
AVG(gold) as avegold FROM quests where failed = 0]]) do
stats['avetime'] = a['avetime']
stats['qp'] = a['qp']
stats['tier'] = a['tier']
stats['avetier'] = a['avetier'] or 0
if stats['avetier'] == "" then
stats['avetier'] = 0
stats['qpquestave'] = a['qpquestave']
stats['tierqp'] = a['tierqp']
stats['tierqpave'] = a['tierqpave'] or 0
if stats['tierqpave'] == "" then
stats['tierqpave'] = 0
end
stats['mccp'] = a['mccp']
stats['mccpave'] = a['mccpave']
stats['hardcore'] = a['hardcore']
stats['hardcoreave'] = a['hardcoreave']
stats['opk'] = a['opk']
stats['opkave'] = a['opkave']
stats['lucky'] = a['lucky']
stats['qpquestave'] = a['qpquestave']
stats['luckyave'] = a['luckave']
stats['luckyave'] = a['luckyave']
stats['tp'] = a['tp']
stats['tpave'] = a['tpave']
stats['trains'] = a['trains']
Expand Down Expand Up @@ -586,8 +594,16 @@ function build_quest_window()
string.format("%.3f", stats['luckyave'] or 0) .. '/quest')
table.insert(allstyles, linestyles)
local linestyles = format_row("Tier",
stats['tier'],
string.format("%.3f", stats['avetier'] or 0) .. '/quest')
stats['tierqp'],
string.format("%.3f", stats['tierqpave'] or 0) .. '/quest')
table.insert(allstyles, linestyles)
local linestyles = format_row("PK",
stats['opk'],
string.format("%.3f", stats['opkave'] or 0) .. '/quest')
table.insert(allstyles, linestyles)
local linestyles = format_row("HC",
stats['hardcore'],
string.format("%.3f", stats['hardcoreave'] or 0) .. '/quest')
table.insert(allstyles, linestyles)
local linestyles = format_row("QP Per Quest", "", string.format("%.3f", stats['dboverallave'] or 0) .. '/quest')
table.insert(allstyles, linestyles)
Expand Down Expand Up @@ -756,7 +772,7 @@ function build_quest_window()
table.insert(lstyle, style)
local style = {}
style.text = string.format("%2d ", v.tier or 0)
style.text = string.format("%2d ", v.tierqp or 0)
style.mouseup = nofunc
style.hint = hint
style.textcolour = "white"
Expand Down Expand Up @@ -793,17 +809,23 @@ function build_quest_window()
if v.mccp > 0 then
thint = thint .. "+" .. tostring(v.mccp) .. "(mccp)"
end
if v.tier > 0 then
thint = thint .. "+" .. tostring(v.tier) .. "(tier)"
if v.tierqp > 0 then
thint = thint .. "+" .. tostring(v.tierqp) .. "(tier)"
end
if v.lucky > 0 then
thint = thint .. "+" .. tostring(v.lucky) .. "(lucky)"
end
if v.hardcore > 0 then
thint = thint .. "+" .. tostring(v.hardcore) .. "(hardcore)"
end
if v.opk > 0 then
thint = thint .. "+" .. tostring(v.opk) .. "(opk)"
end
if v.double == 1 then
thint = thint .. "+" .. "D"
thint = thint .. "+" .. "Double"
end
if v.daily == 1 then
thint = thint .. "+" .. "E"
thint = thint .. "+" .. "Daily"
end
style.hint = thint
style.textcolour = "white"
Expand Down

0 comments on commit 6fedd20

Please sign in to comment.