From 53cd83f3d15992ef9438c986333cb3f582dff01e Mon Sep 17 00:00:00 2001 From: bozimmerman Date: Mon, 11 Nov 2024 23:26:54 +0000 Subject: [PATCH] Various tweeks and fixes, mostly gmcp related git-svn-id: svn://192.168.1.10/public/CoffeeMud@23502 0d6f1817-ed0e-0410-87c9-987e46238f29 --- com/planet_ink/coffee_mud/Commands/Switch.java | 2 +- com/planet_ink/coffee_mud/Common/DefaultSession.java | 11 +++++++++-- .../coffee_mud/Common/DefaultTriggerer.java | 5 ++++- com/planet_ink/coffee_mud/Libraries/CMProtocols.java | 4 ++-- com/planet_ink/coffee_mud/Libraries/CoffeeShops.java | 6 ++++++ 5 files changed, 22 insertions(+), 6 deletions(-) diff --git a/com/planet_ink/coffee_mud/Commands/Switch.java b/com/planet_ink/coffee_mud/Commands/Switch.java index 036025f35a..b75a6d8e05 100644 --- a/com/planet_ink/coffee_mud/Commands/Switch.java +++ b/com/planet_ink/coffee_mud/Commands/Switch.java @@ -197,8 +197,8 @@ public boolean execute(final MOB mob, final List commands, final int met sess.stopSession(true, true, true); else { + sess.setStat("CPING", "true"); CMLib.login().showTheNews(target); - Log.sysOut(mob.Name()+" switched login to: "+target.Name()); } } diff --git a/com/planet_ink/coffee_mud/Common/DefaultSession.java b/com/planet_ink/coffee_mud/Common/DefaultSession.java index 6776d54dac..d0cb84cf50 100644 --- a/com/planet_ink/coffee_mud/Common/DefaultSession.java +++ b/com/planet_ink/coffee_mud/Common/DefaultSession.java @@ -3657,7 +3657,7 @@ public void setIdleTimers() private static enum SESS_STAT_CODES {PREVCMD,ISAFK,AFKMESSAGE,ADDRESS,IDLETIME, LASTMSG,LASTNPCFIGHT,LASTPKFIGHT,TERMTYPE, TOTALMILLIS,TOTALTICKS,WRAP,LASTLOOPTIME, - ROOMLOOK,TWRAP,PPING} + ROOMLOOK,TWRAP,PPING,CPING} @Override public int getSaveStatIndex() @@ -3719,8 +3719,8 @@ public String getStat(final String code) case LASTLOOPTIME: return CMLib.time().date2String(getInputLoopTime()); case ROOMLOOK: - break; // do nothing case PPING: + case CPING: break; // do nothing case TWRAP: return ""+this.terminalWidth; @@ -3783,6 +3783,13 @@ public void setStat(final String code, final String val) case LASTLOOPTIME: lastLoopTop = CMLib.time().string2Millis(val); break; + case CPING: + if(getClientTelnetMode(TELNET_GMCP)) + { + this.gmcpPings.clear(); + this.doProtocolPings(); + } + break; case PPING: this.gmcpPings.remove("system.nextMedReport"); this.doProtocolPings(); diff --git a/com/planet_ink/coffee_mud/Common/DefaultTriggerer.java b/com/planet_ink/coffee_mud/Common/DefaultTriggerer.java index 03108ec962..93babecf6b 100644 --- a/com/planet_ink/coffee_mud/Common/DefaultTriggerer.java +++ b/com/planet_ink/coffee_mud/Common/DefaultTriggerer.java @@ -1521,7 +1521,10 @@ protected TrigState stepGetCompleted(final MOB hostM, final Object key, final CM case DRINK: case EAT: if((msg.target()!=null) - &&(DT.parm1.equals("0")||containsString(msg.target().name(),DT.parm1))) + &&(DT.parm1.equals("0") + ||containsString(msg.target().name(),DT.parm1) + ||((msg.target() instanceof Item) + &&(containsString(RawMaterial.CODES.NAME(((Item)msg.target()).material()),DT.parm1))))) { if(state == null) state = getCreateTrigState(hostM, key); diff --git a/com/planet_ink/coffee_mud/Libraries/CMProtocols.java b/com/planet_ink/coffee_mud/Libraries/CMProtocols.java index 8857e4eac6..f5aadaaeb7 100644 --- a/com/planet_ink/coffee_mud/Libraries/CMProtocols.java +++ b/com/planet_ink/coffee_mud/Libraries/CMProtocols.java @@ -2765,7 +2765,7 @@ protected String processGmcpStr(final Session session, final String jsonData, doc.append("\"group\":\""+MiniJSON.toJSONString(groupName)+"\","); doc.append("\"list\":["); for(final Ability A : allMyGroups.get(grp)) - doc.append("\"").append(MiniJSON.toJSONString(A.name().toLowerCase())).append("\","); + doc.append("\"").append(MiniJSON.toJSONString(A.name())).append("\","); doc.setCharAt(doc.length()-1,']'); break; } @@ -2794,7 +2794,7 @@ protected String processGmcpStr(final Session session, final String jsonData, if((A!=null)&&(A.name().toLowerCase().equals(name))) { doc.append("\"group\":\""+MiniJSON.toJSONString(getAbilityGroupName(A.abilityCode()))+"\","); - doc.append("\"skill\":\""+MiniJSON.toJSONString(name)+"\","); + doc.append("\"skill\":\""+MiniJSON.toJSONString(A.name())+"\","); doc.append("\"info\":\""+MiniJSON.toJSONString(CMLib.help().getHelpText(A.Name().toUpperCase(), mob, false).toString())+"\""); break; } diff --git a/com/planet_ink/coffee_mud/Libraries/CoffeeShops.java b/com/planet_ink/coffee_mud/Libraries/CoffeeShops.java index da828f4d10..6088264348 100644 --- a/com/planet_ink/coffee_mud/Libraries/CoffeeShops.java +++ b/com/planet_ink/coffee_mud/Libraries/CoffeeShops.java @@ -2000,6 +2000,12 @@ public boolean ignoreIfNecessary(final MOB mob, final String ignoreMask, final M mob.tell(whoIgnores,null,null,L(" appear(s) to be ignoring you.")); return false; } + if((whoIgnores != null) + &&(whoIgnores.amDead() || whoIgnores.isInCombat())) + { + mob.tell(whoIgnores,null,null,L(" appear(s) to be too busy right now.")); + return false; + } return true; }