Changeset 253 for binary-improvements/AllocsCommands/Commands
- Timestamp:
- Dec 12, 2015, 4:08:53 PM (9 years ago)
- Location:
- binary-improvements/AllocsCommands/Commands
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/AllocsCommands/Commands/ListLandProtection.cs
r238 r253 86 86 } 87 87 88 Dictionary<Vector3i, PersistentPlayerData> d = ppl.m_lpBlockMap;89 if (d != null) {90 Dictionary<PersistentPlayerData, List<Vector3i>> owners = new Dictionary<PersistentPlayerData, List<Vector3i>> ();91 foreach (KeyValuePair<Vector3i, PersistentPlayerData> kvp in d) {92 if (!onlyCloseToPlayer || (Math.Abs (kvp.Key.x - closeTo.x) <= closeToDistance && Math.Abs (kvp.Key.z - closeTo.z) <= closeToDistance)) {93 if (!owners.ContainsKey (kvp.Value)) {94 owners.Add (kvp.Value, new List<Vector3i> ());95 }96 owners [kvp.Value].Add (kvp.Key);97 }98 }99 88 100 foreach (KeyValuePair<PersistentPlayerData, List<Vector3i>> kvp in owners) {101 if (steamIdFilter.Length == 0 || kvp.Key.PlayerId.Equals(steamIdFilter)) {102 PersistentData.Player p = PersistentData.PersistentContainer.Instance.Players [kvp.Key.PlayerId, false];103 string name = string.Empty;104 if (p != null) {105 name = p.Name;106 }107 name += " (" + kvp.Key.PlayerId + ")";89 LandClaimList.OwnerFilter[] ownerFilters = null; 90 if (!string.IsNullOrEmpty (steamIdFilter)) { 91 ownerFilters = new LandClaimList.OwnerFilter[] { LandClaimList.SteamIdFilter (steamIdFilter) }; 92 } 93 LandClaimList.PositionFilter[] posFilters = null; 94 if (onlyCloseToPlayer) { 95 posFilters = new LandClaimList.PositionFilter[] { LandClaimList.CloseToFilter2dRect (closeTo, closeToDistance) }; 96 } 108 97 109 SdtdConsole.Instance.Output (String.Format ("Player \"{0}\" owns {3} keystones (protected: {1}, current hardness multiplier: {2})", name, w.IsLandProtectionValidForPlayer (kvp.Key), w.GetLandProtectionHardnessModifierForPlayer (kvp.Key), kvp.Value.Count)); 110 if (!summaryOnly) { 111 foreach (Vector3i v in kvp.Value) { 112 SdtdConsole.Instance.Output (" (" + v.ToString () + ")"); 113 } 114 } 98 Dictionary<PersistentData.Player, List<Vector3i>> claims = LandClaimList.GetLandClaims (ownerFilters, posFilters); 99 100 foreach (KeyValuePair<PersistentData.Player, List<Vector3i>> kvp in claims) { 101 SdtdConsole.Instance.Output (String.Format ( 102 "Player \"{0} ({1})\" owns {4} keystones (protected: {2}, current hardness multiplier: {3})", 103 kvp.Key.Name, 104 kvp.Key.SteamID, 105 kvp.Key.LandProtectionActive, 106 kvp.Key.LandProtectionMultiplier, 107 kvp.Value.Count)); 108 if (!summaryOnly) { 109 foreach (Vector3i v in kvp.Value) { 110 SdtdConsole.Instance.Output (" (" + v.ToString () + ")"); 115 111 } 116 112 } … … 118 114 119 115 if (steamIdFilter.Length == 0) 120 SdtdConsole.Instance.Output ("Total of " + d.Count + " keystones in the game");116 SdtdConsole.Instance.Output ("Total of " + ppl.m_lpBlockMap.Count + " keystones in the game"); 121 117 } catch (Exception e) { 122 118 Log.Out ("Error in ListLandProtection.Run: " + e); -
binary-improvements/AllocsCommands/Commands/RemoveLandProtection.cs
r238 r253 40 40 List<BlockChangeInfo> changes = new List<BlockChangeInfo> (); 41 41 foreach (Vector3i pos in ppl.Players[_id].LPBlocks) { 42 BlockChangeInfo bci = new BlockChangeInfo (pos, 0, true);42 BlockChangeInfo bci = new BlockChangeInfo (pos, new BlockValue (0), true); 43 43 changes.Add (bci); 44 44 } … … 79 79 } 80 80 81 BlockChangeInfo bci = new BlockChangeInfo (v, 0, true);81 BlockChangeInfo bci = new BlockChangeInfo (v, new BlockValue (0), true); 82 82 83 83 List<BlockChangeInfo> changes = new List<BlockChangeInfo> (); -
binary-improvements/AllocsCommands/Commands/ShowInventory.cs
r250 r253 6 6 { 7 7 public class ShowInventory : ConsoleCmdAbstract { 8 8 9 public override string GetDescription () { 9 10 return "list inventory of a given player"; … … 69 70 70 71 private void PrintEquipment (InvItem[] _equipment) { 71 AddEquipment ("head", _equipment, XMLData.Item.EnumEquipmentSlot.Head, NGuiInvGridEquipment.EnumClothingLayer.Middle);72 AddEquipment ("eyes", _equipment, XMLData.Item.EnumEquipmentSlot.Eyes, NGuiInvGridEquipment.EnumClothingLayer.Middle);73 AddEquipment ("face", _equipment, XMLData.Item.EnumEquipmentSlot.Face, NGuiInvGridEquipment.EnumClothingLayer.Middle);72 AddEquipment ("head", _equipment, EquipmentSlots.Headgear); 73 AddEquipment ("eyes", _equipment, EquipmentSlots.Eyewear); 74 AddEquipment ("face", _equipment, EquipmentSlots.Face); 74 75 75 AddEquipment ("armor", _equipment, XMLData.Item.EnumEquipmentSlot.Chest, NGuiInvGridEquipment.EnumClothingLayer.Outer);76 AddEquipment ("jacket", _equipment, XMLData.Item.EnumEquipmentSlot.Chest, NGuiInvGridEquipment.EnumClothingLayer.Middle);77 AddEquipment ("shirt", _equipment, XMLData.Item.EnumEquipmentSlot.Chest, NGuiInvGridEquipment.EnumClothingLayer.Inner);76 AddEquipment ("armor", _equipment, EquipmentSlots.ChestArmor); 77 AddEquipment ("jacket", _equipment, EquipmentSlots.Jacket); 78 AddEquipment ("shirt", _equipment, EquipmentSlots.Shirt); 78 79 79 AddEquipment ("legarmor", _equipment, XMLData.Item.EnumEquipmentSlot.Legs, NGuiInvGridEquipment.EnumClothingLayer.Outer);80 AddEquipment ("pants", _equipment, XMLData.Item.EnumEquipmentSlot.Legs, NGuiInvGridEquipment.EnumClothingLayer.Inner);81 AddEquipment ("boots", _equipment, XMLData.Item.EnumEquipmentSlot.Feet, NGuiInvGridEquipment.EnumClothingLayer.Inner);80 AddEquipment ("legarmor", _equipment, EquipmentSlots.LegArmor); 81 AddEquipment ("pants", _equipment, EquipmentSlots.Legs); 82 AddEquipment ("boots", _equipment, EquipmentSlots.Feet); 82 83 83 AddEquipment ("gloves", _equipment, XMLData.Item.EnumEquipmentSlot.Hands, NGuiInvGridEquipment.EnumClothingLayer.Inner); 84 AddEquipment ("backpack", _equipment, XMLData.Item.EnumEquipmentSlot.Back, NGuiInvGridEquipment.EnumClothingLayer.Outer); 84 AddEquipment ("gloves", _equipment, EquipmentSlots.Hands); 85 85 } 86 86 87 private void AddEquipment (string _slotname, InvItem[] _items, XMLData.Item.EnumEquipmentSlot _slot, NGuiInvGridEquipment.EnumClothingLayer _layer) { 88 int index = (int)_slot + (int)_layer * (int)XMLData.Item.EnumEquipmentSlot.Count; 89 if (_items != null && _items [index] != null) { 90 if (_items [index].quality < 0) { 91 SdtdConsole.Instance.Output (string.Format (" Slot {0:8}: {1:000}", _slotname, _items [index].itemName)); 92 } else { 93 SdtdConsole.Instance.Output (string.Format (" Slot {0:8}: {1:000} - quality: {2}", _slotname, _items [index].itemName, _items [index].quality)); 87 private void AddEquipment (string _slotname, InvItem[] _items, EquipmentSlots _slot) { 88 int[] slotindices = XUiM_PlayerEquipment.GetSlotIndicesByEquipmentSlot (_slot); 89 90 for (int i = 0; i < slotindices.Length; i++) { 91 if (_items != null && _items [slotindices [i]] != null) { 92 InvItem item = _items [slotindices [i]]; 93 if (item.quality < 0) { 94 SdtdConsole.Instance.Output (string.Format (" Slot {0:8}: {1:000}", _slotname, item.itemName)); 95 } else { 96 SdtdConsole.Instance.Output (string.Format (" Slot {0:8}: {1:000} - quality: {2}", _slotname, item.itemName, item.quality)); 97 } 98 DoParts (_items [slotindices [i]].parts, 1); 99 return; 94 100 } 95 DoParts (_items [index].parts, 1);96 101 } 97 102 } -
binary-improvements/AllocsCommands/Commands/TeleportPlayer.cs
r250 r253 16 16 " 3. teleportplayer <inc x> <inc y> <inc z>\n" + 17 17 "1. Teleports the player given by his SteamID, player name or entity id (as given by e.g. \"lpi\")\n" + 18 " to the specified location \n" +18 " to the specified location. Use y = -1 to spawn on ground.\n" + 19 19 "2. As 1, but destination given by another player which has to be online\n" + 20 20 "3. Teleport the local player to the position calculated by his current position and the given offsets"; … … 33 33 ClientInfo ci1 = null; 34 34 EntityPlayer ep1 = null; 35 UnityEngine.Vector3 destPos; 35 36 36 37 if (_params.Count == 2 || _params.Count == 4) { … … 56 57 } 57 58 58 ep1.position.x = x;59 ep1.position.y = y;60 ep1.position.z = z;59 destPos.x = x; 60 destPos.y = y; 61 destPos.z = z; 61 62 } else if (_params.Count == 2) { 62 63 ClientInfo ci2 = ConsoleHelper.ParseParamIdOrName (_params [1]); … … 67 68 EntityPlayer ep2 = GameManager.Instance.World.Players.dict [ci2.entityId]; 68 69 69 ep1.position= ep2.GetPosition ();70 ep1.position.y += 1;71 ep1.position.z += 1;70 destPos = ep2.GetPosition (); 71 destPos.y += 1; 72 destPos.z += 1; 72 73 } 73 74 } else if (_params.Count == 3) { 74 75 if (_senderInfo.RemoteClientInfo == null) { 75 SdtdConsole.Instance.Output ("This command can only be executed on the in-game console.");76 SdtdConsole.Instance.Output ("This command can only be executed in variant 3 on the in-game console."); 76 77 return; 77 78 } … … 93 94 } 94 95 95 ep1.position.x = ep1.position.x + x;96 ep1.position.y = ep1.position.y + y;97 ep1.position.z = ep1.position.z + z;96 destPos.x = ep1.position.x + x; 97 destPos.y = ep1.position.y + y; 98 destPos.z = ep1.position.z + z; 98 99 } 99 100 100 NetPackage EntityTeleport pkg = new NetPackageEntityTeleport (ep1);101 NetPackageTeleportPlayer pkg = new NetPackageTeleportPlayer (destPos); 101 102 102 103 ci1.SendPackage (pkg);
Note:
See TracChangeset
for help on using the changeset viewer.