DragonPrime - LoGD Resource Community
Welcome Guest
  • Good morning, Guest.
    Please log in, or register.
  • September 02, 2010, 09:44:49 AM
Home Forums News Links Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
IRC Channels
Search

Pages: [1]   Go Down
  Print  
Author Topic: Message Board in the inn  (Read 847 times)
0 Members and 1 Guest are viewing this topic.
anpera
Guest
« on: March 18, 2004, 07:50:22 PM »

Description:
Players can pin a message to a messageboard near the entrance in the inn. They pay a small fee to cedrik and determine how long (in game days) the message will stay there. Afer the time is up (or after a dragonkill) the message will be removed automatically. Of course players can remove their message before time is up.
This is meant to be a place for trades of all kind or for pure role play. Could be used for bounty hunters as well.... whatever your players want.

In Admingrotto all messages can be deleted if necessary.

Version: 17.03.2004

For LoGD: 0.9.7+jt

Installation instructions:
Code:
----- SQL:
ALTER TABLE `accounts` ADD `message` TEXT NOT NULL , ADD `msgdate` DATETIME NOT NULL ;


----- Open:
inn.php

----- Find:
  output("`n`nThe clock on the mantle reads `6".getgametime()."`0.");

----- After, add:
   $sql = "UPDATE accounts SET message='',msgdate='0000-00-00 00:00:00' WHERE message>'' AND msgdate<'".date("Y-m-d H:i:s")."'";
   db_query($sql);
   output("`n`n");
   $sql = "SELECT acctid,login,name,message,msgdate FROM accounts WHERE message>'' ORDER BY msgdate ASC";
   $result = db_query($sql) or die(db_error(LINK));
   if (db_num_rows($result)<=0){
      output("There is not a single message on the message board beneath the door.");
   }else{
      output("On a message board beneath the door some messages flutter in the air draft:");
      for ($i=0;$i<db_num_rows($result);$i++){
         $row = db_fetch_assoc($result);
         output("`n`n<a href=\"mail.php?op=write&to=".rawurlencode($row['login'])."\" target=\"_blank\" onClick=\"".popup("mail.php?op=write&to=".rawurlencode($row['login'])."").";return false;\"><img src='images/newscroll.GIF' width='16' height='16' alt='Mail' border='0'></a>",true);
         output("`& $row[name]`&:`n`^$row[message] ");
         if ($row[acctid]==$session[user][acctid]){
            output("[<a href='inn.php?op=msgboard&act=del'>remove</a>]",true);
            addnav("","inn.php?op=msgboard&act=del");
         }
      }
   }

----- Find:
}else{
  switch($HTTP_GET_VARS[op]){

----- After, add;
   case "msgboard":
   if ($_GET[act]=="del"){
      $session[user][message]="";
      $session[user][msgdate]="0000-00-00 00:00:00";
      output("You rip your message off the board. You are done with this issue.");
      addnav("New Message","inn.php?op=msgboard");
   }else if ($_GET[act]=="add1"){
      $msgprice=$session[user][level]*6*(int)$_GET[amt];
      output("Cedrik pulls out some paper and looks at you expectant. Obviously he doesn't expect his guests to be able to write so you tell him what you want the world to know. ");
      output("\"`%This costs `^$msgprice`% gold. What should I write?`0\"`n`n");
      output("<form action=\"inn.php?op=msgboard&act=add2&amt=$_GET[amt]\" method='POST'>",true);
      output("`nYour message:`n<input name='msg' maxlength='250' size='50'>`n",true);
      output("<input type='submit' class='button' value='Post it!'>",true);
      addnav("","inn.php?op=msgboard&act=add2&amt=$_GET[amt]");
   }else if ($_GET[act]=="add2"){
      $msgprice=$session[user][level]*6*(int)$_GET[amt];
      $msgdate=date("Y-m-d H:i:s",strtotime("+$_GET[amt] days"));
      if ($session[user][gold]<$msgprice){
         output("As Cedrik noticed that you don't have the gold to pay him, he takes away pen and paper and starts ignoring you");
      }else{
         output("Cedrik takes your gold and writes what you tell him. Without reading it again he walks over to the board and pins your message somewhere between the others.");
         $session[user][message]=stripslashes($_POST[msg]);
         $session[user][msgdate]=$msgdate;
         $session[user][gold]-=$msgprice;
      }
   }else{
      $msgprice=$session[user][level]*6;
      $msgdays=(int)getsetting("daysperday",4);
      output("\"`%You wanna post a message? How long should it be there?`0\", Cedrik asks and names his prices.");
      addnav("$msgdays days (`^$msgprice`0 gold)","inn.php?op=msgboard&act=add1&amt=1");
      addnav("".($msgdays*3)." days (`^".($msgprice*3)."`0 gold)","inn.php?op=msgboard&act=add1&amt=3");
      addnav("".($msgdays*10)." days (`^".($msgprice*10)."`0 gold)","inn.php?op=msgboard&act=add1&amt=10");
      if ($session[user][message]>"") output("`nHe informs you that he will replace your old message if you want to post a new one.");
   }
   break;

----- Find:
addnav("Bribe","inn.php?op=bartender&act=bribe");

----- Before, add:
            addnav("Messageboard","inn.php?op=msgboard");


----- Open:
superuser.php

----- Find:
   addnav("B?Bios","bios.php");

----- After, add:
   addnav("Messageboard","innboard.php");


----- Save and close all files


----- Upload:
innboard.php

Code from innboard.php:
(Copy and paste to an empty file and save as "innboard.php" to your logd directory)
Code:
<?PHP
require_once "common.php";
isnewday(2);
page_header("Messageboard");

if ($_GET['op']=="del"){
   $sql = "UPDATE accounts SET message='',msgdate='0000-00-00 00:00:00' WHERE acctid='{$_GET['userid']}'";
   db_query($sql);
   systemmail($_GET['userid'],"`0Message deleted!","`0An Admin deleted your message in the inn.`nIf you want to discuss it, send an Olde Mail to ".$session[user][name]."`0 or use the petition link.");
}

$sql = "SELECT acctid,login,name,message,msgdate FROM accounts WHERE message>'' ORDER BY msgdate DESC";
$result = db_query($sql) or die(db_error(LINK));
if (db_num_rows($result)<=0){
   output("`iNo messages on board`i");
}else{
   output("Following messages on board:");
   for ($i=0;$i<db_num_rows($result);$i++){
      $row = db_fetch_assoc($result);
      output("`n`n");
      output("`& $row[name]`&:`n`^$row[message] ");
      output("[<a href='innboard.php?op=del&userid=$row[acctid]'>remove</a>]",true);
      addnav("","innboard.php?op=del&userid=$row[acctid]");
   }
}
db_free_result($result);
addnav("G?Back to Grotto","superuser.php");
addnav("M?Back to Mundane","village.php");
addnav("Refresh","innboard.php");
page_footer();
?>

Additional notes:
Just excuse my bad english and replace the text where needed ;)
"debuglog" not included
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Welcome to DragonPrime - The LoGD Resource Community!

Support Us
No funds raised yet this year
Your help is greatly appreciated!
Who's Online
31 Guests, 0 Users
DragonPrime LoGD
Recent Topics
Home Forums News Links Downloads Login Register Advanced Search