|
@@ -544,15 +544,24 @@ func (c *ExecutionContext) MatchFirst(context DBRef, matchName string, matchType
|
544
|
544
|
}
|
545
|
545
|
}
|
546
|
546
|
|
547
|
|
- if matchType & MatchGlobalDBRef != 0 {
|
548
|
|
- ref, valid := NewDBRefFromHashRef(matchName)
|
549
|
|
- if valid {
|
550
|
|
- o, found := c.db.Fetch(ref)
|
551
|
|
- if found && wanted[o.Type] {
|
|
547
|
+ ref, valid := NewDBRefFromHashRef(matchName)
|
|
548
|
+
|
|
549
|
+ if valid {
|
|
550
|
+ o, found := c.db.Fetch(ref)
|
|
551
|
+ if found && wanted[o.Type] {
|
|
552
|
+ container, _ := c.db.GetParent(o.ID)
|
|
553
|
+ if container == context && matchType & MatchContext != 0 {
|
|
554
|
+ return o, true
|
|
555
|
+ }
|
|
556
|
+ if container == c.actor.ID && matchType & MatchInventory != 0 {
|
|
557
|
+ return o, true
|
|
558
|
+ }
|
|
559
|
+ if matchType & MatchGlobalDBRef != 0 {
|
552
|
560
|
return o, true
|
553
|
561
|
}
|
554
|
562
|
}
|
555
|
563
|
}
|
|
564
|
+
|
556
|
565
|
|
557
|
566
|
if wanted["player"] && matchType & MatchGlobalPlayer != 0 {
|
558
|
567
|
o, found := c.MatchPlayerName(matchName)
|
|
@@ -573,10 +582,9 @@ func (c *ExecutionContext) MatchFirst(context DBRef, matchName string, matchType
|
573
|
582
|
}
|
574
|
583
|
}
|
575
|
584
|
}
|
576
|
|
- _, refValid := NewDBRefFromHashRef(matchName)
|
577
|
585
|
lowerObjectName := strings.ToLower(o.Name)
|
578
|
586
|
lowerMatchName := strings.ToLower(matchName)
|
579
|
|
- if strings.HasPrefix(lowerObjectName, lowerMatchName) || refValid {
|
|
587
|
+ if strings.HasPrefix(lowerObjectName, lowerMatchName) {
|
580
|
588
|
return o, true
|
581
|
589
|
}
|
582
|
590
|
}
|
|
@@ -587,10 +595,9 @@ func (c *ExecutionContext) MatchFirst(context DBRef, matchName string, matchType
|
587
|
595
|
for childID, _ := range c.db.GetChildren(c.actor.ID) {
|
588
|
596
|
o, found := c.db.Fetch(childID)
|
589
|
597
|
if found && wanted[o.Type] {
|
590
|
|
- _, refValid := NewDBRefFromHashRef(matchName)
|
591
|
598
|
lowerObjectName := strings.ToLower(o.Name)
|
592
|
599
|
lowerMatchName := strings.ToLower(matchName)
|
593
|
|
- if strings.HasPrefix(lowerObjectName, lowerMatchName) || refValid {
|
|
600
|
+ if strings.HasPrefix(lowerObjectName, lowerMatchName) {
|
594
|
601
|
return o, true
|
595
|
602
|
}
|
596
|
603
|
}
|
|
@@ -838,7 +845,8 @@ func (c *ExecutionContext) nameCmd(input string) {
|
838
|
845
|
|
839
|
846
|
searchName, newName := params[1], params[2]
|
840
|
847
|
|
841
|
|
- candidate, found := c.MatchFirst(c.context.ID, searchName, MatchContext|MatchGlobalDBRef|MatchExitAliases|MatchInventory|MatchRelative|MatchStuffTypes)
|
|
848
|
+ candidate, found := c.MatchFirst(c.context.ID, searchName, MatchContext|MatchInventory|MatchRelative|MatchGlobalDBRef|MatchExitAliases|MatchAnyType)
|
|
849
|
+
|
842
|
850
|
if !found {
|
843
|
851
|
c.output("I don't see that here.")
|
844
|
852
|
return
|
|
@@ -879,13 +887,13 @@ func (c *ExecutionContext) descCmd(input string) {
|
879
|
887
|
|
880
|
888
|
objectName, description := params[1], params[2]
|
881
|
889
|
|
882
|
|
- object, found := c.MatchFirst(c.context.ID, objectName, MatchContext|MatchGlobalDBRef|MatchExitAliases|MatchInventory|MatchRelative|MatchStuffTypes)
|
|
890
|
+
|
|
891
|
+ object, found := c.MatchFirst(c.context.ID, objectName, MatchContext|MatchInventory|MatchRelative|MatchGlobalDBRef|MatchExitAliases|MatchAnyType)
|
883
|
892
|
if !found {
|
884
|
893
|
c.output("I don't see that here.")
|
885
|
894
|
return
|
886
|
895
|
}
|
887
|
896
|
|
888
|
|
- fmt.Println(object)
|
889
|
897
|
object.Description = description
|
890
|
898
|
object.Commit()
|
891
|
899
|
|
|
@@ -902,7 +910,7 @@ func (c *ExecutionContext) setCmd(input string) {
|
902
|
910
|
|
903
|
911
|
objectName, value, flag := params[1], params[2] != "!", params[3]
|
904
|
912
|
|
905
|
|
- object, found := c.MatchFirst(c.context.ID, objectName, MatchContext|MatchGlobalDBRef|MatchExitAliases|MatchInventory|MatchRelative|MatchStuffTypes|MatchGlobalPlayer)
|
|
913
|
+ object, found := c.MatchFirst(c.context.ID, objectName, MatchContext|MatchInventory|MatchRelative|MatchGlobalDBRef|MatchExitAliases|MatchAnyType)
|
906
|
914
|
if !found {
|
907
|
915
|
c.output("I don't know what that is")
|
908
|
916
|
return
|
|
@@ -926,7 +934,8 @@ func (c *ExecutionContext) colorCmd(input string) {
|
926
|
934
|
|
927
|
935
|
objectName, value := params[1], params[2]
|
928
|
936
|
|
929
|
|
- object, found := c.MatchFirst(c.context.ID, objectName, MatchContext|MatchGlobalDBRef|MatchExitAliases|MatchInventory|MatchRelative|MatchStuffTypes)
|
|
937
|
+ object, found := c.MatchFirst(c.context.ID, objectName, MatchContext|MatchInventory|MatchRelative|MatchGlobalDBRef|MatchExitAliases|MatchAnyType)
|
|
938
|
+
|
930
|
939
|
if !found {
|
931
|
940
|
c.output("I don't know what that is")
|
932
|
941
|
return
|
|
@@ -953,8 +962,9 @@ func (c *ExecutionContext) telCmd(destStr string) {
|
953
|
962
|
return
|
954
|
963
|
}
|
955
|
964
|
|
956
|
|
- if dest.Owner != c.actor.ID && !dest.GetFlag("jump_ok") {
|
|
965
|
+ if dest.Owner != c.actor.ID && !dest.GetFlag("jump_ok") && !c.actor.GetFlag("wizard") {
|
957
|
966
|
c.output("You're not allowed to do that.")
|
|
967
|
+ return
|
958
|
968
|
}
|
959
|
969
|
|
960
|
970
|
c.output("You feel an intense wooshing sensation.")
|
|
@@ -966,14 +976,13 @@ func (c *ExecutionContext) telCmd(destStr string) {
|
966
|
976
|
return
|
967
|
977
|
}
|
968
|
978
|
|
969
|
|
- c.actor.Refresh()
|
970
|
|
- c.lookCmd("")
|
|
979
|
+ c.command("look")
|
971
|
980
|
|
972
|
981
|
}
|
973
|
982
|
|
974
|
|
-func (c *ExecutionContext) dumpCmd(refStr string) {
|
|
983
|
+func (c *ExecutionContext) dumpCmd(input string) {
|
975
|
984
|
|
976
|
|
- object, found := c.MatchFirst(c.context.ID, refStr, MatchContext|MatchGlobalDBRef|MatchGlobalPlayer|MatchExitAliases|MatchInventory|MatchRelative|MatchStuffTypes)
|
|
985
|
+ object, found := c.MatchFirst(c.context.ID, input, MatchContext|MatchInventory|MatchRelative|MatchGlobalDBRef|MatchGlobalPlayer|MatchExitAliases|MatchAnyType)
|
977
|
986
|
|
978
|
987
|
if !found {
|
979
|
988
|
c.output("I can't find that.")
|
|
@@ -1040,6 +1049,13 @@ func (c *ExecutionContext) goCmd(dir string) bool {
|
1040
|
1049
|
|
1041
|
1050
|
}
|
1042
|
1051
|
|
|
1052
|
+func (c *ExecutionContext) command(format string, a ...interface{}) {
|
|
1053
|
+
|
|
1054
|
+ command := fmt.Sprintf(format, a...)
|
|
1055
|
+ c.outbound <- PlayerEvent{src: c.actor.ID, dst: c.actor.ID, message: command, messageType: EventTypeCommand}
|
|
1056
|
+
|
|
1057
|
+}
|
|
1058
|
+
|
1043
|
1059
|
func (c *ExecutionContext) wall(format string, a ...interface{}) {
|
1044
|
1060
|
|
1045
|
1061
|
message := fmt.Sprintf(format, a...)
|