use utils.getPlayerObject() instead of removed getPlayerObject()

This commit is contained in:
walterhiggins 2013-02-19 19:14:02 +00:00
parent 4685d135ef
commit 520a4ab20c

View file

@ -31,8 +31,8 @@ plugin("homes", {
go: function(guest, host){ go: function(guest, host){
if (typeof host == "undefined") if (typeof host == "undefined")
host = guest; host = guest;
guest = getPlayerObject(guest); guest = utils.getPlayerObject(guest);
host = getPlayerObject(host); host = utils.getPlayerObject(host);
var loc = this.store.houses[host.name]; var loc = this.store.houses[host.name];
if (!loc){ if (!loc){
guest.sendMessage(host.name + " has no home"); guest.sendMessage(host.name + " has no home");
@ -63,7 +63,7 @@ plugin("homes", {
return false; return false;
}, },
set: function(player){ set: function(player){
player = getPlayerObject(player); player = utils.getPlayerObject(player);
var loc = player.location; var loc = player.location;
this.store.houses[player.name] = [""+loc.world.name this.store.houses[player.name] = [""+loc.world.name
,Math.floor(loc.x) ,Math.floor(loc.x)
@ -73,7 +73,7 @@ plugin("homes", {
,Math.floor(loc.pitch)]; ,Math.floor(loc.pitch)];
}, },
remove: function(player){ remove: function(player){
player = getPlayerObject(player); player = utils.getPlayerObject(player);
delete this.store.houses[player.name]; delete this.store.houses[player.name];
}, },
/* ======================================================================== /* ========================================================================
@ -87,7 +87,7 @@ plugin("homes", {
var result = []; var result = [];
for (var ohp in this.store.openHouses) for (var ohp in this.store.openHouses)
result.push(ohp); result.push(ohp);
player = getPlayerObject(player); player = utils.getPlayerObject(player);
for (var host in this.store.invites){ for (var host in this.store.invites){
var guests = this.store.invites[host]; var guests = this.store.invites[host];
for (var i = 0;i < guests.length; i++) for (var i = 0;i < guests.length; i++)
@ -100,7 +100,7 @@ plugin("homes", {
list who can visit the player's home list who can visit the player's home
*/ */
ilist: function(player){ ilist: function(player){
player = getPlayerObject(player); player = utils.getPlayerObject(player);
var result = []; var result = [];
// if home is public - all players // if home is public - all players
if (this.store.openHouses[player.name]){ if (this.store.openHouses[player.name]){
@ -117,8 +117,8 @@ plugin("homes", {
Invite a player to the home Invite a player to the home
*/ */
invite: function(host, guest){ invite: function(host, guest){
host = getPlayerObject(host); host = utils.getPlayerObject(host);
guest = getPlayerObject(guest); guest = utils.getPlayerObject(guest);
var invitations = this.store.invites[host.name] || []; var invitations = this.store.invites[host.name] || [];
invitations.push(guest.name); invitations.push(guest.name);
this.store.invites[host.name] = invitations; this.store.invites[host.name] = invitations;
@ -129,8 +129,8 @@ plugin("homes", {
Uninvite someone to the home Uninvite someone to the home
*/ */
uninvite: function(host, guest){ uninvite: function(host, guest){
host = getPlayerObject(host); host = utils.getPlayerObject(host);
guest = getPlayerObject(guest); guest = utils.getPlayerObject(guest);
var invitations = this.store.invites[host.name]; var invitations = this.store.invites[host.name];
if (!invitations) if (!invitations)
return; return;
@ -144,7 +144,7 @@ plugin("homes", {
make the player's house public make the player's house public
*/ */
open: function(player, optionalMsg){ open: function(player, optionalMsg){
player = getPlayerObject(player); player = utils.getPlayerObject(player);
this.store.openHouses[player.name] = true; this.store.openHouses[player.name] = true;
if (typeof optionalMsg != "undefined") if (typeof optionalMsg != "undefined")
__plugin.server.broadcastMessage(optionalMsg); __plugin.server.broadcastMessage(optionalMsg);
@ -153,7 +153,7 @@ plugin("homes", {
make the player's house private make the player's house private
*/ */
close: function(player){ close: function(player){
player = getPlayerObject(player); player = utils.getPlayerObject(player);
delete this.store.openHouses[player.name]; delete this.store.openHouses[player.name];
}, },
/* ======================================================================== /* ========================================================================
@ -166,7 +166,7 @@ plugin("homes", {
return result; return result;
}, },
clear: function(player){ clear: function(player){
player = getPlayerObject(player); player = utils.getPlayerObject(player);
delete this.store.houses[player.name]; delete this.store.houses[player.name];
delete this.store.openHouses[player.name]; delete this.store.openHouses[player.name];
} }
@ -210,7 +210,7 @@ plugin("homes", {
return; return;
} }
var playerName = params[1]; var playerName = params[1];
var guest = getPlayerObject(playerName); var guest = utils.getPlayerObject(playerName);
if (!guest) if (!guest)
self.sendMessage(playerName + " is not here"); self.sendMessage(playerName + " is not here");
else else
@ -222,7 +222,7 @@ plugin("homes", {
return; return;
} }
var playerName = params[1]; var playerName = params[1];
var guest = getPlayerObject(playerName); var guest = utils.getPlayerObject(playerName);
if (!guest) if (!guest)
self.sendMessage(playerName + " is not here"); self.sendMessage(playerName + " is not here");
else else
@ -264,7 +264,7 @@ plugin("homes", {
if (option) if (option)
option(params); option(params);
else{ else{
var host = getPlayerObject(params[0]); var host = utils.getPlayerObject(params[0]);
if (!host) if (!host)
self.sendMessage(params[0] + " is not here"); self.sendMessage(params[0] + " is not here");
else else