21.YILTürkiye'nin en eski ve aktif online oyun platformu, Ultima Online, Counter-Strike ve diğer online oyunlar hakkında Türkçe haber, bilgi ve forum sunuyor. Türkiye'nin en eski ve aktif online oyun platformu, Ultima Online, Counter-Strike ve diğer online oyunlar hakkında Türkçe haber, bilgi ve forum sunuyor.
  • ANASAYFA
  • ULTIMA ONLINE
  • FORUM
  • DOKÜMAN
  • İNDİR
   Üye ol    Giriş
77
39
  1. Anasayfa
  2. UO Scriptleri
  3. RunUO Scripts
  4. Misc
  5. Tell A Friend

Tell A Friend

  • 2006-05-02 22:08
  • 0 Yorumlar
  • 1239 Görüntüleme
/* 
* RunUO Shard Referral System
* Author: Shadow1980
* Files: TellAFriend.cs
* Version 1.3
* Public Release: 17-04-2006
*
* Description:
* This system allows you to reward players for bringing friends into the shard.
* When a new player joins, they receive a gump asking them who referred them to the shard.
* They can enter the account name of the person in question there, which will add two tags to their account.
* Once certain configurable conditions are met, the referrer will receive a reward.
* Everything is handled on login, so to receive a reward for a referral both accounts have to remain active.
*
* Please note only the referrer receives a reward, but you can easely give a reward to the new player as well.
* To do this, uncomment lines 69 and 70. The reward can be found at line 206. Modify as you see fit.
*/
using System;
using Server.Accounting;
using Server.Network;
using Server.Gumps;
using Server.Items;
using Server.Mobiles;

namespace Server
{
public class TellAFriend
{
// Configure Required Ingame Time For Both New Player and Referrer Before a Reward is given:
public static readonly TimeSpan RewardTime = TimeSpan.FromHours( 120.0 );
// Both Accounts need to have logged in during the last x days set here:
public static readonly DateTime mindate = DateTime.Now - TimeSpan.FromDays( 7.0 );
// New Player Account has this many days to enter a referrer & also requires to be this old before a reward is given to the referrer:
public static readonly DateTime age = DateTime.Now - TimeSpan.FromDays( 7.0 );
// Edit Shard Name
public static readonly string TAFShardName = "Prophecies";

public static void Initialize()
{
EventSink.Login += new LoginEventHandler( TAFLogin );
}

private static void TAFLogin( LoginEventArgs args )
{
Mobile m = args.Mobile;
Account ac = (Account)m.Account;
bool toldfriend = ToldAFriend( m );
bool gotfriend = GotAFriend( m );
if ( ac.Created >= age )
{
if ( !toldfriend )
{
m.SendGump( new TAFGump( m ) );
}
}
else if ( toldfriend )
{
string friend = ac.GetTag( "Referrer" );
Account friendacct = Accounts.GetAccount( friend );
if ( friendacct == null )
{
ac.RemoveTag( "Referrer" );
}
else
{
if ( ac.LastLogin > mindate && friendacct.LastLogin > mindate && ac.TotalGameTime >= RewardTime && friendacct.TotalGameTime >= RewardTime )
{
m.SendMessage( String.Format( "Your friend {0} will receive a reward for referring you to {1} next time (s)he logs in.", friend, TAFShardName ) );
//m.SendMessage( String.Format( "You receive a reward for your loyalty to {0}.", friend, TAFShardName ) );
//m.AddToBackpack( new ReferrerReward() );
friendacct.SetTag( "GotAFriend", "true" );
friendacct.SetTag( "GotFriend", ac.ToString() );
ac.RemoveTag( "Referrer" );
ac.RemoveTag( "ToldAFriend" );
}
}
}
else if ( gotfriend )
{
string friend = ac.GetTag( "GotFriend" );
m.SendMessage( String.Format( "You receive a reward for referring your friend {0} to {1}.", friend, TAFShardName ) );
m.AddToBackpack( new ReferrerReward() );
ac.RemoveTag( "GotAFriend" );
ac.RemoveTag( "GotFriend" );
}
}

public class TAFGump : Gump
{
private NetState m_State;
public TAFGump( Mobile from ) : this( from, "" )
{
}
private string tere;
private const int LabelColor32 = 0xFFFFFF;

public string Center( string text )
{
return String.Format( "<CENTER>{0}</CENTER>", text );
}

public string Color( string text, int color )
{
return String.Format( "<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", color, text );
}
public TAFGump( Mobile from, string initialText ) : base( 30, 20 )
{
if ( from == null )
return;

this.AddPage(1);
this.AddBackground(50, 0, 479, 309, 9270);
Mobile m_from = from;
Account tgt = (Account)from.Account;
int terg = tgt.TotalGameTime.Days;
int terh = tgt.TotalGameTime.Hours;
int teri = tgt.TotalGameTime.Minutes;
int terj = tgt.TotalGameTime.Seconds;
tere = from.Name;

this.AddImage(0, 0, 10400);
this.AddImage(0, 225, 10402);
this.AddImage(495, 0, 10410);
this.AddImage(495, 225, 10412);
this.AddImage(60, 15, 5536);
this.AddImage(275, 15, 1025);
this.AddLabel(205, 43, 88, "Account Name" );
this.AddLabel(205, 57, 0x480, from.Account.ToString() );
this.AddLabel(355, 43, 88, "Online Character" );
this.AddLabel(355, 57, 50, tere );
this.AddLabel(205, 80, 88, "Total Game Time" );
this.AddLabel(205, 100, 50, terg.ToString() + " Days." );
this.AddLabel(205, 115, 50, terh.ToString() + " Hours." );
this.AddLabel(205, 130, 50, teri.ToString() + " Minutes." );
this.AddLabel(205, 145, 50, terj.ToString() + " Seconds." );
bool toldfriend = ToldAFriend( from );
if ( !toldfriend )
{
this.AddLabel(205, 175, 50, String.Format("Who referred you to {0}?", TAFShardName ) );
this.AddButton(450, 200, 4023, 4025, 1, GumpButtonType.Reply, 0); //Okay for acct name button
this.AddImageTiled(300, 200, 140, 20, 0xBBC );
this.AddTextEntry(300, 200, 140, 20, 1152, 2, "");
this.AddLabel(205, 200, 88, "Account Name:" );
}
else
{
Account tagacct=(Account)from.Account;
string referrer = tagacct.GetTag("Referrer");
this.AddLabel(205, 200, 88, "Referrer:" );
this.AddLabel(300, 200, 0x480, referrer );
}
this.AddHtml(205, 230, 205, 56, Color( Center( initialText ), 0xFF0000 ) , false, false);
}

public override void OnResponse( NetState state, RelayInfo info )
{
Mobile from = state.Mobile;
Account acct = (Account)from.Account;
int id = info.ButtonID;

if( id == 1 )
{
string input = info.GetTextEntry( 2 ).Text;
Account tafacc = Accounts.GetAccount( input );
string initialText = "";

if ( tafacc == null )
{
initialText = String.Format( "Account: '{0}' NOT found", input );
}
else if ( input == "" )
{
initialText = "Please enter a valid Account name.";
}
else if ( input == acct.ToString() )
{
initialText = "You can't enter you own Account name!";
}
else
{
initialText = String.Format( "{0} Marked as Referrer", tafacc );
acct.SetTag( "ToldAFriend", "true" );
acct.SetTag( "Referrer", tafacc.ToString() );
}
from.SendGump( new TAFGump( from, initialText ) );
}
}
}
private static bool ToldAFriend( Mobile m )
{
Account acct=(Account)m.Account;
bool told = Convert.ToBoolean( acct.GetTag("ToldAFriend") );
if ( !told )
return false;
return true;
}
private static bool GotAFriend( Mobile m )
{
Account acct=(Account)m.Account;
bool got = Convert.ToBoolean( acct.GetTag("GotAFriend") );
if ( !got )
return false;
return true;
}
}
public class ReferrerReward : HalfApron
{
[Constructable]
public ReferrerReward() : base()
{
Name = String.Format("{0} Referrer Apron", TellAFriend.TAFShardName );
Hue = 1266;
LootType = LootType.Blessed;
Attributes.DefendChance = 10;
Resistances.Poison = 5;
}

public ReferrerReward(Serial serial) : base(serial)
{
}

public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);

writer.Write((int) 0);
}

public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);

int version = reader.ReadInt();
}
}
}

Değerlendirmeler

0 0

Total votes: 0

Üye Ol veya Giriş Yap

Bu içeriğe yorum atmak istiyorsanız hemen üye olun veya giriş yapın.

Discord ile Bağlan
Twitch ile Bağlan
Steam ile Bağlan
Google ile Bağlan

Yorumlar (0)

Henüz yorum yapılmamış
Sadece kayıtlı kullanıcılar yeni yorum yapabilir.


Ultima-Strike Discord
Benzer Sayfalar

Bulunamadı.



  • Son Forumlar
  • Sayfalar
  • Lucretius
    Son yıllarda UO tercihiniz: RP, PP (Power Play)...

    Ultima Online 1 gün önce

  • Syntax
    UO:Nimloth Yeniden Doğuyor !

    Sunucular 1 gün önce

  • Fream
    Üyeliği 18 yıl ve üstünde olanlar.

    Ultima Online 1 gün önce

  • Fream
    Üyeliği 15 yıl ve üzerinde olanlar.

    Ultima Online 1 gün önce

  • megastro.uokings
    Nephilim Pvp

    Sunucular 2 gün önce

  • Tymaron
    Oyuncuları & Yaratıkları Güçlendiren O Gizli...

    Ultima Online 3 gün önce

  • Deathwave
    UO'nun 4K remaster projesi var, grafiklere bir...

    Ultima Online 4 gün önce

  • Lucretius
    UO Connector Kullanım Koşulları

    Ultima Online 1 hafta önce

  • Lucretius
    Server kurulumu Hata

    Ultima Online 1 hafta önce

  • sarhos7573
    Royal UO

    Sunucular 1 hafta önce

  • İlkeler Medya
    Mul Dosyaları Hazırlıcak Arkadaş Aranıyor

    Ultima Online 1 hafta önce

  • Albatros
    NightUO

    Sunucular 1 hafta önce

  • morfin59
    Arkadaslar Potionlarin Üst üste Düsürme Nasil??

    Sphere Scripting 3 hafta önce

  • Tymaron
    Sistem Güncellemeleri: Portal, Sunucu Listesi ve...

    Duyurular 3 hafta önce

  • Lucretius
    AutoMod - AI Destekli Forum Moderasyon

    Duyurular 3 hafta önce

  • Yeni Başlayanlar İçin Ultima Online

    2025-11-27 19:07

  • Skill seçimlerinizi planlamak artık çok daha kolay

    Ultima Online Karakter Yapılandırma Aracı Bölümü Açıldı!

    2024-10-31 22:47

  • Ultima Online topluluğu, ClassicUO'nun sadece web client olarak kullanılabileceğinin açıklanmasının ardından tepkili.

    Resmi UO, Oyuncuları İkiye Böldü: Web Client Yeterli mi?

    2024-10-14 17:45

  • Ultima Online, ClassicUO ile resmi işbirliği yapıyor! Performans iyileştirmeleri, geniş oyun penceresi ve daha fazlası geliyor.

    Ultima Online, ClassicUO ile Resmi İşbirliğine Gidiyor

    2024-09-26 14:21

  • Centred#

    2024-07-08 22:50

  • CentrED+ 7.9

    2024-07-08 22:34

  • Distance(uzaklık) Sorgusu Hakkında

    2024-06-19 22:05

  • UoFiddler

    2024-06-01 02:19

Menü
  • ANASAYFA
  • FORUM
  • DOKÜMAN
  • İNDİR
  • İLETİŞİM
  • Bağlantılar
  • CS 1.6 indir
  • CS 1.6 Türkçe
  • CS 1.6 Bot
  • CS 1.6 CFG
  • CS 1.6 Rate Ayarları
  • UO Server
  • Ghost Mouse indir
  • FPS Nedir?
  • Ultima Online PVP Server
  • Makroman
  • UO Karakter Yapılandırma
    © 2004 - 2025 Ultima-Strike. Her hakkı saklıdır.