Skip to content

Commit

Permalink
Merge 3cf45fc into 7ee1b64
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinEady committed Sep 11, 2021
2 parents 7ee1b64 + 3cf45fc commit ca128fa
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 9 deletions.
8 changes: 7 additions & 1 deletion docs/docs.polserver.com/pol100/corechanges.xml
Expand Up @@ -2,9 +2,15 @@
<ESCRIPT>
<header>
<topic>Latest Core Changes</topic>
<datemodified>08-30-2021</datemodified>
<datemodified>09-11-2021</datemodified>
</header>
<version name="POL100.1.0">
<entry>
<date>09-11-2021</date>
<author>Kevin:</author>
<change type="Fixed">party.AddMember(character) will no longer error if the character is a candidate of the party.</change>
<change type="Changed">party.AddMember(character) will now error if passed an NPC.</change>
</entry>
<entry>
<date>08-30-2021</date>
<author>Nando:</author>
Expand Down
12 changes: 6 additions & 6 deletions docs/docs.polserver.com/pol100/objref.xml
Expand Up @@ -778,12 +778,12 @@ Pre-intialize with: var s := struct { a := 1, b := 2 };</explain>
<member mname="candidates" type="Array" access="r/o" mdesc="Array of Offline Character Refs who are party candidates" />
<member mname="leader" type="OfflineCharRef" access="r/o" mdesc="Offline Character Ref of leader" />

<method proto="setleader(CharacterRef)" returns="error/true" desc="sets new leader" />
<method proto="addmember(CharacterRef)" returns="error/true" desc="adds a character to the party" />
<method proto="addcandidate(CharacterRef)" returns="error/true" desc="adds a character to the party as candidate" />
<method proto="removemember(CharacterRef)" returns="true/error" desc="removes a character member" />
<method proto="removecandidate(CharacterRef)" returns="true/error" desc="removes a character candidate" />
<method proto="getprop(string propname)" returns="script object/error" desc="Returns an unpacked script object (i.e. int,string,array,etc)" />
<method proto="setleader(CharacterRef)" returns="error/true" desc="Sets new leader." />
<method proto="addmember(CharacterRef)" returns="error/true" desc="Adds a character to the party. If the player is already candidate of another party, this function will fail." />
<method proto="addcandidate(CharacterRef)" returns="error/true" desc="Adds a character to the party as candidate." />
<method proto="removemember(CharacterRef)" returns="true/error" desc="Removes a character member." />
<method proto="removecandidate(CharacterRef)" returns="true/error" desc="Removes a character candidate." />
<method proto="getprop(string propname)" returns="script object/error" desc="Returns an unpacked script object (i.e. int,string,array,etc)." />
<method proto="setprop(string propname, object propval)" returns="true/error" desc="Sets a packable object to a property." />
<method proto="eraseprop(string propname)" returns="true/error" desc="Erases the property named 'propname'." />
<method proto="propnames()" returns="Array" desc="Returns an array of property name strings." />
Expand Down
3 changes: 3 additions & 0 deletions pol-core/doc/core-changes.txt
@@ -1,4 +1,7 @@
-- POL100.1.0 --
09-11-2021 Kevin:
Fixed: party.AddMember(character) will no longer error if the character is a candidate of the party.
Changed: party.AddMember(character) will now error if passed an NPC.
08-30-2021 Nando:
Fixed: Possible infinite recursion of the attack hook if a character was moved by the attack hook
08-14-2021 Kevin:
Expand Down
17 changes: 15 additions & 2 deletions pol-core/pol/partyscrobj.cpp
Expand Up @@ -168,20 +168,33 @@ BObjectImp* EPartyRefObjImp::call_polmethod_id( const int id, Core::UOExecutor&
case MTH_ADDMEMBER:
{
Mobile::Character* chr;
bool is_candidate = false;
if ( !ex.hasParams( 1 ) )
return new BError( "Not enough parameters" );
if ( !ex.getCharacterParam( 0, chr ) )
return new BError( "Invalid parameter type" );
if ( chr->has_party() )
return new BError( "Character is already in a party" );
else if ( chr->has_candidate_of() )
return new BError( "Character is already candidate of a party" );
if ( chr->has_candidate_of() )
{
is_candidate = chr->candidate_of() == obj_.get();
if ( !is_candidate )
return new BError( "Character is already candidate of another party" );
}
else if ( chr->has_offline_mem_of() )
return new BError( "Character is already offline member of a party" );
if ( !obj_->can_add() )
return new BError( "Party is already full" );
if ( !chr->has_active_client() )
return new BError( "Character is offline" );
if ( obj_->add_member( chr->serial ) )
{
if ( is_candidate )
{
obj_->remove_candidate( chr->serial );
chr->cancel_party_invite_timeout();
chr->candidate_of( nullptr );
}
chr->party( obj_.get() );
if ( Core::settingsManager.party_cfg.Hooks.OnAddToParty )
Core::settingsManager.party_cfg.Hooks.OnAddToParty->call( chr->make_ref() );
Expand Down

0 comments on commit ca128fa

Please sign in to comment.