viewing: teroMUD Bank Entity

  • Time Posted:
    3 months ago
  • Language:
    perl
  • Views
    50
  • Privacy
    Public
teromud_entity_init {	
	$this->tms_bind_command(qr/^deposit (.*)$/i, "deposit");
	$this->tms_bind_command(qr/^withdraw (.*)$/i, "withdraw");
	$this->tms_bind_command(qr/^view$/i, "view");
} teromud_end
 
teromud_deposit {
	my $that = $args->{that};
	my $search = $args->{input}->[0];
	my $item = $that->item_inventory_find($search);
	if ($item != 0) {
		$that->item_unequip($item, {verbose=>0});
		$item->{in_bank} = 1;
		$that->send_chat("Depositied " . $item->{name} . ".");
	}
 
	return 0;
} teromud_end
 
teromud_withdraw {
	my $that = $args->{that};
	my $search = $args->{input}->[0];
	my $item = $that->item_inventory_find($search, {
		msg_notfound	=> 'Could not find that item in the bank',
		conditions		=> { in_bank => 1 }
	});
 
	if ($item != 0) {
		$item->{in_bank} = 0;
		$that->send_chat("Withdrew " . $item->{name} . ".");
	}
 
	return 0;
} teromud_end
 
teromud_view {
	my $that = $args->{that};
	my $inventoryBuffer = "<b>Bank</b><br />";
	$inventoryBuffer .= $that->inventory_list({bank=>1});
	$that->send_chat($inventoryBuffer);
 
	return 0;
} teromud_end
 
teromud_describe {
	return "";
} teromud_end

latest pastes