r8399 and r8405: revolving_entity

Wrote new code? Fixed a bug? Want to discuss technical stuff? Feel free to post it here.

Moderator: Moderators

Message
Author
Kaspy
Halfway to Eternity
Halfway to Eternity
Posts: 398
Joined: 08 Jun 2012, 15:42
Noob?: No
Location: Brazil

r8399 and r8405: revolving_entity

#1 Post by Kaspy »

r8399:
It would not be good an make new article in wiki about the new amuletType condition in config.txt?

r8405:
Since the function was faulty, so that this can not log in, I decided to do a quick fix, but not sure if that's right.
By the way, I still have doubts... What exactly is it for? What is amuletType?




Just a detail... It's good to test before sending something to SVN.
Image

fireway
Noob
Noob
Posts: 5
Joined: 29 Dec 2012, 14:03
Noob?: Yes

Re: r8399 and r8405: revolving_entity

#2 Post by fireway »

fix for twRO

Code: Select all

sub revolving_entity {
	my ($self, $args) = @_;

	# Monk Spirits or Gunslingers' coins or senior ninja
	my $sourceID = $args->{sourceID};
	my $entityNum = $args->{entity};
	my $entityElement = $elements_lut{$args->{type}} if ($args->{entity} && $entityNum);
	my $entityType;

	my $actor = Actor::get($sourceID);
	my $jobID = $actor->{jobID};
	if ($jobID == 24) {
		$entityType = T('coin');
	} elsif ($jobID == 4211 || $jobID == 4212) {
		$entityType = T('amulet');
	} else {
		$entityType = T('spirit');
	}

	if ($sourceID eq $accountID && $entityNum != $char->{spirits}) {
		$char->{spirits} = $entityNum;
		$char->{amuletType} = $entityElement;
		message TF("You have %s %s(s) now\n", $entityNum, $entityType), "parseMsg_statuslook", 1 ;
	} elsif ($entityNum != $actor->{spirits}) {
		$actor->{spirits} = $entityNum;
		$actor->{amuletType} = $entityElement ;
		message TF("%s has %s %s(s) now\n", $actor, $entityNum, $entityType), "parseMsg_statuslook", 2;

	}
}

Kaspy
Halfway to Eternity
Halfway to Eternity
Posts: 398
Joined: 08 Jun 2012, 15:42
Noob?: No
Location: Brazil

Re: r8399 and r8405: revolving_entity

#3 Post by Kaspy »

Send

If anyone is interested in writing the text to include the condition in the Wiki, just post here that I add in the Wiki.
Image

fireway
Noob
Noob
Posts: 5
Joined: 29 Dec 2012, 14:03
Noob?: Yes

Re: r8399 and r8405: revolving_entity

#4 Post by fireway »

i'm Sorry ~

The original code lines is wrong~

Code: Select all

my $entityElement = $elements_lut{$args->{type}} if ($args->{entity} && $entityNum);
It should be something like:

Code: Select all

my $entityElement = $elements_lut{$args->{type}} if ($args->{type} && $entityNum);
and

src/Commands.pm need restore to R8399 ~

Thank you~

Dark Airnel
Been there done that!
Been there done that!
Posts: 133
Joined: 09 Oct 2009, 01:43
Noob?: No

Re: r8399 and r8405: revolving_entity

#5 Post by Dark Airnel »

amuletType seems like related to the Oboro/Kagerou skill Charm. It is possible that the elemental charms summoned when the skill behaves differently from Monk/Gunslinger spirits.

Kaspy
Halfway to Eternity
Halfway to Eternity
Posts: 398
Joined: 08 Jun 2012, 15:42
Noob?: No
Location: Brazil

Re: r8399 and r8405: revolving_entity

#6 Post by Kaspy »

Send
Revised and correct all the problems I found it based on my local server, did not get to test in an official server.

Hopefully that the problems related to it have ended.
Image

fireway
Noob
Noob
Posts: 5
Joined: 29 Dec 2012, 14:03
Noob?: Yes

Re: r8399 and r8405: revolving_entity

#7 Post by fireway »

KeplerBR wrote:Send
Revised and correct all the problems I found it based on my local server, did not get to test in an official server.

Hopefully that the problems related to it have ended.

Code: Select all

sub revolving_entity {
	my ($self, $args) = @_;

	# Monk Spirits or Gunslingers' coins or senior ninja
	my $sourceID = $args->{sourceID};
	my $entityNum = $args->{entity};
	my $entityType;

	my $actor = Actor::get($sourceID);
	if ($entityNum != $actor->{spirits}) {
		$actor->{spirits} = $entityNum;
		if ($lastSwitch eq '01D0') {
			$entityType = T('spirit');
		} elsif ($lastSwitch eq '01E1') {
			$entityType = T('coin');
		} else {
			$entityType = T('amulet');
			delete $actor->{amuletType};
		}
		if ($args->{type} && $entityNum) {
			$actor->{amuletType} = $elements_lut{$args->{type}};
			$sourceID eq $accountID ? message TF("You have %s %s(s) of %s now\n", $entityNum, $entityType, $actor->{amuletType}), "parseMsg_statuslook", 1
									: message TF("%s has %s %s(s) of %s now\n", $actor, $entityNum, $entityType, $actor->{amuletType}), "parseMsg_statuslook", 2
		} else {
			$sourceID eq $accountID ? message TF("You have %s %s(s) now\n", $entityNum, $entityType), "parseMsg_statuslook", 1
									: message TF("%s has %s %s(s) now\n", $actor, $entityNum, $entityType), "parseMsg_statuslook", 2
		}
	}
}
work efficiently!!
Is that all right?

EternalHarvest
Developers
Developers
Posts: 1798
Joined: 05 Dec 2008, 05:42
Noob?: Yes

Re: r8399 and r8405: revolving_entity

#8 Post by EternalHarvest »

Code: Select all

$entityElement = $elements_lut{$args->{type}};
$char->{amuletType} = $entityElement;
if ($config{$prefix . "_amuletType"}) {return 0 unless $config{$prefix . "_amuletType"} == $char->{amuletType}; }
$char->{amuletType} is a string, but compared like a number.

Code: Select all

# 01D0 (spirits), 01E1 (coins), 08CF (amulets)
sub revolving_entity {
	if ($lastSwitch eq '01D0') {
		$entityType = T('spirit');
What's up with global $lastSwitch when you have $args->{switch}? Better to not use global variable for this in PacketParser at all.

Code: Select all

$entityType = T('amulet');
message TF("You have %s %s(s) of %s now\n", $entityNum, $entityType, $entityElement);
Not very good for translators, but at least leave comments for translators for non-obvious templates. Better to split phrases about spirits, coins etc.

Kaspy
Halfway to Eternity
Halfway to Eternity
Posts: 398
Joined: 08 Jun 2012, 15:42
Noob?: No
Location: Brazil

Re: r8399 and r8405: revolving_entity

#9 Post by Kaspy »

EternalHarvest wrote:Not very good for translators, but at least leave comments for translators for non-obvious templates. Better to split phrases about spirits, coins etc.
I'm not sure what to do ... So it got better?

Code: Select all

	if ($args->{switch} eq '01D0') {
		$entityType = T('spirit'); # Note translation: Spirit sphere of the monks
	} elsif ($args->{switch} eq '01E1') {
		$entityType = T('coin'); # Note translation: Coin of the gunslinger
	} elsif ($args->{switch} eq '08CF') {
		$entityType = T('amulet'); # Note translation: Amulet of the warlock

Code: Select all

		$entityElement ? message TF("You have %s %s(s) of %s now\n", $entityNum, $entityType, $entityElement), "parseMsg_statuslook", 1 : # Note translation: Message displays following: quantity, the name of the entity and its element
						 message TF("You have %s %s(s) now\n", $entityNum, $entityType), "parseMsg_statuslook", 1; # Note translation: Message displays following: quantity and the name of the entity

Code: Select all

		$entityElement ? message TF("%s has %s %s(s) of %s now\n", $actor, $entityNum, $entityType, $entityElement), "parseMsg_statuslook", 1 : # Note translation: Message displays following: actor, quantity, the name of the entity and its element
		message TF("%s has %s %s(s) now\n", $actor, $entityNum, $entityType), "parseMsg_statuslook", 1; # Note translation: Message displays following: actor, quantity and the name of the entity
Image

EternalHarvest
Developers
Developers
Posts: 1798
Joined: 05 Dec 2008, 05:42
Noob?: Yes

Re: r8399 and r8405: revolving_entity

#10 Post by EternalHarvest »

We use "--add-comments='Translation Comment:'" for xgettext (as in src/po/update.sh), you can find usage examples both in code and in po files.

Post Reply