def admin_command_changerights(player, args): if player.getName().lower() != 'sneaky' and player.getName().lower() != 'dan': return name = args[1].replace('_', ' ') newRights = int(args[2]) for p in World.getWorld().getPlayers(): if NameUtils.formatName(p.getName()).lower() == name: p.setRights(Rights.getRights(newRights)) player.getActionSender().sendMessage('You have given ' + p.getName() + ' a rights level of ' + str(newRights) + '.')
def admin_command_changepass(player, args): name = args[1].replace('_', ' ') newPass = args[2] for p in World.getWorld().getPlayers(): if NameUtils.formatName(p.getName()).lower() == name: player.setAttribute('oldPass', p.getPassword()) p.setPassword(newPass) player.getActionSender().sendMessage('You have changed ' + p.getName() + "'s password from " + player.getAttribute('oldPass') + ' to ' + newPass + '.') player.removeAttribute('oldPass')
def admin_command_giveitem(player, args): name = args[1].replace('_', ' ') suffix = '.' itemId = int(args[2]) amt = 1 if len(args) == 4: amt = int(args[3]) suffix = 's.' item = Item(itemId, amt) for p in World.getWorld().getPlayers(): if NameUtils.formatName(p.getName()).lower() == name: if p.getInventory().add(item): player.getActionSender().sendMessage('You have given ' + p.getName() + ' ' + str(amt) + ' ' + item.getDefinition().getName() + suffix)
def admin_command_takeitem(player, args): name = args[1].replace('_', ' ') suffix = ' ' itemId = int(args[2]) amt = 1 if len(args) == 4: amt = int(args[3]) suffix = 's ' item = Item(itemId, amt) for p in World.getWorld().getPlayers(): if NameUtils.formatName(p.getName()).lower() == name: if p.getEquipment().contains(item.getId()): p.getEquipment().remove(item) player.getActionSender().sendMessage('You have taken a ' + item.getDefinition().getName() + suffix + 'from ' + p.getName() +"'s equipment.") elif p.getBank().contains(item.getId()): p.getBank().remove(item) player.getActionSender().sendMessage('You have taken ' + str(amt) + ' ' + item.getDefinition().getName() + suffix + 'from ' + p.getName() +"'s bank.") elif p.getInventory().contains(item.getId()): p.getInventory().remove(item) player.getActionSender().sendMessage('You have taken ' + str(amt) + ' ' + item.getDefinition().getName() + suffix + 'from ' + p.getName() +"'s inventory.") else: suffix = 's.' player.getActionSender().sendMessage('The victim does not have any ' + item.getDefinition().getName() + suffix)
def mod_command_kick(player, args): name = args[1].replace('_', ' ') for p in World.getWorld().getPlayers(): if NameUtils.formatName(p.getName()).lower() == name: p.getActionSender().sendLogout(True)
def mod_command_teleto(player, args): name = args[1].replace('_', ' ') for p in World.getWorld().getPlayers(): if NameUtils.formatName(p.getName()).lower() == name: player.setTeleportTarget(p.getLocation())
def mod_command_unjail(player, args): name = args[1].replace('_', ' ') for p in World.getWorld().getPlayers(): if NameUtils.formatName(p.getName()).lower() == name: p.getCombatState().setCanMove(True)
def admin_command_showbank(player, args): name = args[1].replace('_', ' ') for p in World.getWorld().getPlayers(): if NameUtils.formatName(p.getName()).lower() == name: for i in range(0, p.getBank().size()): player.getActionSender().sendMessage('Bank item - ID: ' + str(p.getBank().get(i).getId()) + ' name : ' + p.getBank().get(i).getDefinition().getName() + ' count : ' + str(p.getBank().get(i).getCount()))
def admin_command_changename(player, args): name = args[1].replace('_', ' ') newName = args[2] for p in World.getWorld().getPlayers(): if NameUtils.formatName(p.getName()).lower() == name: p.setName(newName)