8 #include "pol_global_config.h" 14 #include "../../bscript/berror.h" 15 #include "../../bscript/bobject.h" 16 #include "../../bscript/executor.h" 17 #include "../../bscript/objmembers.h" 18 #include "../../bscript/objmethods.h" 19 #include "../../clib/compilerspecifics.h" 20 #include "../../clib/rawtypes.h" 21 #include "../clfunc.h" 22 #include "../fnsearch.h" 23 #include "../globals/settings.h" 24 #include "../globals/uvars.h" 25 #include "../mobile/charactr.h" 27 #include "../party_cfg.h" 28 #include "../pktdef.h" 29 #include "../syshook.h" 30 #include "../unicode.h" 31 #include "../uoexhelp.h" 32 #include "../uoscrobj.h" 38 using namespace Module;
50 using namespace Bscript;
93 return (
obj_->test_size() );
108 return ( partyref_imp->
obj_->leader() ==
obj_->leader() );
127 if ( objmember !=
nullptr )
139 std::unique_ptr<ObjArray> arr(
new ObjArray );
140 auto itr =
obj_->_member_serials.begin();
141 while ( itr !=
obj_->_member_serials.end() )
144 if ( chr !=
nullptr )
150 itr =
obj_->_member_serials.erase( itr );
158 if ( chr !=
nullptr )
166 std::unique_ptr<ObjArray> arr(
new ObjArray );
167 auto itr =
obj_->_candidates_serials.begin();
168 while ( itr !=
obj_->_candidates_serials.end() )
171 if ( chr !=
nullptr )
177 itr =
obj_->_candidates_serials.erase( itr );
190 if ( objmethod !=
nullptr )
194 bool changed =
false;
207 return new BError(
"Not enough parameters" );
209 return new BError(
"Invalid parameter type" );
210 if ( chr->has_party() )
211 return new BError(
"Character is already in a party" );
212 else if ( chr->has_candidate_of() )
213 return new BError(
"Character is already candidate of a party" );
214 else if ( chr->has_offline_mem_of() )
215 return new BError(
"Character is already offline member of a party" );
216 if ( !
obj_->can_add() )
217 return new BError(
"Party is already full" );
227 obj_->send_member_list(
nullptr );
228 obj_->send_stats_on_add( chr );
231 return new BLong( static_cast<int>(
obj_->_member_serials.size() ) );
238 return new BError(
"Not enough parameters" );
240 return new BError(
"Invalid parameter type" );
242 return new BError(
"Character is not in this party" );
244 return new BError(
"Character is leader of this party" );
249 obj_->send_remove_member( chr, &disband );
250 chr->party(
nullptr );
262 return new BLong( 1 );
264 return new BLong( 0 );
271 return new BError(
"Not enough parameters" );
273 return new BError(
"Invalid parameter type" );
275 return new BError(
"Character is not in this party" );
277 return new BError(
"Character is already leader of this party" );
280 obj_->send_member_list(
nullptr );
281 return new BLong( 1 );
288 return new BError(
"Not enough parameters" );
290 return new BError(
"Invalid parameter type" );
291 if ( chr->has_party() )
292 return new BError(
"Character is already in a party" );
293 else if ( chr->has_candidate_of() )
294 return new BError(
"Character is already candidate of a party" );
295 else if ( chr->has_offline_mem_of() )
296 return new BError(
"Character is already offline member of a party" );
297 if ( !
obj_->can_add() )
298 return new BError(
"Party is already full" );
300 return new BError(
"Character is offline" );
308 if ( leader !=
nullptr )
310 chr->candidate_of(
obj_.
get() );
312 return new BLong( 1 );
315 return new BLong( 0 );
322 return new BError(
"Not enough parameters" );
324 return new BError(
"Invalid parameter type" );
326 return new BError(
"Character is not candidate of this party" );
332 chr->candidate_of(
nullptr );
337 if ( leader !=
nullptr )
345 if ( !
obj_->test_size() )
347 return new BLong( 1 );
349 return new BLong( 0 );
353 bool changed =
false;
365 if ( aob ==
nullptr )
367 err =
new BError(
"Invalid parameter type" );
375 err =
new BError(
"Party has no leader" );
387 if ( leader->has_party() )
388 return new BError(
"Leader is already in a party" );
389 else if ( leader->has_candidate_of() )
390 return new BError(
"Leader is already candidate of a party" );
391 else if ( leader->has_offline_mem_of() )
392 return new BError(
"Leader is already offline member of a party" );
393 else if ( leader == firstmem )
394 return new BError(
"Leader and Firstmember are the same" );
395 else if ( firstmem->has_party() )
396 return new BError(
"First Member is already in a party" );
397 else if ( firstmem->has_candidate_of() )
398 return new BError(
"First Member is already candidate of a party" );
399 else if ( firstmem->has_offline_mem_of() )
400 return new BError(
"First Member is already offline member of a party" );
404 leader->party( party );
408 firstmem->party( party );
422 return new BLong( 1 );
425 return new BError(
"Invalid parameter type" );
435 return new BLong( 1 );
451 size_t textlen = oText->
ref_arr.size();
454 return new BError(
"Unicode array exceeds maximum size." );
456 return new BError(
"Invalid value in Unicode array." );
462 return new BLong( 1 );
465 return new BError(
"Invalid parameter type" );
481 ( getObjArrayParam( 3, oText ) ) )
483 size_t textlen = oText->
ref_arr.size();
486 return new BError(
"Unicode array exceeds maximum size." );
488 return new BError(
"Invalid value in Unicode array." );
495 return new BLong( 1 );
498 return new BError(
"Invalid parameter type" );
void cancel_party_invite_timeout()
virtual const char * typeOf() const POL_OVERRIDE
void set_party_invite_timeout()
struct Pol::Core::Party_Cfg::@14 Hooks
void send_sysmessage_cl(Client *client, unsigned int cliloc_num, const u16 *arguments, unsigned short font, unsigned short color)
Bscript::BObjectImp * mf_SendPartyMsg()
std::vector< FunctionDef > FunctionTable
u16 gwtext[(SPEECH_MAX_LEN+1)]
ExportedFunction * OnPartyCreate
bool call(Bscript::BObjectImp *p0)
bool isa(BObjectType type) const
ObjMember * getKnownObjMember(const char *token)
BObjectImp * CreatePartyRefObjImp(Core::Party *party)
bool operator==(T *ptr, const ref_ptr< T > &rptr)
virtual BObjectImp * call_method(const char *methodname, Executor &ex) POL_OVERRIDE
EPartyRefObjImp(Core::PartyRef pref)
bool has_active_client() const
PartyExecutorModule(Bscript::Executor &exec)
ExportedFunction * OnAddToParty
Bscript::BObjectImp * mf_SendPrivatePartyMsg()
void send_msg_to_all(unsigned int clilocnr, const char *affix=0, Mobile::Character *exeptchr=nullptr) const
const int CLP_Notify_Decline
ObjMethod * getKnownObjMethod(const char *token)
const BApplicObjType * object_type() const
bool getCharacterParam(Bscript::Executor &exec, unsigned param, Mobile::Character *&chrptr)
Bscript::BObjectImp * CallPropertyListMethod_id(PropertyList &proplist, const int id, Bscript::Executor &ex, bool &changed)
void send_empty_party(Mobile::Character *chr)
virtual BObjectImp * copy() const POL_OVERRIDE
virtual BObjectRef get_member(const char *membername) POL_OVERRIDE
bool getPartyParam(Executor &exec, unsigned param, Core::Party *&party, BError *&err)
void disband_party(u32 leader)
BApplicObjType party_type
ExportedFunction * OnPublicChat
bool convertArrayToUC(Bscript::ObjArray *&in_text, u16 *out_wtext, size_t textlen, bool ConvToBE, bool nullterm)
static UninitObject * create()
ExportedFunction * OnLeaveParty
virtual Bscript::BObjectImp * make_ref() POL_OVERRIDE
virtual BObjectImp * call_method_id(const int id, Executor &ex, bool forcebuiltin=false) POL_OVERRIDE
Bscript::BObjectImp * mf_CreateParty()
SettingsManager settingsManager
void send_member_msg_public(Mobile::Character *chr, u16 *wtext, size_t wtextlen) const
Mobile::Character * system_find_mobile(u32 serial)
Bscript::BObjectImp * mf_DisbandParty()
BApplicObjBase * getApplicObjParam(unsigned param, const BApplicObjType *object_type)
virtual u8 typeOfInt() const POL_OVERRIDE
void send_sysmessage_cl_affix(Client *client, unsigned int cliloc_num, const char *affix, bool prepend, const u16 *arguments, unsigned short font, unsigned short color)
void send_member_list(Mobile::Character *to_chr)
D explicit_cast(const S &s)
bool hasParams(unsigned howmany) const
Bscript::BObjectImp * CallPropertyListMethod(PropertyList &proplist, const char *methodname, Bscript::Executor &ex, bool &changed)
ExportedFunction * OnPrivateChat
void send_stats_on_add(Mobile::Character *newmember) const
virtual std::string name() const
bool add_member(u32 serial)
virtual bool isTrue() const POL_OVERRIDE
void send_member_msg_private(Mobile::Character *chr, Mobile::Character *tochr, u16 *wtext, size_t wtextlen) const
virtual BObjectRef get_member_id(const int id) POL_OVERRIDE
virtual bool operator==(const BObjectImp &objimp) const POL_OVERRIDE
void send_invite(Mobile::Character *member, Mobile::Character *leader)