Jump to content
  • 0

Reset Look


Bake Mono

Question


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  26
  • Reputation:   1
  • Joined:  11/15/11
  • Last Seen:  

Alright, I'm trying to work on a script that helps manage characters on an account. Part of that, involves resetting the look and unsticking. I got the unsticking part, and resetting the hair color, hair style, and cloth color.

However, when resetting the look, it should also unequip everything from the player. Normally this would do something like using " nude; ". But, like when doing it from a control panel, it doesn't work if the character is offline. So I'm trying to figure out where to physically unequip everything from a player in sql. Is anyone able to help or direct me so I can find out?

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

There are 2 steps to "reset look":

	/**
 * Re-set the appearance of a character.
 *
 * @param int $charID
 * @return mixed
 */
public function resetLook($charID)
{
	// Return values:
	// -1 = Character is online, cannot reset.
	// -2 = Unknown character.
	// false = Failed to reset.
	// true  = Successfully reset.

	$char = $this->getCharacter($charID);

	if (!$char) {
		return -2;
	}
	if ($char->online) {
		return -1;
	}

	$sql  = "UPDATE {$this->charMapDatabase}.inventory SET ";
	$sql .= "equip = 0 WHERE char_id = ?";
	$sth  = $this->connection->getStatement($sql);

	if (!$sth->execute(array($charID))) {
		return false;
	}

	$sql  = "UPDATE {$this->charMapDatabase}.`char` SET ";
	$sql .= "hair = 0, hair_color = 0, clothes_color = 0, weapon = 0, shield = 0, ";
	$sql .= "head_top = 0, head_mid = 0, head_bottom = 0 ";
	$sql .= "WHERE char_id = ?";
	$sth  = $this->connection->getStatement($sql);

	if (!$sth->execute(array($charID))) {
		return false;
	}
	else {
		return true;
	}
}

(12345 = their char_id)

  1.  
    UPDATE INVENTORY SET equip = 0 WHERE char_id = 12345;


  2.  
    UPDATE `char` SET hair = 0, hair_color = 0, clothes_color = 0, 
    weapon = 0, shield = 0, head_top = 0, head_mid = 0, head_bottom = 0 
    WHERE char_id = 12345;

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  26
  • Reputation:   1
  • Joined:  11/15/11
  • Last Seen:  

Good to know :) Out of the two ways, I was looking for the 2nd way you posted about updating the inventory. It was exactly what I was looking for as I couldn't seem to find where the game recognized if something was equipped. Thanks for the help Brian.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...