DragonPrime - LoGD Resource Community
Welcome Guest
  • Good evening, Guest.
    Please log in, or register.
  • September 23, 2018, 11:01:27 PM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
Search

Pages: [1]   Go Down
  Print  
Author Topic: Free Ale  (Read 3769 times)
0 Members and 1 Guest are viewing this topic.
anpera
Guest
« on: April 27, 2004, 07:06:38 PM »

Description:
This enables players to pay for a round in the inn. Each player can pay for one round and get one free ale a day (if he catches one of them).

Author: anpera

Version: long ago ^^ Let's call it 2.0

Installation instructions
Code:
----- sql:
ALTER TABLE `accounts` ADD `gotfreeale` TINYINT(1) DEFAULT '0' NOT NULL ;


----- Open:
configuration.php

----- Find:
   "gameadminemail"=>"Admin Email",

----- After, add:
   "paidales"=>"Paid ale left,int",
   "maxales"=>"Max ale that can be paid,int",


----- Open:
inn.php

----- Find:
$alecost = $session[user][level]*10;

----- Replace it with:
      if (getsetting("paidales",0)<1 || $session[user][gotfreeale]>=2) {
         $alecost = $session[user][level]*10;
      } else {
         $alecost = 0;
      }

----- Find:
addnav("Ale (`^$alecost`0 gold)","inn.php?op=bartender&act=ale");

----- Replace it with:
            if (getsetting("paidales",0)<1) {
               addnav("Ale (`^$alecost`0 gold)","inn.php?op=bartender&act=ale");
               addnav("Pay for a round","inn.php?op=bartender&act=schmeiss");
            } else {
               $amt=getsetting("paidales",0);
               addnav("Ale (`^".($session[user][gotfreeale]>=2?"$alecost`0 gold":"paid`0").")","inn.php?op=bartender&act=ale");
               output("`nThere are $amt freshly filled ales standing in front of Cedrik.");
               if ($session[user][gotfreeale]>=2) output(" But you have had your free ale for today already, so you have to pay for your drink.");
            }

----- Find:
         }else if ($HTTP_GET_VARS[act]=="bribe"){

----- Before, add:
         }else if ($HTTP_GET_VARS[act]=="schmeiss"){
            output("You're in good moods and think about paying for a round for your friends in here.`n");
            output("`nOne Ale cost you `^$alecost`0 gold.`n");
            output("<form action='inn.php?op=bartender&act=schmeiss2' method='POST'>Pay for the next <input name='runden' id='runden' width='4'> ale.`n",true);
            output("<input type='submit' class='button' value='Pay'></form>",true);
            output("<script language='javascript'>document.getElementById('runden').focus();</script>",true);
            addnav("","inn.php?op=bartender&act=schmeiss2");
         }else if ($HTTP_GET_VARS[act]=="schmeiss2"){
            $amt = abs((int)$_POST['runden']);
            $jamjam=$amt*$alecost;
            $schussel=$session[user][name];
            if ($session[user][gold]<$jamjam){
               output("Right in time before you blame yourself to the bones you notice, that you don't have enough gold with you.");
            } else if (getsetting("paidales",0)>0 || $alecost==0){
               output("Damn! Someone was faster than you. Disappointed you move towards the free ale.");
   } else if (abs($session[user][gotfreeale]-2)==1){
      output("Cedrik looks deep in your eyes and tell you \"`%You've paid for a round today. You'll make noone become a barfly in my inn. Okay?`0\"");
   } else if ($amt>getsetting("maxales",50)){
      output("\"`%Don't boast with your money in here! Could be deadly, you know?`0\"");
            }else{
               output("You talk to Cedrik and push `^$jamjam`0 gold towards him. He nods and sreams out into the room \"`%The next $amt ale were paid by $schussel !!`0\".");
               output("A murmur goes through the crowd and you are the hero of the hour.`n`n");
               if ($amt>5){
                  output("`^You gain a charmpoint!`0");
                  $session[user][charm]+=1;
               }
               savesetting("paidales","$amt");
               $session[user][gold]-=$jamjam;
      $session[user][gotfreeale]++;
               $sql = "INSERT INTO commentary (postdate,section,author,comment) VALUES (now(),'inn',".$session[user][acctid].",\":: paid for `^$amt`& Ale!\")";
               db_query($sql) or die(db_error(LINK));
            }

----- Find:
$session[user][gold]-=$alecost;

----- After, add:
                  if (getsetting("paidales",0)>0 && $session[user][gotfreeale]<2) {
                     savesetting("paidales","".(getsetting("paidales",0)-1)."");
                     $session[user][gotfreeale]+=2;
                  }


----- Open:
newday.php

----- Find:
      $session['user']['usedouthouse'] = 0;

----- After, add:
      $session['user']['gotfreeale'] = 0;


----- Open:
user.php

----- Find:
   "charm"=>"Charm,int",

----- After, add:
   "gotfreeale"=>"Free ale flag (0-3),int",


----- Save and close all files

Notes:
The free ale flag uses two bits of one byte to determine if a player drunk his free ale and/or paid for a round on a game day. LSB is set for "paid" and MSB ist set for "drunk". In other words:
gotfreeale==0: none (00)
gotfreeale==1: paid for a round (01)
gotfreeale==2: drunk free ale (10)
gotfreeale==3: paid and drunk (11)

Please don't kill me if there's an error in the instructions. It's late night (early morning) here and I pulled it all out of my code and translated it again. I tested the instructions on my testserver and couldn't find any error. But I know how those little bugs like hide and seek...

This version represents what is running on my server for a long time now. The free ale script on sourceforge was in kind of development state.^^
« Last Edit: April 28, 2004, 06:32:54 AM by anpera » Logged
sixf00t4
Mod God
*****
Offline Offline

Posts: 1916



View Profile WWW
« Reply #1 on: April 28, 2004, 01:17:15 AM »

i'd buy you a round for this one, Anpera.  I kept putting this one off.   See, procrastination does pay off Grin  Good job.


wait a minute.... got a parse error on:
Code:
$sql = "INSERT INTO commentary (postdate,section,author,comment) VALUES (now(),'inn',".$session[user][acctid].",\"[me=anpera]paid for `^$amt`& Ale!\")"; [/me]
      

change it to
Code:
             $sql = "INSERT INTO commentary (postdate,section,author,comment) VALUES (now(),'inn',".$session[user][acctid].",\" I paid for `^$amt`& Ale!\")";

i also added
Code:

$playername=$session[user][name];
   addnews("$playername bought a round of drinks!");

in there too.               
« Last Edit: April 28, 2004, 01:37:53 AM by sixf00t4 » Logged

anpera
Guest
« Reply #2 on: April 28, 2004, 06:30:45 AM »

wait a minute.... got a parse error on:
Code:
$sql = "INSERT INTO commentary (postdate,section,author,comment) VALUES (now(),'inn',".$session[user][acctid].",\"[me=anpera]paid for `^$amt`& Ale!\")"; [/me]
      

change it to
Code:
             $sql = "INSERT INTO commentary (postdate,section,author,comment) VALUES (now(),'inn',".$session[user][acctid].",\" I paid for `^$amt`& Ale!\")";

Huh? The "
* anpera " is not in the text file I copied in here!

The line was meant to be
Code:
$sql = "INSERT INTO commentary (postdate,section,author,comment) VALUES (now(),'inn',".$session[user][acctid].",\"[me=anpera]paid for `^$amt`& Ale!\")";
Shocked

Hmmmmmm .. is there something in this forum that converts "/me" into
* anpera ...
tags??

Ok, use this one:
Code:
$sql = "INSERT INTO commentary (postdate,section,author,comment) VALUES (now(),'inn',".$session[user][acctid].",\":: paid for `^$amt`& Ale!\")";

I fixed the instructions above.
Logged
Talisman
Administrator
Mod God
*****
Offline Offline

Posts: 5479



View Profile WWW
« Reply #3 on: April 28, 2004, 10:26:03 AM »


Hmmmmmm .. is there something in this forum that converts "/me" into
* anpera ...
tags??


Not that I'm aware of, and any text between the code tags should be displayed literally anyhow.
Logged

Play the latest beta version here on DragonPrime
strider
Guest
« Reply #4 on: April 28, 2004, 10:32:53 AM »

/me
Logged
strider
Guest
« Reply #5 on: April 28, 2004, 10:33:15 AM »

Sorry, just had to try.
Logged
Arune
Member
Mod God
*****
Offline Offline

Posts: 718


Arune Vai - khatfield


View Profile WWW
« Reply #6 on: June 15, 2004, 10:22:09 AM »

weird about the
* Arune thing heh
« Last Edit: June 15, 2004, 10:22:45 AM by Arune » Logged
Arune
Member
Mod God
*****
Offline Offline

Posts: 718


Arune Vai - khatfield


View Profile WWW
« Reply #7 on: June 15, 2004, 10:24:01 AM »

hah ! /me


Does actually change it.. lets see:
* Arune is walking

Above I typed "/me" is walking.

lets try code:
Code:
[me=Arune]is walking
[/me]
heh
Logged
Arune
Member
Mod God
*****
Offline Offline

Posts: 718


Arune Vai - khatfield


View Profile WWW
« Reply #8 on: June 15, 2004, 10:24:50 AM »

Yep, "/me" (without the quotes) with a word following changes it to an emote.

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!
Recent Topics
DragonPrime LoGD
Who's Online
37 Guests, 1 User
Aeolus
Home Forums News Downloads Login Register Advanced Search