Advertisement
KeplerBR

[Plugin 4fun] Informar dados dos char's próximos

Feb 18th, 2013
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 4.78 KB | None | 0 0
  1. #############################################
  2. # This plugin is licensed under the GNU GPL #
  3. # Copyright 2005 original plugin by iseo    #
  4. # Adapted by Alison and KeplerBR            #
  5. #############################################
  6.  
  7. package playerRecord;
  8.     use strict;
  9.     use warnings;
  10.     use Plugins;
  11.     use Globals;
  12.     use Utils qw(binAdd existsInList getFormattedDate swrite getHex);
  13.  
  14.     # Register Plugin and Hooks
  15.     Plugins::register("PlayerRecord", "playerRecord", \&on_unload);
  16.         my $hooks = Plugins::addHooks(
  17.         ['charNameUpdate', \&write_player],                 # Escrever os dados gerais
  18.         );
  19.  
  20.     #On Unload code
  21.     sub on_unload {
  22.         Plugins::delHooks($hooks);
  23.     }
  24.  
  25.     ################################
  26.     # Write general data of player #
  27.     sub write_player {
  28.         my $hookname = shift;
  29.         my $args = shift;
  30.  
  31.         # Account and Char Information
  32.         my $targetAccountId = $args->{player}{nameID};
  33.         #my $targetId = $args->{player}{nameID};
  34.  
  35.         # Name and Sex Information
  36.         my $targetName = $args->{player}{name};
  37.         my $targetSex = $args->{player}{sex};
  38.  
  39.         # Hair and Cloth Information
  40.         my $targetHairColor = $args->{player}{hair_color};
  41.         my $targetHairStyle = $args->{player}{hair_style};
  42.         my $targetclothColor = $args->{player}{clothes_color};
  43.  
  44.         # Job Information
  45.         my $targetJob = $jobs_lut{$args->{player}{jobID}};
  46.  
  47.         # Lvl Information
  48.         my $targetLvl = $args->{player}{lv};
  49.  
  50.         # Party Information
  51.         my $targetPartyName = $args->{player}{party}{name};
  52.  
  53.         # Guild Information
  54.         my ($targetGuildId, $targetGuildEmblemId, $targetGuildName, $targetGuildPosition);
  55.         $targetGuildId = unpack("v1", $args->{player}{guildID}) if ($args->{player}{guildID});
  56.         $targetGuildEmblemId = unpack("v1", $args->{player}{emblemID}) if ($args->{player}{emblemID});
  57.         $targetGuildName = $args->{player}{guild}{name} if ($args->{player}{guild}{name});
  58.         $targetGuildPosition = $args->{player}{guild}{title} if ($args->{player}{guild}{title});
  59.  
  60.         # Equips Head Information
  61.         my ($targetEquipHeadTop, $targetEquipHeadMid, $targetEquipHeadLow);
  62.         $targetEquipHeadTop = $items_lut{$args->{player}{headgear}{top}} if ($args->{player}{headgear}{top});
  63.         $targetEquipHeadMid = $items_lut{$args->{player}{headgear}{mid}} if ($args->{player}{headgear}{top});
  64.         $targetEquipHeadLow = $items_lut{$args->{player}{headgear}{low}} if ($args->{player}{headgear}{low});
  65.  
  66.         # Equips Body Information
  67.         my ($targetEquipBodyWeapon, $targetEquipBodyShield, $targetEquipBodyShoes);
  68.         $targetEquipBodyWeapon = $items_lut{$args->{player}{weapon}} if ($args->{player}{weapon});
  69.         $targetEquipBodyShield = $items_lut{$args->{player}{shield}} if ($args->{player}{shield});
  70.         $targetEquipBodyShoes = $items_lut{$args->{player}{shoes}} if ($args->{player}{shoes});
  71.  
  72.         # Time Information
  73.         my $targetTime = localtime time;
  74.  
  75.         # Validators
  76.         if(not defined $targetclothColor) { $targetclothColor = 0; }
  77.         if(not defined $targetEquipBodyShoes) { $targetEquipBodyShoes = 0; }
  78.         if(not defined $targetPartyName or $targetPartyName eq "") { $targetPartyName = "NULL"; }
  79.         if(not defined $targetGuildName or $targetGuildName eq "") { $targetGuildName = "NULL"; }
  80.         if(not defined $targetGuildPosition or $targetGuildPosition eq "" ) { $targetGuildPosition = "NULL"; }
  81.  
  82.         # Preparar mensagem
  83.         my ($mensagemTemEquips, $equipsHead, $equipsHand);
  84.         my $mensagemGuild = '';
  85.        
  86.         if (($targetEquipHeadTop || $targetEquipHeadMid || $targetEquipHeadLow) && ($targetEquipBodyWeapon || $targetEquipBodyShield)) {
  87.             $mensagemTemEquips = 'Os nomes dos equipamentos na cabeça e nas mãos são:';
  88.         } elsif ($targetEquipBodyWeapon || $targetEquipBodyShield) {
  89.             $mensagemTemEquips = 'Tem nada na cabeça, mas nas mãos tem:';
  90.         } elsif ($targetEquipHeadTop || $targetEquipHeadMid || $targetEquipHeadLow) {
  91.             $mensagemTemEquips = 'Tem nada nas mãos, mas na cabeça tem:';
  92.         } else {
  93.             $mensagemTemEquips = 'Esta usando nada na cabeça e mãos.';
  94.         }
  95.  
  96.         $equipsHead .= "Topo da cabeça: $targetEquipHeadTop |" if ($targetEquipHeadTop);
  97.         $equipsHead .= " Meio da cabeça: $targetEquipHeadMid |" if ($targetEquipHeadMid);
  98.         $equipsHead .= " Parte de baixo da cabeça: $targetEquipHeadLow" if ($targetEquipHeadLow);
  99.  
  100.         $equipsHand .= "Arma: $targetEquipBodyWeapon |" if ($targetEquipBodyWeapon);
  101.         $equipsHand .= " Escudo: $targetEquipBodyShield" if ($targetEquipBodyShield);
  102.  
  103.         $mensagemGuild = " Seu clã, $targetGuildName, tem o ID $targetGuildId." if ($targetGuildId);
  104.  
  105.         # Enviar
  106.         Commands::run("c ------------------/--- $targetName ----\\\------------------");
  107.         Commands::run("c Seu job é $targetJob, e esta no level $targetLvl!");
  108.         Commands::run("c $mensagemGuild") if ($mensagemGuild);
  109.         Commands::run("c ID é $targetAccountId. $mensagemTemEquips");
  110.         Commands::run("c $equipsHead") if ($equipsHead);
  111.         Commands::run("c $equipsHand")  if ($equipsHand);
  112.     }
  113.  
  114.     1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement