/*! \brief lockpicking skill \author Unknow, rewrite by Endymion \since 0.53 \param ps the client */ void Skills::target_lockpick( NXWCLIENT ps, P_TARGET t ) { P_CHAR pc = ps->currChar(); VALIDATEPC(pc); P_ITEM chest=pointers::findItemBySerial( t->getClicked() ); VALIDATEPI(chest); P_ITEM pick=MAKE_ITEM_REF( t->buffer[0] ); VALIDATEPI(pick); AMXEXECSVTARGET( pc->getSerial32(),AMXT_SKITARGS,LOCKPICKING,AMX_BEFORE); if (chest->amxevents[EVENT_IONLOCKPICK]!=NULL) { g_bByPass = false; chest->amxevents[EVENT_IONLOCKPICK]->Call(chest->getSerial32(), pc->getSerial32()); if (g_bByPass==true) return; } /* chest->runAmxEvent( EVENT_IONLOCKPICK, chest->getSerial32(), s ); if (g_bByPass==true) return; */ if( !item_inRange(pc,pick,1) ) { pc->sysmsg(TRANSLATE("You are too far away!")); } if (chest->magic==4) { return; } if(!chest->isSecureContainer()) { pc->sysmsg(TRANSLATE("That is not locked.")); return; } if(chest->more1==0 && chest->more2==0 && chest->more3==0 && chest->more4==0) { //Make sure it isn't an item that has a key (i.e. player house, chest..etc) if(pc->checkSkill( LOCKPICKING, 0, 1000)) { switch(chest->type) { case 8: chest->type=1; break; case 13: chest->type=12; break; case 64: chest->type=63; break; default: LogError("switch reached default"); return; } soundeffect3(chest, 0x0241); pc->sysmsg(TRANSLATE("You manage to pick the lock.")); } else { if((rand()%100)>50) { pc->sysmsg( TRANSLATE("You broke your lockpick!")); pick->ReduceAmount(1); } else pc->sysmsg(TRANSLATE( "You fail to open the lock.")); } } else pc->sysmsg(TRANSLATE("That cannot be unlocked without a key.")); AMXEXECSVTARGET( pc->getSerial32(),AMXT_SKITARGS,LOCKPICKING,AMX_AFTER); }
LOGICAL item_inBuildRange(P_CHAR a, P_ITEM b ) { return item_inRange( a, b, BUILDRANGE ); }
/*! \brief Snoop into container \author Unknow, completly rewritten by Endymion \param snooper the snooper \param cont the contanier */ void snooping( P_CHAR snooper, P_ITEM cont ) { VALIDATEPC(snooper); NXWCLIENT ps = snooper->getClient(); if( ps == NULL ) return; NXWSOCKET s = ps->toInt(); VALIDATEPI(cont); P_CHAR owner = cont->getPackOwner(); VALIDATEPC(owner); char temp[TEMP_STR_SIZE]; if (snooper->getSerial32() == owner->getSerial32()) snooper->showContainer(cont); else if (snooper->IsGMorCounselor()) snooper->showContainer(cont); else if ((char_inRange(snooper, owner, 2)) ||(item_inRange(snooper, cont, 2))) { if ( owner->HasHumanBody() && ( owner->getOwnerSerial32()==snooper->getSerial32())) snooper->showContainer(cont); else if ( owner->npcaitype == NPCAI_PLAYERVENDOR) snooper->showContainer(cont); else { if ((cont->getContSerial()>1) && (cont->getContSerial() != snooper->getSerial32()) ) { if ( owner->amxevents[EVENT_CHR_ONSNOOPED]) { g_bByPass = false; owner->amxevents[EVENT_CHR_ONSNOOPED]->Call( owner->getSerial32(), snooper->getSerial32()); if (g_bByPass==true) return; } /* owner->runAmxEvent( EVENT_CHR_ONSNOOPED, owner->getSerial32(), s); if (g_bByPass==true) return; */ snooper->objectdelay=SrvParms->snoopdelay * MY_CLOCKS_PER_SEC + uiCurrentTime; if ( owner->IsGMorCounselor()) { snooper->sysmsg( TRANSLATE("You can't peek into that container or you'll be jailed."));// AntiChrist sprintf( temp, TRANSLATE("%s is trying to snoop you!"), snooper->getCurrentNameC()); owner->sysmsg(temp); return; } else if (snooper->checkSkill( SNOOPING, 0, 1000)) { snooper->showContainer(cont); snooper->sysmsg( TRANSLATE("You successfully peek into that container.")); } else { snooper->sysmsg( TRANSLATE("You failed to peek into that container.")); if ( owner->npc ) owner->talk(s, TRANSLATE("Art thou attempting to disturb my privacy?"), 0); else { sprintf( temp, TRANSLATE("You notice %s trying to peek into your pack!"), snooper->getCurrentNameC()); owner->sysmsg( temp ); } snooper->IncreaseKarma(-ServerScp::g_nSnoopKarmaLoss);//AntiChrist snooper->modifyFame(-ServerScp::g_nSnoopFameLoss);//AntiChrist setCrimGrey(snooper, ServerScp::g_nSnoopWillCriminal); } } } } else { snooper->sysmsg(TRANSLATE("You are too far away!")); } }
LOGICAL item_inVisRange(P_CHAR a, P_ITEM b ) { return item_inRange( a, b, VISRANGE ); }